5.1 提交后分词方法:模型字段里,完成分词 把这个函数复制到e/class/userfun.php里,然后系统的模型函数里填写 user_getKeywords_by_xunso // 提取关键字($mid,$isadd,$isq,$classid,$id,$cs) 模型函数 function user_getKeywords_by_xunso($mid,$isadd,$isq,$classid,$id,$cs){ global $empire,$dbtbpre,$class_r; $tbname=$class_r[$classid]['tbname']; $r=$empire->fetch1("select title,keyboard from {$dbtbpre}ecms_{$tbname} where id='$id' limit 1"); if($r['keyboard'])return ''; $hz=$r['title']; require_once(ECMS_PATH.'e/jhc/xunso/php/lib/XS.php'); $xunso_config=require(ECMS_PATH.'e/jhc/xunso/config.php'); $xs = new XS($xunso_config['project_name']); $tokenizer = new XSTokenizerScws; // 直接创建实例 $words = $tokenizer->getTops($hz,15); $tags = array(); foreach ($words as $val) { $tags[] = $val['word']; } $keyboard=implode(',',$tags); if($keyboard){ $empire->query("update {$dbtbpre}ecms_{$tbname} set keyboard='{$keyboard}' where id='$id' limit 1"); } return ''; } 5.2 提交前分词: 系统,数据表,管理字段,任意一个字段,字段代码里添加 <script type="text/javascript" src="/e/jhc/xunso/fenci/kw.js"></script> 5.3 采集的时候,建议用5.1
|