https://github.com/jonnywang/...php
array jieba(string $text, bool use_extract = false, long extract_limit = 10)
git clone https://github.com/jonnywang/phpjieba.git cd phpjieba/cjieba make cd .. phpize ./configure make make install
jieba more detail please visit https://github.com/yanyiwu/cp...git
extension=jieba.so jieba.enable=1 jieba.dict_path=/Users/xingqiba/data/softs/jz/cjieba/dict #指向jieba庫dict目錄
$result = jieba('小明碩士畢業於中國科學院計算所,後在日本京都大學深造'); echo implode('/', $result) . PHP_EOL; //小明/碩士/畢業/於/中國/科學/學院/科學院/中國科學院/計算/計算所/,/後/在/日本/京都/大學/京都大學/深造 $result = jieba('小明碩士畢業於中國科學院計算所,後在日本京都大學深造', true, 6); echo implode('/', $result) . PHP_EOL; //計算所/小明/京都大學/深造/碩士/中國科學院 $result = jieba('他心理健康'); echo implode('/', $result) . PHP_EOL; //他/心理/健康/心理健康 $result = jieba('this is a demo, my name is jony', true, 10); echo implode('/', $result) . PHP_EOL; //demo/jony $result = jieba('this is a demo, my name is jony'); echo implode('/', $result) . PHP_EOL; //this/ /is/ /a/ /demo/,/ /my/ /name/ /is/ /jony
歡迎您加入咱們的專屬QQ討論羣組① 233415606 ② 233415756github