Skip to content
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

corpus_bleu() got an unexpected keyword argument 'emulate_multibleu' #19

Closed
norahsakal opened this issue Oct 31, 2018 · 4 comments
Closed

Comments

@norahsakal
Copy link

'emulate_multibleu' seems to be deprecated according to Removed emulate_multibleu and backoff params
Do you have any suggestions for achieving the same performance? Have you tried using 'smoothing_function' which seems to be a replacement for 'emulate_multibleu'?

Huge thanks for an amazing repository!

@sgrvinod
Copy link
Owner

sgrvinod commented Nov 3, 2018

Thank you!

Thanks for the heads-up, I'm probably using an older version. From a cursory look, it appears what was previously emulate_multibleu=True is now the default? I'll check and confirm.

I vaguely remember I tried the smoothing functions but maybe I wasn't too sure that they were needed. I ended up just setting the emulate_multibleu flag to True because I wanted to emulate the behaviour of multi-bleu.perl as it's widely used.

@jason718
Copy link
Contributor

jason718 commented Dec 30, 2018

I think they make it default here: nltk/nltk@764dc8f

and comment:
nltk/nltk#1844 (comment)

@sgrvinod
Copy link
Owner

sgrvinod commented Jan 2, 2019

Merged, thanks.

@sgrvinod sgrvinod closed this as completed Jan 2, 2019
@kmario23
Copy link
Contributor

kmario23 commented Nov 13, 2019

Just to link to the current signature from the official docs: nltk.translate.bleu_score.corpus_bleu

Below is a contrived example borrowed from the docs:

>>> from nltk.translate.bleu_score import corpus_bleu

>>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',
...         'ensures', 'that', 'the', 'military', 'always',
...         'obeys', 'the', 'commands', 'of', 'the', 'party']
>>> ref1a = ['It', 'is', 'a', 'guide', 'to', 'action', 'that',
...          'ensures', 'that', 'the', 'military', 'will', 'forever',
...          'heed', 'Party', 'commands']
>>> ref1b = ['It', 'is', 'the', 'guiding', 'principle', 'which',
...          'guarantees', 'the', 'military', 'forces', 'always',
...          'being', 'under', 'the', 'command', 'of', 'the', 'Party']
>>> ref1c = ['It', 'is', 'the', 'practical', 'guide', 'for', 'the',
...          'army', 'always', 'to', 'heed', 'the', 'directions',
...          'of', 'the', 'party']

>>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',
...         'interested', 'in', 'world', 'history']
>>> ref2a = ['he', 'was', 'interested', 'in', 'world', 'history',
...          'because', 'he', 'read', 'the', 'book']

 >>> list_of_references = [[ref1a, ref1b, ref1c], [ref2a]]
 >>> hypotheses = [hyp1, hyp2]
 >>> corpus_bleu(list_of_references, hypotheses)

So, as we can see from this call, the emulate_multibleu kwarg is no longer supported. Hence, removing this will fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants