文件名称:php的简单分词类库.zip
文件大小:8.18MB
文件格式:ZIP
更新时间:2022-07-31 04:19:32
类库下载-php的简单分词类库
<?php header("Content-Type:text/html; charset=utf-8"); define('APP_ROOT', str_replace('\\', '/', dirname(__FILE__))); function get_tags_arr($title) { require(APP_ROOT.'/pscws4.class.php'); $pscws = new PSCWS4(); $pscws->set_dict(APP_ROOT.'/scws/dict.utf8.xdb'); $pscws->set_rule(APP_ROOT.'/scws/rules.utf8.ini'); $pscws->set_ignore(true); $pscws->send_text($title); $words = $pscws->get_tops(5); $tags = array(); foreach ($words as $val) { $tags[] = $val['word']; } $pscws->close(); return $tags; } print_r(get_tags_arr($con)); function get_keywords_str($content){ require(APP_ROOT.'/phpanalysis.class.php'); PhpAnalysis::$loadInit = false; $pa = new PhpAnalysis('utf-8', 'utf-8', false); $pa->LoadDict(); $pa->SetSource($content); $pa->StartAnalysis( false ); $tags = $pa->GetFinallyResult(); return $tags; } print(get_keywords_str($con));不需要安装扩展,自带字典,使用方法简单采用很多人熟知的scws,另一个是IT柏拉图做的phpanalysis使用方法请参考index.php文件示例
【文件预览】:
php的简单分词类库
----xdb_r.class.php(4KB)
----php中文网下载站.url(114B)
----index.php(1KB)
----pscws4.class.php(31KB)
----scws()
--------rules.ini(4KB)
--------rules.utf8.ini(4KB)
--------dict.utf8.xdb(13.56MB)
----dict()
--------words_addons.dic(3KB)
--------base_dic_full.dic(8.05MB)
--------not-build()
--------readme.txt(579B)
----php中文网免费下载站.txt(219B)
----README.md(311B)
----phpanalysis.class.php(36KB)