github地址:https://github.com/hankcs/HanLP/tree/1.x
导入依赖
<dependency>
<groupId>com.hankcs</groupId>
<artifactId>hanlp</artifactId>
<version>portable-1.8.2</version>
</dependency>
几个api调用示例
public class Test {
public static void main(String[] args) {
//中文繁体简体互换
System.out.println(HanLP.convertToTraditionalChinese("用笔记本电脑写程序"));
System.out.println(HanLP.convertToSimplifiedChinese("「以後等妳當上皇后,就能買士多啤梨慶祝了」"));
//提取关键词
String content = "程序员(英文Programmer)是从事程序开发、维护的专业人员。一般将程序员分为程序设计人员和程序编码人员,但两者的界限并不非常清楚,特别是在中国。软件从业人员分为初级程序员、高级程序员、系统分析员和项目经理四大类。";
List<String> keywordList = HanLP.extractKeyword(content, 10);
System.out.println(keywordList);
}
控制台打印