New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZeroDivisionError when computing bleu_score #2204
Comments
@betterenvi thank you for raising the issue. Could you provide the hypothesis and reference(s) input that caused the zero division error? |
@alvations ZeroDivisionError also happens to me, here's an example of inputs:
|
It makes no sense to use method 4 smoothing ( see http://acl2014.org/acl2014/W14-33/pdf/W14-3346.pdf ) as it causes a Even if method 4 is patched to work around that and essentially do nothing, there are still issues with calculating BLUE due to |
I suspect this has been solved through #2839. Let us know if any normal uses of BLEU still throw unexpected exceptions! |
Python version: 3.5
NLTK version: 3.2.5
File "/usr/local/lib/python3.5/dist-packages/nltk/translate/bleu_score.py", line 89, in sentence_bleu emulate_multibleu) File "/usr/local/lib/python3.5/dist-packages/nltk/translate/bleu_score.py", line 199, in corpus_bleu hyp_len=hyp_len, emulate_multibleu=emulate_multibleu) File "/usr/local/lib/python3.5/dist-packages/nltk/translate/bleu_score.py", line 544, in method4 incvnt = i+1 * self.k / math.log(hyp_len) # Note that this K is different from the K from NIST. ZeroDivisionError: float division by zero
The text was updated successfully, but these errors were encountered: