关于pscws4分词有关问题

PHP中文网
Release: 2016-06-13 11:21:05
Original
1217 people have browsed it

  关于pscws4分词问题
用pscws4分词,为什么只打印出里面的数字,中文直接不分词打印,网页编码是utf8

function get_tags_arr($title){
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'];
}
$pscws->close();
return $tags;
}
------------------------------------
$title=并遵守中华人民共和国有关法律法规,21343尊重网上道德;
$tags=get_tags_arr($title);
echo print_r($tags);

为什么只打印出里面的数字,中文直接不分词打印


------解决方案--------------------
$pscws->set_dict('scws/dict.utf8.xdb');
$pscws->set_rule('scws/rules.utf8.ini');
这两个文件名和路径对吗?

对于 php 5.3 及以后会有 Redefining already defined constructor 错误,打开错误提示后并不影响正常工作


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template