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

Bugfix for the wiki_reader #64

Merged
merged 1 commit into from
Mar 2, 2017

Conversation

oroszgy
Copy link
Contributor

@oroszgy oroszgy commented Mar 2, 2017

Bugfix for reading Wikipedia dumps

Description

Using wiki_reader.py for parsing the Hungarian wikipedia throws an error.

Motivation and Context

Parsing the Hungarian dump throws this error:

  File "./corpus-utils/wiki2txt.py", line 76, in <module>
    plac.call(main)
  File "/home/gorosz/miniconda3/envs/spacy-dev/lib/python2.7/site-packages/plac_core.py", line 328, in call
    cmd, result = parser.consume(arglist)
  File "/home/gorosz/miniconda3/envs/spacy-dev/lib/python2.7/site-packages/plac_core.py", line 207, in consume
    return cmd, self.func(*(args + varargs + extraopts), **kwargs)
  File "./corpus-utils/wiki2txt.py", line 66, in main
    for id, title, content in tqdm(reader):
  File "/home/gorosz/miniconda3/envs/spacy-dev/lib/python2.7/site-packages/tqdm/_tqdm.py", line 833, in __iter__
    for obj in iterable:
  File "/home/gorosz/miniconda3/envs/spacy-dev/lib/python2.7/site-packages/textacy/corpora/wiki_reader.py", line 158, in __iter__
    content = bytes_to_unicode(content, errors='ignore')
  File "/home/gorosz/miniconda3/envs/spacy-dev/lib/python2.7/site-packages/textacy/compat.py", line 17, in bytes_to_unicode
    return unicode_type(b, encoding=encoding, errors=errors)
TypeError: coercing to Unicode: need string or buffer, NoneType found

How Has This Been Tested?

Now it can parse the huwiki dump.

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.

@bdewilde
Copy link
Collaborator

bdewilde commented Mar 2, 2017

Hey @oroszgy , thanks a ton for the PR! Your changes look good to me. :shipit:

@bdewilde bdewilde merged commit dee86cb into chartbeat-labs:master Mar 2, 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.

2 participants