When using the NLTK sentence_bleu
function in combination with SmoothingFunction
method 7, the max score is 1.1167470964180197
. This while the BLEU score is defined to be between 0
and 1
.
This score shows up for perfect matches with the reference. I'm using method 7 since I do not always have sentences of length 4, some may be lower. Using method 5 gives the same result. Other methods do give 1.0 as a perfect score.
It occurs when I use a single reference and candidate, for example:
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction
cc = SmoothingFunction()
reference = ['overofficious 98461 54363 39016 78223 52180']
candidate = 'overofficious 98461 54363 39016 78223 52180'
sentence_bleu(reference, candidate, smoothing_function=cc.method7)
This gives the score: 1.1167470964180197
Am I doing something wrong, is this expected behavior or is there a bug in the implementation of the smoothing function?