2016-11-22 2 views
0

Я обновляю свои временные слова для новой версии stop-words2014.5.26, потому что я хочу использовать арабские стоп-слова. Я работаю в Анаконде. после того, как я скачал и установил стоп-слова, появилось следующее сообщение об ошибке:stop_words для новой версии 2014.5.26

from stop_words import get_stop_words 
stop=set(get_stop_words('english')) 
<ipython-input-15-47cdc7fed487> in <module>() 

Эта линия

stop=set(get_stop_words('english')) 

выдает эту ошибку:

C:\Anaconda3\lib\site-packages\stop_words-2014.5.26-py3.5.egg\stop_words\__init__.py 
in get_stop_words(language) 
    21  with open('{0}{1}.txt'.format(STOP_WORDS_DIR, language)) as lang_file: 
    22   lines = lang_file.readlines() 
---> 23   return [str(line.strip()).decode('utf-8') for line in lines] 

C:\Anaconda3\lib\site-packages\stop_words-2014.5.26-py3.5.egg\stop_words\__init__.py 
in <listcomp>(.0) 
    21  with open('{0}{1}.txt'.format(STOP_WORDS_DIR, language)) as lang_file: 
    22   lines = lang_file.readlines() 
---> 23   return [str(line.strip()).decode('utf-8') for line in lines] 

AttributeError: 'str' object has no attribute 'decode' 
+0

Python 2 или Python 3? –

ответ

0

Я обновить стоп слова версию нового один 2015 год, то все работает

from nltk.corpus import stopwords 
stop = set(stopwords.words('arabic')) 
stop 
{'،', 

'أ', 'ا', 'اثر', 'اجل', 'احد', 'اخرى',