Repository navigation
Reuse installed NLTK data for METEOR and word length - #901
Open
snygginghani wants to merge 1 commit into
Open
snygginghani wants to merge 1 commit into
snygginghani wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
METEOR and word length currently call NLTK's downloader every time Evaluate loads the module, including when the required data is installed. A network failure can therefore disrupt local scoring.
Check local WordNet data and exercise the Punkt tokenizer first. Call the downloader only for an unavailable resource. Calling the tokenizer verifies availability with the installed NLTK version, including versions that require extracted Punkt files.
Validation
I preinstalled NLTK data from the official distribution and simulated an unavailable network by making
nltk.downloadraiseOSError. The unmodified setup called the downloader for both modules. With the patch, both modules loaded and scored actual text with zero downloader calls under NLTK 3.10.4.python -m pytest tests/test_nltk_data_loading.py -qpassed four cases covering installed and missing data for both modules. Black, isort, flake8 andgit diff --checkpassed. The noisy progress output addressed by #726 remains a separate concern when a download is actually needed.AI assistance was used to investigate and prepare the patch and tests.