有用过php+SCWS的吗? 有有关问题,没实现分词,只是分字

WBOY
Lepaskan: 2016-06-13 12:20:01
asal
1166 orang telah melayarinya

有用过php+SCWS的吗? 有问题,没实现分词,只是分字。
有用过php+SCWS的吗? 有问题,没实现分词,只是分字。

phpinfo里已经有了

scws<br /><br />SCWS support	Enabled<br />SCWS Description	Simple Chinese Words Segmentation<br />PECL Module version	0.2.2<br />SCWS Library	1.2.2<br />SCWS BugReport	http://www.xunsearch.com/scws
Salin selepas log masuk

但是如下的代码
<br /><?<br />$str="考试前20分钟,凭准考证和身份证进入考场,对号入座,并将准考证、身份证放在桌面右上角";<br />$so = scws_new();<br />$so->send_text($str);<br />$temp=$so->get_result();<br />$so->close();<br />print_r($temp);<br />?><br />
Salin selepas log masuk

只能产生如下的结果
<br /><br />Array<br />(<br />    [0] => Array<br />        (<br />            [word] => 考<br />            [off] => 0<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [1] => Array<br />        (<br />            [word] => 试<br />            [off] => 3<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [2] => Array<br />        (<br />            [word] => 前<br />            [off] => 6<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [3] => Array<br />        (<br />            [word] => 20<br />            [off] => 9<br />            [len] => 2<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [4] => Array<br />        (<br />            [word] => 分<br />            [off] => 11<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [5] => Array<br />        (<br />            [word] => 钟<br />            [off] => 14<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [6] => Array<br />        (<br />            [word] => ,<br />            [off] => 17<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [7] => Array<br />        (<br />            [word] => 凭<br />            [off] => 20<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [8] => Array<br />        (<br />            [word] => 准<br />            [off] => 23<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [9] => Array<br />        (<br />            [word] => 考<br />            [off] => 26<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [10] => Array<br />        (<br />            [word] => 证<br />            [off] => 29<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [11] => Array<br />        (<br />            [word] => 和<br />            [off] => 32<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [12] => Array<br />        (<br />            [word] => 身<br />            [off] => 35<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [13] => Array<br />        (<br />            [word] => 份<br />            [off] => 38<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [14] => Array<br />        (<br />            [word] => 证<br />            [off] => 41<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [15] => Array<br />        (<br />            [word] => 进<br />            [off] => 44<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [16] => Array<br />        (<br />            [word] => 入<br />            [off] => 47<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [17] => Array<br />        (<br />            [word] => 考<br />            [off] => 50<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [18] => Array<br />        (<br />            [word] => 场<br />            [off] => 53<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [19] => Array<br />        (<br />            [word] => ,<br />            [off] => 56<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [20] => Array<br />        (<br />            [word] => 对<br />            [off] => 59<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [21] => Array<br />        (<br />            [word] => 号<br />            [off] => 62<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [22] => Array<br />        (<br />            [word] => 入<br />            [off] => 65<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [23] => Array<br />        (<br />            [word] => 座<br />            [off] => 68<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [24] => Array<br />        (<br />            [word] => ,<br />            [off] => 71<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [25] => Array<br />        (<br />            [word] => 并<br />            [off] => 74<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [26] => Array<br />        (<br />            [word] => 将<br />            [off] => 77<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [27] => Array<br />        (<br />            [word] => 准<br />            [off] => 80<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [28] => Array<br />        (<br />            [word] => 考<br />            [off] => 83<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [29] => Array<br />        (<br />            [word] => 证<br />            [off] => 86<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [30] => Array<br />        (<br />            [word] => 、<br />            [off] => 89<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [31] => Array<br />        (<br />            [word] => 身<br />            [off] => 92<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [32] => Array<br />        (<br />            [word] => 份<br />            [off] => 95<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [33] => Array<br />        (<br />            [word] => 证<br />            [off] => 98<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [34] => Array<br />        (<br />            [word] => 放<br />            [off] => 101<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [35] => Array<br />        (<br />            [word] => 在<br />            [off] => 104<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [36] => Array<br />        (<br />            [word] => 桌<br />            [off] => 107<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [37] => Array<br />        (<br />            [word] => 面<br />            [off] => 110<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [38] => Array<br />        (<br />            [word] => 右<br />            [off] => 113<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [39] => Array<br />        (<br />            [word] => 上<br />            [off] => 116<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />    [40] => Array<br />        (<br />            [word] => 角<br />            [off] => 119<br />            [len] => 3<br />            [idf] => 0<br />            [attr] => un<br />        )<br /><br />)<br /><br />
Salin selepas log masuk

我是按照官方的文档安装的。难道是还需要额外的配置吗?
------解决思路----------------------
字典路径没有配置好吧?
或者是字符集不对

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan