<?php
/* ----------------------------------------------------------------------- *\
   亚普软件提取关键字Tag PHP插件 
   
   功能说明---
       提取Tag关键字
 
   变量说明---
	   [自定义参数一]         无特殊情况,此参数请直接在软件上修改
	   [自定义参数二]		    返回词频最高的关键词的数量
	   [自定义参数三]         关键字间分隔符
\* ----------------------------------------------------------------------- */
$text = '[自定义参数一]';
if (isset($_SERVER['argv'][1])) 
{
	$text = $_SERVER['argv'][1];
	if (strpos($text, "\n") === false && is_file($text)) $text = file_get_contents($text);
}
elseif (isset($_SERVER['QUERY_STRING']))
{
	$text = $_SERVER['QUERY_STRING'];
}
// 
require  '[亚普根目录]Plugin/etc/pscws4.class.php';
$cws = new PSCWS4('utf8');
$cws->set_dict('[亚普根目录]Plugin/etc/dict.xdb');
$cws->set_rule('[亚普根目录]Plugin/etc/rules.ini');
//$cws->set_multi(3);
//$cws->set_ignore(true);
//$cws->set_debug(true);
//$cws->set_duality(true);
$cws->send_text($text);
$arr = array();
$wordnum= [自定义参数二];
if($wordnum==0)
{
	$wordnum=5;
}
$arr  = $cws->get_tops($wordnum,'~n');
$lists = array();
foreach ($arr  as $tmp)
{
  $lists[]=$tmp['word'];
}
  $split='[自定义参数三]';
  if($split=='')
	{
	  $split=',';
	}
$ret=implode($split,$lists);
$cws->close();
return $ret;
?>

