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

Decode error AND Add catalan language to LANGUAGE_MAPPING #5

Merged
merged 3 commits into from
Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Available languages
-------------------

* Arabic
* Catalan
* Danish
* Dutch
* English
Expand Down
3 changes: 2 additions & 1 deletion stop_words/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

LANGUAGE_MAPPING = {
'ar': 'arabic',
'ca': 'catalan',
'da': 'danish',
'nl': 'dutch',
'en': 'english',
Expand Down Expand Up @@ -58,7 +59,7 @@ def get_stop_words(language):
try:
language_filename = '{0}{1}.txt'.format(STOP_WORDS_DIR, language)
with open(language_filename, 'rb') as language_file:
stop_words = [line.strip().decode('utf-8')
stop_words = [line.decode('utf-8').strip()
for line in language_file.readlines()]
except IOError:
raise StopWordError(
Expand Down