ik添加分词器

在ik满足不了自己的分词需求时可以添加自己的分词器

在ik的config中有一个xml配置文件


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
	<comment>IK Analyzer 扩展配置</comment>
	<!--用户可以在这里配置自己的扩展字典 -->
	<entry key="ext_dict"></entry> //在这个标签中添加就行 
	//比如<entry key="ext_dict">xxx.dic</entry>
	 <!--用户可以在这里配置自己的扩展停止词字典-->
	<entry key="ext_stopwords"></entry>
	<!--用户可以在这里配置远程扩展字典 -->
	<!-- <entry key="remote_ext_dict">words_location</entry> -->
	<!--用户可以在这里配置远程扩展停止词字典-->
	<!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

在外边创建一个dic结尾的文件,在里面输入自己想要录入的词汇
然后保存在上边这里引用就可以了

Guess you like

Origin blog.csdn.net/m0_48358308/article/details/114824542