Skip to content

Closing out several small problems#6

Open
stucka wants to merge 5 commits into
jdf:masterfrom
stucka:master
Open

Closing out several small problems#6
stucka wants to merge 5 commits into
jdf:masterfrom
stucka:master

Conversation

@stucka

@stucka stucka commented Feb 21, 2016

Copy link
Copy Markdown

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.

Comment thread scripts/findhaikus.py
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():

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')

@jdf

jdf commented Feb 22, 2016

Copy link
Copy Markdown
Owner

Thank you! I've made several comments in context.

Comment thread README.txt
Installation requires NLTK and its punkt package. First-time steps
Unzip main file.
pip install nltk
python

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread haikufinder/__init__.py
for line in p.readlines():
if not len(line):
continue
if not len(line):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

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.

3 participants