cjieba(結巴分詞ライブラリ)を用いてphp拡張中国語分詞を実現


コンパイルインストール
git clone https://github.com/jonnywang/jz.git
cd jz/cjieba
make
cd ..
phpize
./configure --enable-jieba
make
make install

php.iniの構成
extension=jz.so 
jz.enable_jieba=1
jz.dict_path=/Users/xingqiba/data/softs/jz/cjieba/dict    #  jz dict  

使用

効果
Array
(
    [0] =>   
    [1] =>   
    [2] =>   
    [3] =>  
    [4] =>   
    [5] =>   
    [6] =>   
    [7] =>    
    [8] =>      
    [9] =>   
    [10] =>    
    [11] => ,
    [12] =>  
    [13] =>  
    [14] =>   
    [15] =>   
    [16] =>   
    [17] =>       
    [18] =>   
)

Array
(
    [0] =>    
    [1] =>   
    [2] =>     
    [3] =>   
    [4] =>   
    [5] =>      
)

私達の専属QQ討論グループに参加することを歓迎します①233415606②233415756