1.在data/dictionary/custom/路径下新建文件 myDict.txt.,添加新的单词,单词,词性,词频。并删除当前文件夹下的bin文件,
2.在hanlp配置文件中的CustomDictionaryPath后追加myDict.txt
3.工具类
public static List <String> getNewExtractKeyWord(String content,Integer size){ List<Term> res = HanLP.segment(content); TextRankKeyword textRankKeyword= new TextRankKeyword(); return textRankKeyword.getKeywords(res,size); }
转载于:https://www.cnblogs.com/Pluto-0609/p/10709362.html
相关资源:提取关键词(Java版)