Spaces:
Running
Running
Update Space (evaluate main: 7bd80a1d)
Browse files
chrf.py
CHANGED
@@ -170,10 +170,11 @@ class ChrF(evaluate.Metric):
|
|
170 |
# if only one reference is provided make sure we still use list of lists
|
171 |
if isinstance(references[0], str):
|
172 |
references = [[ref] for ref in references]
|
173 |
-
|
174 |
references_per_prediction = len(references[0])
|
175 |
if any(len(refs) != references_per_prediction for refs in references):
|
176 |
-
raise ValueError(
|
|
|
|
|
177 |
transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
|
178 |
|
179 |
sb_chrf = CHRF(char_order, word_order, beta, lowercase, whitespace, eps_smoothing)
|
|
|
170 |
# if only one reference is provided make sure we still use list of lists
|
171 |
if isinstance(references[0], str):
|
172 |
references = [[ref] for ref in references]
|
|
|
173 |
references_per_prediction = len(references[0])
|
174 |
if any(len(refs) != references_per_prediction for refs in references):
|
175 |
+
raise ValueError(
|
176 |
+
"ChrF, as implemented by sacrebleu, requires the same number of references for each prediction"
|
177 |
+
)
|
178 |
transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
|
179 |
|
180 |
sb_chrf = CHRF(char_order, word_order, beta, lowercase, whitespace, eps_smoothing)
|