Update metrics/bleu.py
Browse files- metrics/bleu.py +5 -4
metrics/bleu.py
CHANGED
@@ -21,10 +21,7 @@ def compute_bleu(
|
|
21 |
|
22 |
transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
|
23 |
|
24 |
-
bleu = BLEU(
|
25 |
-
output = bleu.corpus_score(
|
26 |
-
predictions,
|
27 |
-
transformed_references,
|
28 |
smooth_method=smooth_method,
|
29 |
smooth_value=smooth_value,
|
30 |
force=force,
|
@@ -32,6 +29,10 @@ def compute_bleu(
|
|
32 |
use_effective_order=use_effective_order,
|
33 |
**(dict(tokenize=tokenize) if tokenize else {}),
|
34 |
)
|
|
|
|
|
|
|
|
|
35 |
output_dict = {
|
36 |
"score": output.score,
|
37 |
**{f"counts-{i+1}": round(p, 4) for i, p in enumerate(output.counts)},
|
|
|
21 |
|
22 |
transformed_references = [[refs[i] for refs in references] for i in range(references_per_prediction)]
|
23 |
|
24 |
+
bleu = BLEU(
|
|
|
|
|
|
|
25 |
smooth_method=smooth_method,
|
26 |
smooth_value=smooth_value,
|
27 |
force=force,
|
|
|
29 |
use_effective_order=use_effective_order,
|
30 |
**(dict(tokenize=tokenize) if tokenize else {}),
|
31 |
)
|
32 |
+
output = bleu.corpus_score(
|
33 |
+
predictions,
|
34 |
+
transformed_references,
|
35 |
+
)
|
36 |
output_dict = {
|
37 |
"score": output.score,
|
38 |
**{f"counts-{i+1}": round(p, 4) for i, p in enumerate(output.counts)},
|