2016-11-22 5 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

パイソン2やPython 3? –

答えて

0

私は新しいにストップワードのバージョンを更新します2015年1つ、その後すべてが動作しています

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

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

関連する問題