赞
踩
jieba导入自定义词库,特殊字符不分割,识别词性_jieba自定义词库_yuan86_12的博客-CSDN博客
将词典存入userdict.txt文件中。词与词性用空格分割。
- jieba.load_userdict("userdict.txt")
-
- import jieba
- import jieba.posseg as pseg
-
- jieba.load_userdict("userdict.txt")
- prompt = (
- "北京今天天气这么样"
- )
- seg_list = pseg.cut(prompt,use_paddle=True)
- for word, flag in seg_list:
- print('%s %s' % (word, flag))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。