--- a/src/pyams_catalog/nltk.py Thu Mar 19 15:18:24 2015 +0100
+++ b/src/pyams_catalog/nltk.py Wed Apr 15 14:32:28 2015 +0200
@@ -20,6 +20,7 @@
# import packages
import nltk
+from pyams_i18n.language import BASE_LANGUAGES
from pyams_utils.unicode import translate_string
from zope.interface import implementer
@@ -29,6 +30,8 @@
"""NLTK based text processor using stemmer"""
def __init__(self, language='english'):
+ if language in BASE_LANGUAGES:
+ language = BASE_LANGUAGES[language].lower()
self.language = language
self.stemmer = nltk.stem.SnowballStemmer(language, ignore_stopwords=True)
@@ -58,6 +61,8 @@
"""NLTK based full text processor"""
def __init__(self, language='english'):
+ if language in BASE_LANGUAGES:
+ language = BASE_LANGUAGES[language].lower()
self.language = language
def process(self, lst):