为coreseek添加mmseg分词

因为在工做中遇到了林书豪这个词,原来的分词库里面没有就找了下文档,本身整理了一份,以交流备忘。 spa

1.准备好须要添加的词表,通常都是每行一词,注意要保存为utf-8; 
    例如: 
    -- 
    林书豪
    -- 
2.利用UltraEdit的查找替换功能,使词表格式符合mmseg的要求; 
    例如: 
    打开UltraEdit的正则替换功能,将“^p”替换为“^t1^px:1^p” 
    结果是: 
    -- 
    林书豪[tab]1 
    x:1 
    --  索引

    其余的也行
3.将生成的符合格式要求的词表粘贴到原词表unigram.txt末尾,保存为unigram_new.txt,并拷贝到mmseg所在的目录下; 

4.生成新的uni utf-8

    /usr/local/mmseg3/bin/mmseg -u /usr/local/mmseg3/etc/unigram_new.txt 文档

    就会生成新的词典文件unigram_new.txt.uni 

5.将新的unigram_new.txt.uni 替换原有的uni.lib
    mv /usr/local/mmseg3/etc/unigram_new.txt.uni /usr/local/mmseg3/etc/uni.lib

6.从新创建索引库、重启searchd
     /usr/local/coreseek/bin/indexer -c /usr/local/coreseek/etc/c.conf --all --pidfile --rotate
    关闭searchd
      ps auxww | grep searchd
      kill 923230
    启动searchd
    /usr/local/coreseek/bin/searchd -c /usr/local/coreseek/etc/c.conf --console --pidfile  

    搜索试下就出来了。 get

注意:须要重启searchd 博客


小弟我的博客http://www.iczerd.com,欢迎交流,友链 it

相关文章
相关标签/搜索