Merge pull request #13 from inuyasha2012/master
fix python3 open stopwords file UnicodeDecodeError bug
This commit is contained in:
commit
902fd83808
@ -104,7 +104,10 @@ def _load_stopwords(file_path):
|
||||
load stop words
|
||||
'''
|
||||
global _stopwords
|
||||
words = open(file_path, 'r')
|
||||
if sys.version_info[0] < 3:
|
||||
words = open(file_path, 'r')
|
||||
else:
|
||||
words = open(file_path, 'r', encoding='utf-8')
|
||||
stopwords = words.readlines()
|
||||
for w in stopwords:
|
||||
_stopwords.add(any2unicode(w).strip())
|
||||
|
Loading…
Reference in New Issue
Block a user