jieba.cut和posseg.cut自定义词库特殊字符问题

python\Lib\site-packages\jieba\ init.py(#注释掉的是原文)

#re_han_default = re.compile(“([\u4E00-\u9FD5a-zA-Z0-9+#&._]+)”, re.U) 
re_han_default = re.compile(“(.+)”, re.U) 
#re_userdict = re.compile(‘^(.+?)( [0-9]+)?( [a-z]+)?$’, re.U) 
re_userdict = re.compile(‘^(.+?)(\u0040\u0040[0-9]+)?(\u0040\u0040[a-z]+)?$’, re.U) 
#word, freq = line.split(’ ‘)[:2] 
word, freq = line.split(‘\u0040\u0040’)[:2] 
#re_han_cut_all = re.compile(“([\u4E00-\u9FD5]+)”, re.U) 
re_han_cut_all = re.compile(“(.+)”, re.U)

python\Lib\site-packages\jieba\posseg\ init.py

#re_han_detail = re.compile("([\u4E00-\u9FD5]+)")
re_han_detail = re.compile("(.+)")
#re_han_internal = re.compile("([\u4E00-\u9FD5a-zA-Z0-9+#&\._]+)")
re_han_internal = re.compile("(.+)")

注:修改后自定义词典的格式应为word@@tag

你可能感兴趣的:(基础)