Skip to content

Commit 8d1cb31

Browse files
author
Hamel Husain
authored
Update seq2seq_utils.py
mistake in BLEU Score
1 parent 8cc2c7d commit 8d1cb31

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

notebooks/seq2seq_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,5 +421,9 @@ def evaluate_model(self, holdout_bodies, holdout_titles):
421421
predicted.append(self.pp_title.process_text([yhat])[0])
422422
# calculate BLEU score
423423
logging.warning('Calculating BLEU.')
424-
bleu = corpus_bleu(actual, predicted)
424+
425+
#must be careful with nltk api for corpus_bleu!,
426+
# expects List[List[List[str]]] for ground truth, if you forget you will get
427+
# errenous results!
428+
bleu = corpus_bleu([[a] for a in actual], predicted)
425429
return bleu

0 commit comments

Comments
 (0)