Skip to content

Conversation

bavi404
Copy link

@bavi404 bavi404 commented Aug 13, 2025

fixes #693

Summary

  • Add tokenizer_name option to bleu metric.
  • New modes: "coco"/"ptb" (COCO PTBTokenizer; requires pycocoevalcap) and "whitespace".
  • Default behavior unchanged (tokenizer_13a).

Motivation

  • Address discrepancy with pycocoevalcap BLEU caused by PTB vs 13a tokenization differences, esp. around commas/periods.

Changes

  • metrics/bleu/tokenizer_13a.py: add CocoPTBTokenizer, WhitespaceTokenizer.
  • metrics/bleu/bleu.py: new tokenizer_name param; accepts "coco"|"ptb"|"whitespace".
  • metrics/bleu/README.md: document new option and example.
  • tests/test_bleu_coco_tokenization.py: focused tests; skipped if pycocoevalcap not installed.

Backwards compatibility

  • Default tokenizer unchanged; no breaking API changes.

Notes

  • COCO/PTB mode matches the issue’s reported scores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Significant BLEU Score Gap Between evaluate and pycocoevalcap in Comma-Separated vs. Period-Separated Lists
1 participant