/** * 取文本的分词 * $text 待分词的文本 * return 返回词汇数组, 每个词汇是包含 [off:词在文本中的位置,attr:词性,word:词] * */ public function xs_getResult($text) { if (!$this->settings['App_textsearch']) { return FALSE; } @(include_once ROOT_PATH . 'lib/class/textsearch.class.php'); if (class_exists('textsearch')) { $ts = new textsearch(); return $ts->get_Result($text); } }
public function xs_get_hotquery() { $count = intval($this->input['count']); @(include_once ROOT_PATH . 'lib/class/textsearch.class.php'); $ts = new textsearch(); $hot = $ts->xs_get_hotquery($count); if (is_array($hot) && $hot) { foreach ($hot as $k => $v) { $r = array('title' => $k, 'num' => $v); $this->addItem($r); } $this->output(); } }