en文档可能标注错了,从PHP或CLI的帮助复制过来的,因为那边在使用时对 1~15 的值进行了左移12bit~ 所以C函数的说明不应当是1|2|4|8 而是宏定义中的 #define SCWS_MULTI_SHORT 0x01000 #define SCWS_MULTI_DUALITY 0x02000 #define SCWS_MULTI_ZMAIN 0x04000 #def...
$cws = scws_new(); $cws->set_charset('utf8'); $cws->set_rule('D:/Program Files/scws/etc/rules.utf8.ini'); //注意路径 $cws->set_dict('D:/Program Files/scws/etc/dict.utf8.xdb'); $cws->add_dict(ROOT_PATH."inc/spider/dict_extra.txt", SCWS_XDICT_TXT);//新增词库 $cws->set_ignore(tru...
...SCWS-1.1.3 PHP是5.16的会有影响吗? $cws = scws_new(); $cws->set_charset('gbk'); $cws->set_rule('/usr/local/scws/etc/rules.ini'); $cws->set_dict('/usr/local/scws/etc/dict.xdb'); $cws->send_text('我爱看电影,不知道电影院里有什么?'); 分词的结果竟是:“我 ...
...看到了 scws服务已经有了。 在运行时加了 scws.default.charset (default = gbk) , Changeable = PHP_INI_ALL scws.default.fpath (default = NULL) , Changeable = PHP_INI_ALL 这两句之后就会有下面的错误。 Parse error: syntax error, unexpected T_DEFAULT in D:\DedeAMPZ\WebRoo...
...发斯蒂芬罗铭罗大大罗' $cws = scws_new(); $cws->set_charset('utf8'); $cws->add_dict(XDB_PATH);//系统默认词库文件地址(xdb格式)[/quote] //$cws->add_dict(XDICT_PATH, SCWS_XDICT_TXT);//我的自定义词库地址 (txt格式) $cws-...
[code] use Text::Scws; my $scws = Text::Scws->new; $scws->set_dict('dict.xdb'); $scws->set_rule('rule.ini'); $scws->set_ignore(1); $scws->set_multi(1); my $s = shift; $scws->send_text($s); while (my $r = $scws->get_result()) { foreach (@$r) { print $_->{word}, " "; } } ...
... printf("error, can't init the scws_t!\n"); exit(-1); } scws_set_charset(s, "gbk"); scws_set_dict(s, "/usr/local/scws/etc/dict.xdb", SCWS_XDICT_XDB); scws_set_rule(s, "/usr/local/scws/etc/rules.ini"); scws_send_text(s, text, strlen(text)); while (res = cur = scws_get_resu...
应该是分词词典没有正确加载。 如果你在php.ini中没有正确指定路径的话scws.default.fpath以及字符集 scws.default.charset 你应该在分词代码中明确指定这些 $s->add_dict(); 或 $scws->set_dict(); 还有 $scws->set_charset() 应该在此之前调用
...文及中英文混合分词都无效。 譬如: $so = scws_new(); $so->set_charset('utf8'); $so->set_dict('words.txt',SCWS_XDICT_TXT); $so->set_ignore(true); $so->send_text("GMhello指导员"); echo ''; while ($tmp = $so->get_result()) { var_dump($tmp); } $so->close(); 在words.txt只定义如...