首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

PHP自动获取关键字有关问题

2013-06-19 
PHP自动获取关键字问题标题input typetext nametitle idtitle /内容:input typetext name

PHP自动获取关键字问题



标题<input type="text" name="title" id="title" />
内容:<input type="text" name="content" id="content" />
关键字:<input type="text" name="keywords" id="keywords" />

当keywords为空时,自动获取关键字。

各位大神,什么写?

新手求虐、、、



PHP 关键字 自动关键字
[解决办法]
比如

require 'pscws4.class.php';

$text = '这里是标题测试文档';

$cws = new PSCWS4('gbk');
$cws->set_dict('etc/dict.xdb');
$cws->set_rule('etc/rules.ini');
$cws->send_text($text);

echo "<xmp>Top words stats:\n\n";
$ret = array();
$ret = $cws->get_tops(10,'r,v,p');

echo "No.\tWord\t\tAttr\tTimes\tRank\n------------------------------------------------------\n";
$i = 1;
foreach ($ret as $tmp)
{
printf("%02d.\t%-16s\t%s\t%d\t%.2f\n", $i++, $tmp['word'], $tmp['attr'], $tmp['times'], $tmp['weight']);
}
$cws->close();
Top words stats:

No.WordAttrTimesRank
------------------------------------------------------
01.文档            n14.80
02.标题            n14.76
03.测试            vn14.72

热点排行