我想请教一个问题,就是我使用的是C版的scws库,函数scws_set_dict和scws_add_dict加载一个大小为58K的txt字典文件的时候出现了递归的堆栈溢出。但是我将该txt字典转换成xdb文件后再次调用,就不会出现该问题了? 但是如果资源使...
...。求过滤方案。 $sh = scws_open(); scws_set_charset($sh, 'utf8'); scws_set_dict($sh, './dict.txt', SCWS_XDICT_TXT); scws_set_rule($sh, './rules.ini');//文件内容为空 $cutword = $_POST['cutword']; scws_send_text($sh, $cutword); $rs = scws_get_tops($sh, 5); 另:我使用工具...
...e]-- [color=#DAA520]新增或变动的 API [/color]--[/size] 1. [libscws] scws_set_dict(scws_t s, const char *fpath, int mode); scws_add_dict(scws_t s, const char *fpath, int mode); scws_set_dict 为原有功能,scws_add_dict 是新增功能,2者功能相当接近,只是 scws_set_dict ...
...e]-- [color=#DAA520]新增或变动的 API [/color]--[/size] 1. [libscws] scws_set_dict(scws_t s, const char *fpath, int mode); scws_add_dict(scws_t s, const char *fpath, int mode); scws_set_dict 为原有功能,scws_add_dict 是新增功能,2者功能相当接近,只是 scws_set_dict ...
...用 scws_set_charset() $cws = scws_open(); scws_set_charset($cws, "gbk"); scws_set_dict($cws, "./etc/dict.xdb"); scws_add_dict($cws, "./etc/s.txt",SCWS_XDICT_TXT); scws_set_rule($cws, "./etc/rules.ini"); ---- 推荐采用类对像访问方式 $cws = scws_new("gbk"); $cws->set_dict('etc/dict.xdb');...
...到php同目录下或者调用/usr/local/scws/etc/下的词库,都得到scws_set_dict(): supplied argument is not a valid scws handler resource。这是我php设置寻址有问题,还是scws_set_dict()调词库需要什么权限或特定路径。 问题3的分词结果是: Array ( ...
...t_charset($sh, 'gbk'); //scws_add_dict($sh, 'dict.txt', SCWS_XDICT_TXT); scws_set_dict($sh, 'dict.txt', SCWS_XDICT_TXT); //scws_set_rule($sh, 'rules.ini'); $text = "我发现个文字‘再试一个’"; scws_send_text($sh, $text); $top = scws_get_tops($sh, 5); print_r($top); [/php] dict....
...hp_scws.c 2013-07-03 10:38:55.288772732 +0800 @@ -111,6 +111,7 @@ PHP_FE(scws_set_dict, NULL) PHP_FE(scws_set_rule, NULL) PHP_FE(scws_set_ignore, NULL) + PHP_FE(scws_use_rule, NULL) // shuying.lee adds it PHP_FE(scws_set_multi, NULL) PHP_FE(scws_set_duality, NULL) PHP_FE(scws_send_text,...
... 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"); for(i = 0; i < 1000000; i++){ scws_send_text(s, text, strlen(text)); while...
..._open(); scws_set_charset($so, 'gbk'); scws_set_rule($so, 'rules.ini'); scws_set_dict($so, 'a.txt', SCWS_XDICT_TXT); scws_send_text($so, $txt); $result = scws_get_tops($so, strlen($txt)); print_r($result); [/php] 第一次运行的结果:([color=#FF0000][b]正常[/b][/color]) Array ...