将附件中的IKAnalyzer.cfg.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">/mydict.dic;</entry>
-->
<!--用户可以在这里配置自己的扩展停止词字典
<entry key="ext_stopwords">/ext_stopword.dic</entry>
-->
</properties>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>IK Analyzer 扩展配置</comment>
<!--用户可以在这里配置自己的扩展字典
<entry key="ext_dict">/mydict.dic;</entry>
-->
<!--用户可以在这里配置自己的扩展停止词字典
<entry key="ext_stopwords">/ext_stopword.dic</entry>
-->
</properties>
扩展词典格式参考附件中ext_stopword.dic,
然后将配置文件,扩展词典放到classpath可以访问到的地方。
建议放在源代码根目录。