...ps); $i++) { if ($tmps[$i] === '' || strpos($tmps[$i], ':') !== false) { continue; } $ret[] = $tmps[$i]; } if ($query === '') { $this->_terms = $ret; } } return $convert ? XS::convert($ret, $this->_charset, 'UTF-8'...
...his->_query); } if (empty($query) || strpos($query, ':') !== false) { return $ret; } $buf = XS::convert($query, 'UTF-8', $this->_charset); $cmd = array('cmd' => XS_CMD_QUERY_GET_CORRECTED, 'buf' => $buf); $res = $this->execCommand($cmd, XS_CMD_OK_...
...function getwords($string='第一个新增词', $ignore = true, $duality = false, $multi = 3) { this -> cws -> addDict('/res/category/dict_1.txt',SCWS_XDICT_TXT); var_dump($this -> cws ->hasWord("新增词","n")); $this -> cws -> setduality($duality); $this -> cws -> setignore($ignore); $this ...
..._result() 方法取回一系列分好的词 // 直到 get_result() 返回 false 为止 // 返回的词是一个关联数组, 包含: word 词本身, idf 逆词率(重), off 在text中的偏移, len 长度, attr 词性 // $text = "中国航天官员应邀到美国与太空总署官员开会"; $p...
...Query($this->_query); } if (empty($query) || strpos($query, ':') !== false) { return $ret; } // Search the log database $op = $this->_defaultOp; $this->xs->setScheme(XSFieldScheme::logger()); try { $result = $this->setDb(self::LOG_DB)->setFuzzy()->setLimit($limit +...
...null){ if (!is_int($mode)) { $mode = stripos($fpath, '.txt') !== false ? SCWS_XDICT_TXT : SCWS_XDICT_XDB; } if (!isset($this->_setting['add_dict'])) { $this->_setting['add_dict'] = array(); } $this->_setting['add_dict'][] = new XSCommand(XS_CMD_SEARCH_SCWS_SET, XS_CMD_SC...
...tf8,则需要修改该程序的第一行,把 define('IS_UTF8_TXT', false); 改为 true php make_xdb_file.php [导入的文本文件] --- 关于文本文件的说明,每行一条记录,#开头表示注释,每条记录由 word、TF、IDF、Attr组成,其中TF是词频系...
...e = substr($pname, 1); if (($pos = strpos($pname, '=')) !== false) { $value = substr($pname, $pos + 1); $pname = substr($pname, 0, $pos); } } elseif (strlen($pname) > 1) { for ($j = 1; $j < strlen($params[$...
...ass.php 文件最后一个函数。 public function process($data, $cs=false) { //echo "\n----- DEBUG DATA INFO -----\n"; //print_r(str_replace('--', '', $data['content'])); $data['content']=str_replace("", '', $data['content']); $data['content']=str_replace("", '', $data['co...
... 2 400 在项目中,写入了 setSort('prod_price', false) 对其进行排序,接着再写入 setCollapse('cate_id') 进行折叠 按道理来说是得到如下结果 id cate_id prod_price 2 2 300 1 1 100 但是...