fix python3 open stopwords file UnicodeDecodeError bug
This commit is contained in:
parent
a21fe86f86
commit
c41ee7397d
@ -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