Skip to content
Open
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
8 changes: 6 additions & 2 deletions goose/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ def __init__(self, language='en'):
# TODO replace 'x' with class
# to generate dynamic path for file to load
if not language in self._cached_stop_words:
path = os.path.join('text', 'stopwords-%s.txt' % language)
self._cached_stop_words[language] = set(FileHelper.loadResourceFile(path).splitlines())
try:
path = os.path.join('text', 'stopwords-%s.txt' % language)
self._cached_stop_words[language] = set(FileHelper.loadResourceFile(path).splitlines())
except Exception:
path = os.path.join('text', 'stopwords-en.txt')
self._cached_stop_words[language] = set(FileHelper.loadResourceFile(path).splitlines())
self.STOP_WORDS = self._cached_stop_words[language]

def remove_punctuation(self, content):
Expand Down