Skip to content

Commit 2ebfb1c

Browse files
author
Hamel Husain
authored
Merge pull request #3 from hamelsmu/hamelsmu-patch-1
Update seq2seq_utils.py
2 parents 8cc2c7d + 8d1cb31 commit 2ebfb1c

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)