IK分詞器的使用


1.下載 根據自己的版本進行下載

https://github.com/medcl/elasticsearch-analysis-ik/releases

wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip

2.安裝 解壓到 當前elasticsearch的插件目錄

unzip elasticsearch-analysis-ik-6.2.2.zip -d ik

3.自定義分詞 IK分詞器的詞庫

vim /usr/local/elasticsearch/plugins/ik/config/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">/asdf/asdf/asdf/asdf.dtd</entry>
         <!--用戶可以在這里配置自己的擴展停止詞字典-->
        <entry key="ext_stopwords"></entry>
        <!--用戶可以在這里配置遠程擴展字典 -->
        <entry key="remote_ext_dict">http://192.168.65.131/remote.php</entry>
        <!--用戶可以在這里配置遠程擴展停止詞字典-->
        <!-- <entry key="remote_ext_stopwords">words_location</entry> -->
</properties>

4.創建遠程文件庫:[檢測時間的變動]

<?php
$dict=<<<DICT
逼格
DICT;
header('Last-Modified: Sun, 30 Apr 2017 14:19:15 GMT', true, 200);
//header('Last-Modified: '.gmdate('D, d M Y H:i:s', time()).' GMT', true, 200);
echo $dict;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM