Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update wikipedia.py #118

Merged
merged 3 commits into from Jul 25, 2017
Merged

Update wikipedia.py #118

merged 3 commits into from Jul 25, 2017

Conversation

Gregory-Howard
Copy link
Contributor

@Gregory-Howard Gregory-Howard commented Jul 6, 2017

see #109

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation, and I have updated it accordingly.

@Gregory-Howard Gregory-Howard mentioned this pull request Jul 6, 2017
5 tasks
@@ -198,7 +198,7 @@ def __iter__(self):

if compat.is_python2 is False:
events = ('end',)
f = fileio.open_sesame(self.filename, mode='rt')
f = fileio.open_sesame(self.path, mode='rt', encoding="UTF-8")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of self.path, this should be self.filename, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-4731d5f9560f> in <module>()
----> 1 for text in wp.texts(limit=5):
      2     print(text)

~/chartbeat/github/textacy/textacy/datasets/wikipedia.py in texts(self, min_len, limit)
    318         """
    319         n_pages = 0
--> 320         for _, title, content in self:
    321             text = strip_markup(content)
    322             if len(text) < min_len:

~/chartbeat/github/textacy/textacy/datasets/wikipedia.py in __iter__(self)
    199         if compat.is_python2 is False:
    200             events = ('end',)
--> 201             f = fileio.open_sesame(self.path, mode='rt', encoding="UTF-8")
    202         else:  # Python 2 can't open bzip in text mode :(
    203             events = (b'end',)

AttributeError: 'Wikipedia' object has no attribute 'path'

Correcting self.path in self.filename
@Gregory-Howard
Copy link
Contributor Author

Yes, sorry.
I don't even know where self.filename comes from. Probably a bad copy paste.

@bdewilde bdewilde merged commit 9e7b669 into chartbeat-labs:master Jul 25, 2017
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.

None yet

2 participants