fnvls commited on
Commit
1831563
·
1 Parent(s): a919448

fix: create BLEUScore for each n-gram

Browse files
Files changed (1) hide show
  1. bleu_1234.py +9 -5
bleu_1234.py CHANGED
@@ -103,11 +103,15 @@ class bleu_1234(evaluate.Metric):
103
  if isinstance(references[0], str):
104
  references = [[ref] for ref in references]
105
 
106
- bleu = BLEUScore()
107
- bleu1 = bleu(predictions, references, n_gram=1)
108
- bleu2 = bleu(predictions, references, n_gram=2)
109
- bleu3 = bleu(predictions, references, n_gram=3)
110
- bleu4 = bleu(predictions, references, n_gram=4)
 
 
 
 
111
 
112
  output_dict = {
113
  "bleu-1": bleu1,
 
103
  if isinstance(references[0], str):
104
  references = [[ref] for ref in references]
105
 
106
+ bleu_score_1 = BLEUScore(n_gram=1)
107
+ bleu_score_2 = BLEUScore(n_gram=2)
108
+ bleu_score_3 = BLEUScore(n_gram=3)
109
+ bleu_score_4 = BLEUScore(n_gram=4)
110
+
111
+ bleu1 = bleu_score_1(predictions, references, n_gram=1)
112
+ bleu2 = bleu_score_2(predictions, references, n_gram=2)
113
+ bleu3 = bleu_score_3(predictions, references, n_gram=3)
114
+ bleu4 = bleu_score_4(predictions, references, n_gram=4)
115
 
116
  output_dict = {
117
  "bleu-1": bleu1,