# NLTK: odd outputs from bleu_score

For machine translation purposes I use bleu score, which seems to be the validation mechanism of choice (used in the sutskever 2014 sequence-to-sequence).

The purpose is to get as high bleu as possible (between 0 to 1).

The following mumble gives an extraordinary high bleu score (0.77):

from nltk import bleu_score

reference = ['The moon is very bright']
hypothesis = ['Dee dd ss eee']
reference = [[r.split()] for r in reference]
hypothesis = [[h.split()] for h in hypothesis]

bleu_score.corpus_bleu(reference, hypothesis)


Why does the bleu score give such high accuracy for mumbling? Which other tools for validation could I use for machine translation?

Which other tools for validation could I use for machine translation?

NLTK's BLEU implementation has a few issues. One of the most commonly used BLEU implementation is the one provided with MOSES (documentation).

• Commenting for posterity: while this is true, the high BLEU score here was user error. (The other answer addresses this.) Following Franck's guidance by using the Moses implementation of BLEU (or the more recent SacreBLEU) would have made the user error obvious. – Arya McCarthy Apr 25 at 4:29

You are calling the score function incorrectly. This is the way you do it:

from nltk import bleu_score
references = ['The moon is very bright'.split()]
hypothesis = 'Dee dd ss eee'.split()
bleu_score.sentence_bleu(references, hypothesis)


It will print 0 as expected.