Fix polyglot HTTP 403 error in wordsteam.py - Replace with NLTK stemmers #62
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.
Fix polyglot HTTP 403 error in wordsteam.py - Replace with NLTK stemmers
Summary
This PR fixes the critical issue where
3_1_wordsteam.pyfails withHTTP Error 403: Forbiddenwhen attempting to use the polyglot library. The polyglot data server (polyglot.cs.stonybrook.edu) is permanently down, making the library unusable.Changes made:
polyglot_stem()function withalternative_stemmers()using NLTK's SnowballStemmer and LancasterStemmerResult: The script now runs successfully without errors and provides enhanced educational value by comparing multiple stemming algorithms.
Review & Testing Checklist for Human
python3 ch3/3_1_wordsteam.pyto verify it works correctly and produces meaningful outputTest Plan:
Notes
Important semantic difference: This PR replaces polyglot's morpheme analysis with NLTK stemming. While related, stemming is a simpler operation than morphological decomposition. However, given that polyglot is permanently broken (server down since ~2018), this is the best available alternative that maintains the educational objectives of understanding word structure.
The documentation files provide migration guidance for users who have existing polyglot code and explain why this change was necessary.
Link to Devin run: https://app.devin.ai/sessions/5b232592eb644fcba8d24c926d47500a
Requested by: jalajthanaki@gmail.com (@jalajthanaki)