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

Prevent crash on BLEU if weights are np array #3205

Merged
merged 1 commit into from
Nov 9, 2023

Conversation

tomaarsen
Copy link
Member

Resolves #3204

Hello!

Pull Request overview

  • Prevent crash on BLEU if the weights are an np.array rather than a tuple or a list of tuples.

Details

As seen in #3204, this can result in a confusing error message. This PR should fix it by extending the caught error from just TypeError to others (like IndexError) as well.

I've also added a test case, which should have failed previously.

  • Tom Aarsen

@stevenbird stevenbird merged commit 5424961 into nltk:develop Nov 9, 2023
19 of 20 checks passed
@tomaarsen tomaarsen deleted the hotfix/corpus_np_weights branch November 9, 2023 08:52
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

Successfully merging this pull request may close these issues.

corpus_bleu function does not catch all the expections when calling weights[0][0]
2 participants