-
Notifications
You must be signed in to change notification settings - Fork 171
Sentence CHRF silently accepts single reference as string #121
Copy link
Copy link
Closed
Milestone
Description
Hi Matt, all
While trying to debug an issue related to sentence-level CHRF, I noticed that the compat function sentence_chrf expects a list of references as input, but happily accepts a single string (a list of characters). But then only uses the first character as the reference:
>>> from sacrebleu import sentence_chrf
>>> sentence_chrf("hi there", "hi there")
chrF2 = 0.455
>>> sentence_chrf("hi there", "h")
chrF2 = 0.455
While the sentence_score function for BLEU intercepts strings instead of lists of strings:
sacrebleu/sacrebleu/metrics/bleu.py
Line 227 in 65747b6
| assert not isinstance(references, str), "sentence_score needs a list of references, not a single string" |
the one for CHRF does not:
sacrebleu/sacrebleu/metrics/chrf.py
Line 125 in 65747b6
| def sentence_score(self, hypothesis: str, references: List[str]) -> CHRFScore: |
Could this perhaps be changed / standardized for all metrics?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels