Closing out several small problems#6
Open
stucka wants to merge 5 commits into
Open
Conversation
| except: | ||
| text = sys.stdin.read() | ||
| for haiku in HaikuFinder(text.decode('utf-8')).find_haikus(): | ||
| for haiku in HaikuFinder(unicode(text, errors='replace')).find_haikus(): |
Owner
There was a problem hiding this comment.
This is incorrect, as it treats the input as ASCII, and throws away many legitimate utf-8 encoded characters. Try
unicode(text, encoding='utf-8', errors='replace')
Owner
|
Thank you! I've made several comments in context. |
crccheck
reviewed
Nov 5, 2016
| Installation requires NLTK and its punkt package. First-time steps | ||
| Unzip main file. | ||
| pip install nltk | ||
| python |
There was a problem hiding this comment.
you can combine these ntlk steps as:
python -m nltk.downloader punkt
I'm still investigating the right way to do this in setup.py.
crccheck
reviewed
Nov 5, 2016
| for line in p.readlines(): | ||
| if not len(line): | ||
| continue | ||
| if not len(line): |
There was a problem hiding this comment.
OMG yes thank you for this. These tabs kept the code from running in Python 3.
But while you're in here, I think it's more Pythonic to just do if not line: instead of checking against len(line)
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.
Closes out #4 -- Documentation doesn't say how to actually get NLTK working, or how to actually install this.
Fixes a typo in the readme, also suggests the github repo as a download site.
Fixes simple problem in #3 -- white spaces in init.py caused Python 3.5 to barf on installation.
Last, fixes two simple problems with the sample script. Unicode patch attempt by @jdf was still causing errors on occasion; my solution worked on the troublesome file.
Also, sample script should have a .py extension on it. Other than the one line changed above, the new findhaikus.py is identical to the old findhaikus.
Finally, patches setup.py to account for new findhaikus.py filename.