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);
}