当前位置:网站首页>IK word splitter - easy to use
IK word splitter - easy to use
2022-04-22 08:06:00 【I forgot my nickname】
ik Word segmentation is : Effect display

Implementation steps
1. introduce maven rely on
<!--ik participle -->
<dependency>
<groupId>com.janeluo</groupId>
<artifactId>ikanalyzer</artifactId>
<version>2012_u6</version>
</dependency>
2.IK Word segmentation tools
import org.wltea.analyzer.core.IKSegmenter;
import org.wltea.analyzer.core.Lexeme;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
/**
* @PackageName: com.hrt.zxxc.sxy
* @ClassName: IKAnalyzerUtil
* @Description: TODO ik Word segmentation is
* @Author:
* @Date: 2019/11/11 8:50
* @Versoin: 1.0
**/
public class IKAnalyzerUtil {
public static List<String> cut(String msg) throws IOException {
StringReader sr=new StringReader(msg);
IKSegmenter ik=new IKSegmenter(sr, true);
Lexeme lex=null;
List<String> list=new ArrayList<>();
while((lex=ik.next())!=null){
list.add(lex.getLexemeText());
}
return list;
}
}
3. call
public List<String> getTitleList(String title) throws IOException {
return IKAnalyzerUtil.cut(title.trim());
}
4. Some configuration files
① IKAnalyzer.cfg.xml , Configure your own extended Dictionary
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer Extended configuration </comment>
<!-- Users can configure their own extended dictionary here -->
<entry key="ext_dict">local.dic;</entry>
<!-- Users can configure their own extended stop word dictionary here -->
<entry key="ext_stopwords">stop.dic;</entry>
</properties>
②local.dic
③stop.dic
版权声明
本文为[I forgot my nickname]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220628165524.html
边栏推荐
- MySql查询指定一行排序到第一行
- Web automation: 4.2 selenium how to switch iframe windows (3 methods)
- .Net5 Log4Net启动一段时间后记录日志到数据库中失败问题
- Comparison of the differences between ArrayList and LinkedList
- web自动化:8.1如何在浏览器发送js指令
- Import 3D model from web page - obj / MTL file
- Shiping information appeared at the China traditional Chinese medicine information conference to help build the data security system of the pharmaceutical industry
- Login interface - infiltrate you thousands of times
- web问题定位实战:1.列表数据修改无效
- Resolve MSSQL message 3989, level 16, status 1
猜你喜欢

Web课设----HIS系统

实验5 组件及事件处理

世平信息数据安全合规检测实践论文入选中文核心期刊

图解《工业互联网专项工作组2022年工作计划》

实验6 输入输出流

Focus on scientific and technological innovation 𞓜 Shiping information appears in the technology roadshow of science and innovation China - special session on information technology and security

Continue raspberry pie 4B + OLED: automatically display the IP address after startup

How to connect Kunlun on state │ G series screen with Siemens 300 domestic MPI adapter

web问题定位:F12,如何找到对应接口

js-继承
随机推荐
MySQL queries the attributes of all fields in the database
LDAP用户登录认证校验及查询
web自动化:8.2 selenium中如何发送js指令
Flash data model migration error
[Shiping information] solutions for confidentiality inspection and compliance control of recorded content
Implement data compliance and ensure data security
easyui的combobox实现三级查询
Shrio 学习笔记(二)
《数据安全产品指南》正式发布,世平信息多项产品收录其中
.Net5 Log4Net启动一段时间后记录日志到数据库中失败问题
postman中级:处理接口加解密 AES SM3 SM4
SuperSocket在.Net5中使用——WebSocket Server篇
JMeter performance indicator monitoring: CPU, memory, disk, network
web自动化:8.1如何在浏览器发送js指令
SuperSocket在.Net5中使用——概念篇
.net core CefSharp ChromiumWebBrowser中网站JS调用winfrom程序中C#方法
技术解惑 | PLC是如何执行中断?又是如何去应用的?
世平信息数据安全合规检测实践论文入选中文核心期刊
.net5 WebAPI中搭建WebSocket服务端
图解《工业互联网专项工作组2022年工作计划》