修复stop words处理未考虑"\r"导致不能正常匹配的问题。

This commit is contained in:
walkskyer 2014-11-12 22:33:27 +08:00
parent 36bc9e18c6
commit 5571a0337a

View File

@ -54,7 +54,7 @@ def set_stop_words(stop_words_path):
if not os.path.exists(abs_path):
raise Exception("jieba: path does not exist: " + abs_path)
content = open(abs_path,'rb').read().decode('utf-8')
lines = content.split('\n')
lines = content.replace("\r", "").split('\n')
for line in lines:
STOP_WORDS.add(line)