Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use HanLP to calculate the semantic similarity of Chinese words

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report