Fix wordsteam.py: Python 3 compatibility and polyglot HTTP 403 errors#63
Open
jalajthanaki wants to merge 1 commit intomasterfrom
Open
Fix wordsteam.py: Python 3 compatibility and polyglot HTTP 403 errors#63jalajthanaki wants to merge 1 commit intomasterfrom
jalajthanaki wants to merge 1 commit intomasterfrom
Conversation
- Fix Python 2 to 3 syntax: Update all print statements to use parentheses - Add polyglot_downloader_patch.py: Patch script to fix HTTP 403 errors - Add 3_1_wordsteam_nltk_only.py: NLTK-only alternative that works reliably - Add comprehensive FIXES_README.md: Detailed documentation of issues and solutions - Add Chapter_3_Installation_Commands_UPDATED.txt: Updated installation guide The original script had two main issues: 1. Python 2 print syntax incompatible with Python 3 2. Polyglot library HTTP 403 errors when downloading morpheme models Solutions provided: - Fixed original script with Python 3 syntax - Created patch for polyglot downloader (adds User-Agent headers) - Created NLTK-only alternative (recommended, no external dependencies) - Comprehensive documentation for troubleshooting The NLTK-only version is recommended as polyglot is deprecated (last updated 2016) and has unreliable server infrastructure. Co-Authored-By: jalajthanaki@gmail.com <jalajthanaki@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Fix wordsteam.py: Python 3 compatibility and polyglot HTTP 403 errors
Summary
This PR addresses two critical issues preventing Chapter 3's
wordsteam.pyscript from running:printstatements to use Python 3 parentheses syntaxThree solutions provided:
3_1_wordsteam.py): Python 3 compatible, but polyglot may still failpolyglot_downloader_patch.py): Adds User-Agent headers to help bypass server restrictions (may not fully resolve the issue)3_1_wordsteam_nltk_only.py): Recommended - Works reliably without polyglot dependencies, demonstrates Porter, Lancaster, and Snowball stemmersReview & Testing Checklist for Human
3_1_wordsteam.pyare complete (all print statements updated correctly)3_1_wordsteam_nltk_only.py) - This is the recommended solution and should work out of the box with justpip install nltkFIXES_README.md- Is it clear which solution users should choose? Does it adequately explain the polyglot issues?polyglot_downloader_patch.py) - It modifies an external library file. Consider whether this approach is appropriate or if we should just recommend the NLTK alternativeTest Plan
Notes
Known limitations:
Why the NLTK-only solution is recommended:
Session Info: