Closed ZJaume closed 4 years ago
BLEU of empty line is returning 1
>>> from bestbleu import compute_bleu
>>> compute_bleu("this is what you want", " ")
1.0
>>> import sacrebleu
>>> sacrebleu.corpus_bleu(['this is what you want'],[' ']).score
5.341087579952926
>>> sacrebleu.corpus_bleu(['this is what you want'],[['this is what you want']]).score
100.00000000000004
>>> compute_bleu("this is what you want", "this is what you want")
0.09092617426809149
I agree, compute_bleu
should return 0.0 for an empty input.
The snippets have errors, they should be:
compute_bleu(["this is what you want"], " ")
compute_bleu(["this is what you want"], "this is what you want")
sacrebleu.sentence_bleu(['this is what you want'],[' ']).score
sacrebleu.sentence_bleu(['this is what you want'],['this is what you want']).score
Should be fixed with ca58f555d5a669b0100a9da9fab1703bc96e76fa
Seems fixed to me
Hi,
I think there is something wrong with the bleu implementation bestbleu.py because it prefers empty hypothesis. For example having the sentence:
as source, and the reference:
and the nbest list as:
it chooses the empty sentence always. Maybe my teacher model is not so good and it is producing a lot of empty hypothesis and after bestbleu filtering I'm getting a lot of empty lines.
I tried using sacrebleu instead and the problem seems to disappear.
Also some fixes of sacrebleu #9