feat: Add CharacterErrorRate (CER) metric to ignite.metrics.nlp#3785
Open
Shubh3005 wants to merge 4 commits into
Open
feat: Add CharacterErrorRate (CER) metric to ignite.metrics.nlp#3785Shubh3005 wants to merge 4 commits into
Shubh3005 wants to merge 4 commits into
Conversation
Implements CharacterErrorRate as a follow-up to PR pytorch#3638 (WER). Closes pytorch#3634 - character_error_rate.py: CER metric using character-level Levenshtein distance, inheriting from _BaseErrorRate - test_character_error_rate.py: 15 test cases covering edge cases, batch accumulation, reset, unicode, and whitespace handling Follows same structure as word_error_rate.py and bleu.py conventions.
Author
Collaborator
|
Hi, @Shubh3005 we really appreciate your pr, but I would still recommend you check withe owner of the other open pr if they are still working on it or not just be sure :) If not then we can move forward with your pr. |
Author
|
Thank you! I'll reach out to @Manimaran-tech on PR #3638 to check their status. Will follow up shortly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
CharacterErrorRate(CER) as a follow-up to #3638 (WER), resolving #3634.CER measures the edit distance at the character level — used in ASR and OCR evaluation where a single character error (e.g. misreading a financial figure) is a severe failure.
Changes
ignite/metrics/nlp/character_error_rate.py— CER metric inheriting from_BaseErrorRate, using character-level Levenshtein distancetests/ignite/metrics/nlp/test_character_error_rate.py— 15 test cases covering: identical sequences, single deletion/insertion/substitution, empty inputs, batch accumulation, multi-update accumulation, reset, single string input, whitespace as character, unicodeignite/metrics/nlp/__init__.py— exportsCharacterErrorRateDesign
Follows the same structure as
word_error_rate.pyandbleu.py:_BaseErrorRatefromword_error_rate.py_tokenizereturnslist(text)instead oftext.split()Closes #3634