Skip to content

Commit

Permalink
Initialize stemming method
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Nov 3, 2018
1 parent ed166ed commit 205a3a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions chatterbot/stemming.py
Expand Up @@ -16,6 +16,15 @@ def __init__(self, language='english'):
self.stopwords = nltk.corpus.stopwords.words(language)
self.stopwords.append('')

def initialize(self):
"""
Initialize the stemmer.
"""
from chatterbot.utils import nltk_download_corpus

nltk.download('stopwords')
# nltk_download_corpus('stopwords')

def stem(self, text):

if not text:
Expand Down
2 changes: 2 additions & 0 deletions chatterbot/storage/storage_adapter.py
Expand Up @@ -21,6 +21,8 @@ def __init__(self, base_query=None, *args, **kwargs):
'stemmer_language', 'english'
))

self.stemmer.initialize()

def get_model(self, model_name):
"""
Return the model class for a given model name.
Expand Down

0 comments on commit 205a3a8

Please sign in to comment.