ignite icon indicating copy to clipboard operation
ignite copied to clipboard

Feat: Implement Word Error Rate (WER) metric

Open Manimaran-tech opened this issue 8 months ago • 3 comments

🚀 Feature: WER and CER Metrics

Resolves #3634

This PR implements \WordErrorRate\ and \CharacterErrorRate\ natively within \ignite.metrics.nlp\ to evaluate ASR and OCR models, using an internal, dependency-free Levenshtein distance calculation to remain lightweight.

Changes:

  • Added robust Levenshtein Distance dynamic programming solver.
  • Implemented \WordErrorRate\ which splits strings via tokens to compute word-level permutations.
  • Implemented \CharacterErrorRate\ which computes exact string edit distance.
  • Integrated the new classes into the \ignite.metrics.nlp\ initializers.
  • Provided 100% test coverage mimicking existing Pytest tests in Ignite.

Manimaran-tech avatar Mar 05 '26 17:03 Manimaran-tech

I have updated the implementation to split the WER and CER metrics into separate files (word_error_rate.py and character_error_rate.py) and organized the tests accordingly, as suggested. This maintains consistency with the existing codebase conventions (similar to Bleu and Rouge). All tests for both metrics are passing.

Manimaran-tech avatar Mar 08 '26 09:03 Manimaran-tech

@Manimaran-tech if you would like to move forward with this PR, let's split it into 2: one PR per one metric

vfdev-5 avatar Mar 23 '26 01:03 vfdev-5

Hi @Manimaran-tech — the maintainer suggested I check with you before moving forward with my CER PR (#3785). Are you still planning to submit a separate CER implementation as a follow-up to your WER PR? Happy to coordinate or defer if you're actively working on it.

Shubh3005 avatar Jun 10 '26 15:06 Shubh3005