pyhanlp用户自定义词典添加实例说明
pyhanlp用户自定义词典添加实例说明 pyhanlp是python版封装的的HanLP,项目地址:https://github.com/hankcs/pyhanlp 经过测试,HanLP比nltk在中文分词和实体识别方面都更好用. 如何向pyhanlp添加自定义的词典?以python 2.7.9为例: 1.安装pyhanlp:pip install pyhanlp 2.在字典路径下添加自定义的词典:CustomDictionary主词典文本路径是data/dictionary/custom/CustomDictionary.txt,用户可以在此增加自己的词语(不推荐);也可以单独新建一个文本文件,通过配置文件;CustomDictionaryPath=data/dictionary/custom/CustomDictionary.txt; 我的词典.txt;来追加词典(推荐)。 具体绝对路径可用hanlp --version获取: #hanlp --version jar1.6.3:/usr/local/lib/python2.7/site-packages/pyhanlp/sta...
