Java RESTful API

Add the following dependency into the pom.xml file of your project.

<dependency>
  <groupId>com.hankcs.hanlp.restful</groupId>
  <artifactId>hanlp-restful</artifactId>
  <version>0.0.4</version>
</dependency>

Obtain an auth from any compatible service provider like our free service, then initiate a HanLPClient and call its parse interface.

HanLPClient client = new HanLPClient("https://hanlp.hankcs.com/api", null); // Replace null with your auth
System.out.println(client.parse("2021年HanLPv2.1为生产环境带来次世代最先进的多语种NLP技术。英首相与特朗普通电话讨论华为与苹果公司。"));

Refer to our testcases and data format for more details.