mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
修复stop words处理未考虑"\r"导致不能正常匹配的问题。
This commit is contained in:
parent
36bc9e18c6
commit
5571a0337a
@ -54,7 +54,7 @@ def set_stop_words(stop_words_path):
|
|||||||
if not os.path.exists(abs_path):
|
if not os.path.exists(abs_path):
|
||||||
raise Exception("jieba: path does not exist: " + abs_path)
|
raise Exception("jieba: path does not exist: " + abs_path)
|
||||||
content = open(abs_path,'rb').read().decode('utf-8')
|
content = open(abs_path,'rb').read().decode('utf-8')
|
||||||
lines = content.split('\n')
|
lines = content.replace("\r", "").split('\n')
|
||||||
for line in lines:
|
for line in lines:
|
||||||
STOP_WORDS.add(line)
|
STOP_WORDS.add(line)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user