...到上述目录中 词典系列:http://www.ftphp.com/scws/down/scws-dict-chs-gbk.tar.bz2 http://www.ftphp.com/scws/down/scws-dict-chs-utf8.tar.bz2 http://www.ftphp.com/scws/down/scws-dict-cht-utf8.tar.bz2 然后在php.ini最后加上了 [scws] ; ; 注意请检...
...x环境,自编译安装 比如顶置的例子我这里是这样的 ; dict_extra.txt 我是新增词 2.0 再试一个 1.0 1.0 @ ; 以下词为删除项 删除 1.0 1.0 ! scws -d /usr/local/scws/dict_extra.txt -c utf-8 我是新增词 我 是 新 增 ...
...arset('gbk'); $cws->set_rule('/usr/local/scws/etc/rules.ini'); $cws->set_dict('/usr/local/scws/etc/dict.xdb'); $cws->send_text('我爱看电影,不知道电影院里有什么?'); 分词的结果竟是:“我 爱 看 电 影 , 不 知 道 电 影 院 里 有 什 么 ? ” ...
...词', $ignore = true, $duality = false, $multi = 3) { this -> cws -> addDict('/res/category/dict_1.txt',SCWS_XDICT_TXT); var_dump($this -> cws ->hasWord("新增词","n")); $this -> cws -> setduality($duality); $this -> cws -> setignore($ignore); $this -> cws -> setmulti($multi); $re=$this -> ...
...{ require 'pscws4/pscws4.class.php'; $pscws = new PSCWS4(); $pscws->set_dict('scws/dict.utf8.xdb'); $pscws->set_rule('scws/rules.utf8.ini'); $pscws->set_ignore(true); $pscws->send_text($title); $words = $pscws->get_tops(10); $tags = array(); foreach ($words as $val) { $tags[] = $val['word'...
... $cws = new PSCWS4('utf8'); $cws -> set_charset('utf-8'); $cws->set_dict('dict.utf8.xdb'); $cws->set_rule('pscws4/etc/rules.utf8.ini'); $cws->send_text($title); $words = $cws->get_tops(10); $cws->close(); $tags = array(); foreach ($words as $val) { $tags[] = $val['word']; } ...
... printf("Usage : %s dict rule\n",argv[0]); return -1; } sc...
...ndle; bool close(void); bool set_charset(string charset) bool set_dict(string dict_path) bool set_rule(string rule_path) bool set_ignore(bool yes) bool set_multi(bool yes) bool send_text(string text) mixed get_result(void) mixed get_tops(void) string version(void) }; ...
感谢hightman的认真对待. 我也按照你说的.打印了 add_dict 的返回数值..发现.就算在异常的情况下. 加载字典的返回值是 true的.但 get_result() 却返回 false; 是否会关 nginx 或 php-fpm 有关呢 ?? 我环境 是 centos5 nginx php-fpm 的[/code] ...
... $pscws = new PSCWS4('utf-8'); $pscws->set_ignore('yes'); $pscws->set_dict('E:/scws/etc/dict.utf8.xdb'); $pscws->set_rule('E:/scws/etc/rules_cht.utf8.ini'); // 分词调用 send_text() 将待分词的字符串传入, 紧接着循环调用 get_result() 方法取回一系列分好的词 // ...