How to use HanLP to calculate the semantic similarity of Chinese words
Editor to share with you how to use HanLP to calculate the semantic similarity of Chinese words, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The Maven method is recommended for configuring HanLP in a java project
Add the following code to poem.xml
Com.hankcs hanlp portable-1.3.3
But in AndroidStudio, there is no Maven, so add the following code to the dependencies of build.gradle
Compile "com.hankcs:hanlp:portable-1.3.3" can also download jar package and data package, which can be manually configured using hanlp.properties
Enter file-> project structure in IntelliJ IDEA and add jar package in Libraries
Change the first line in hanlp.properties to point to the location of the data package
Put hanlp.properties in the out-> production-> name directory
Call HanLPimport com.hankcs.hanlp.dictionary.CoreSynonymDictionary
Only the above statement is needed to use HanLP
/ use hanlp to calculate the semantic distance double [] numarray = new definition [title _ list.size ()]; for (int I = 0; I < results.size (); iTunes +) {for (int j = 0; j < title_list.size (); jacks +) {numarray [j] + = CoreSynonymDictionary.similarity (results.get (I). Name (). ToString (), title_list.get (j). ToString ()) }} above are all the contents of the article "how to use HanLP to calculate the semantic similarity of Chinese words". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!