mirror of
https://github.com/fxsjy/jieba.git
synced 2025-07-10 00:01:33 +08:00
commit
37a179436f
@ -193,7 +193,7 @@ def cut(sentence,cut_all=False):
|
|||||||
if not isinstance(sentence, unicode):
|
if not isinstance(sentence, unicode):
|
||||||
try:
|
try:
|
||||||
sentence = sentence.decode('utf-8')
|
sentence = sentence.decode('utf-8')
|
||||||
except:
|
except UnicodeDecodeError:
|
||||||
sentence = sentence.decode('gbk','ignore')
|
sentence = sentence.decode('gbk','ignore')
|
||||||
re_han, re_skip = re.compile(ur"([\u4E00-\u9FA5a-zA-Z0-9+#&\._]+)"), re.compile(ur"(\s+)")
|
re_han, re_skip = re.compile(ur"([\u4E00-\u9FA5a-zA-Z0-9+#&\._]+)"), re.compile(ur"(\s+)")
|
||||||
if cut_all:
|
if cut_all:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user