本文整理汇总了PHP中SplitWord::SplitRMM方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::SplitRMM方法的具体用法?PHP SplitWord::SplitRMM怎么用?PHP SplitWord::SplitRMM使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplitWord
的用法示例。
在下文中一共展示了SplitWord::SplitRMM方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: splitWords
function splitWords($str, $style = 'array')
{
//字典文件太大,防止读取时服务器配置内存不够用
//@ini_set("memory_limit","30M");
require_once dirname(__FILE__) . "/utf8_splitword.php";
$sp = new SplitWord();
$result = $sp->SplitRMM($str);
$sp->Clear();
if ($style == 'string') {
return $result;
} else {
if ($style == 'array') {
return split(',', $result);
}
}
}
示例2: check
/**
*Ajax检测商机名称
*
**/
public function check()
{
import("@.ORG.SplitWord");
$sp = new SplitWord();
$m_business = M('Business');
$useless_words = array(L('COMPANY'), L('LIMITED'), L('DI'), L('LIMITED_COMPANY'));
if ($this->isAjax()) {
$split_result = $sp->SplitRMM($_POST['name']);
if (!is_utf8($split_result)) {
$split_result = iconv("GB2312//IGNORE", "UTF-8", $split_result);
}
$result_array = explode(' ', trim($split_result));
if (count($result_array) < 2) {
$this->ajaxReturn(0, '', 0);
die;
}
foreach ($result_array as $k => $v) {
if (in_array($v, $useless_words)) {
unset($result_array[$k]);
}
}
$name_list = $m_business->getField('name', true);
$seach_array = array();
foreach ($name_list as $k => $v) {
$search = 0;
foreach ($result_array as $k2 => $v2) {
if (strpos($v, $v2) > -1) {
$v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count);
$search += $count;
}
}
if ($search > 2) {
$seach_array[$k] = array('value' => $v, 'search' => $search);
}
}
$seach_sort_result = array_sort($seach_array, 'search', 'desc');
if (empty($seach_sort_result)) {
$this->ajaxReturn(0, L('ABLE_ADD'), 0);
} else {
$this->ajaxReturn($seach_sort_result, L('CUSTOMER_IS_CREATED'), 1);
}
}
}
示例3: usingRMM
function usingRMM($keyword)
{
$yuan = trim($keyword);
$yuan = iconv('UTF-8', 'GB2312', $yuan);
$tt = $yuan;
$str = gl($tt);
$sp = new SplitWord();
$tt = $sp->SplitRMM($str);
$cc = $tt;
if (substr($cc, 0, 3) == "、") {
$cc = substr($cc, 3);
}
if (substr($cc, -3, 3) == "、") {
$cc = substr($cc, 0, -3);
}
$newstr = explode("、", $cc);
if ($newstr[0] == "") {
return false;
}
for ($i = 0; $i < count($newstr); $i++) {
$newstr[$i] = iconv("gb2312", "UTF-8", $newstr[$i]);
}
return $newstr;
}
示例4: q
function q($wd, $domain = '')
{
global $db;
$this->db =& $db;
$this->wd = $wd;
if (empty($wd)) {
$sql = "select * from ve123_links where title<>'' order by updatetime desc";
} elseif (!empty($domain)) {
if ($domain == getdomain($domain)) {
$sql = "select * from ve123_links where title<>'' and url like '%." . $domain . "%' or url like '%//" . $domain . "%'";
//echo $sql;
} else {
$sql = "select * from ve123_links where title<>'' and url regexp 'http://" . $domain . "'";
//echo $sql;
}
} else {
$this->update_keywords();
require PATH . "include/splitword.func.php";
$sp = new SplitWord();
$wd_split = $sp->SplitRMM($wd);
$sp->Clear();
$this->wd_split = $wd_split = ereg_replace("[ ]{1,}", " ", trim($wd_split));
$this->wd_array = $wd_array = explode(" ", $wd_split);
$this->wd_count = $wd_count = count($wd_split);
//echo $wd_count;
$tgarray = $this->GetTg();
$tgarray_count = count($tgarray);
$ordersql = " order by (";
foreach ($wd_array as $value) {
$strlen = strlen($value);
if ($strlen > 2) {
$points = $strlen;
} else {
$points = 1;
}
$ordersql .= "(case when title like '%" . $value . "%' then " . $points . " else 0 end)+";
}
$ordersql .= "(case when title like '%" . $wd . "%' then 8 else 0 end)";
// $ordersql=rtrim($ordersql,"+");
$ordersql .= ") desc,updatetime desc";
$keywordsql = $this->GetKeywordSql("title,' ',url,' ',keywords,' ',fulltxt");
if (empty($keywordsql)) {
$keywordsql = "title like '%" . $wd . "%'";
}
$sql = "select * from ve123_links where title<>'' and " . $keywordsql . $ordersql;
//
//
}
//echo $sql;
$query = $db->query($sql);
$this->total = $total = $db->num_rows($query) + $tgarray_count;
$pagesize = 10;
$this->totalpage = $totalpage = ceil($total / $pagesize);
$p = intval($_GET["p"]);
if ($p <= 0) {
$p = 1;
}
$offset = ($p - 1) * $pagesize;
$query = $db->query($sql . " limit {$offset},{$pagesize}");
while ($row = $db->fetch_array($query)) {
$data["title"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["title"], 60)));
$data["txt"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["fulltxt"], 250)));
$data["description"] = $this->GetRedKeyWord(replace_filter_word(str_cut($row["description"], 250)));
$data["url"] = str_cut($row["url"], 50);
$data["updatetime"] = date("Y-m-d", $row["updatetime"]);
$data["pagesize"] = $row["pagesize"];
$data["link_id"] = $row["link_id"];
$data["tuiguang"] = $row["tuiguang"];
$array[] = $data;
}
$array_count = count($array);
if (empty($array_count)) {
$newarray = $tgarray;
} elseif ($p == 1 && $tgarray_count > 0) {
$newarray = array_merge($tgarray, $array);
} else {
$newarray = $array;
}
return $newarray;
}
示例5: stripslashes
$description = stripslashes(cn_substr(html2text($body),$cfg_auot_description));
$description = trim(preg_replace("/#p#|#e#/","",$description));
$description = addslashes($description);
}
//把内容中远程的图片资源本地化
//------------------------------------
if($cfg_isUrlOpen && $remote==1){
$body = GetCurContent($body);
}
//自动获取关键字
//----------------------------------
if($autokey==1){
require_once(DEDEADMIN."/../include/pub_splitword_www.php");
$keywords = "";
$sp = new SplitWord();
$titleindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM($title))));
$allindexs = explode(" ",trim($sp->GetIndexText($sp->SplitRMM(Html2Text($body)),200)));
if(is_array($allindexs) && is_array($titleindexs)){
foreach($titleindexs as $k){
if(strlen($keywords)>=50) break;
else $keywords .= $k." ";
}
foreach($allindexs as $k){
if(strlen($keywords)>=50) break;
else if(!in_array($k,$titleindexs)) $keywords .= $k." ";
}
}
$sp->Clear();
unset($sp);
$keywords = preg_replace("/#p#|#e#/","",$keywords);
$keywords = addslashes($keywords);
示例6: SplitWord
$_POST['summary'] = check::csubstr(trim(str_replace(" ", " ", str_replace("\r\n", "", strip_tags($_POST['intro'])))), 0, $arrGWeb['db_summary_len']);
}
if ($_POST['title'] != '') {
$_POST['title_md5'] = md5($_POST['title']);
}
if (is_array($_POST['photo'])) {
$_POST['thumbnail'] = $_POST['photo'][0]['photo'];
} else {
$_POST['thumbnail'] = $_POST['photo'];
}
$_POST['photo'] = array_values($_POST['photo']);
$_POST['video'] = array_values($_POST['video']);
#自动拆字生成tag
if (empty($_POST['tag'])) {
$objSP = new SplitWord();
$_POST['tag'] = $objSP->SplitRMM($_POST['title'], false);
}
$_POST = array_merge($arrInfo, $_POST);
$objWebInit->saveInfo($_POST, 1);
$objWebInit->updateCache($_POST['id'], $_POST['type_id'], $arrMOutput);
check::WindowLocation('index.php', 'page=' . $_GET['page']);
}
if (!is_array($arrMType) || empty($arrMType)) {
$arrMType = $objWebInit->getTypeList();
$arrMType = $objWebInit->formatTypeList(0, $arrMType);
}
// 输出到模板
$arrMOutput["template_file"] = "admin.html";
$arrMOutput["smarty_assign"]['FileCallPath'] = $objWebInit->arrGPic['FileCallPath'];
$arrMOutput["smarty_assign"]['FileListPicSize'] = $objWebInit->arrGPic['FileListPicSize'];
$arrMOutput["smarty_assign"]['arrData'] = $arrInfo;
示例7: array
$arrWhere = array();
$arrLink = array();
$arrWhere[] = "pass='1'";
$strLink = '';
if (!empty($_REQUEST['keywords'])) {
$strKeywords = strval(urldecode($_REQUEST['keywords']));
if ($strKeywords[0] == '/') {
//精确查询ID
$strKeywords = substr($strKeywords, 1);
if (is_numeric($strKeywords)) {
$arrWhere[] = "id = '" . $strKeywords . "'";
}
} else {
$strKeywords = strval(urldecode($_REQUEST['keywords']));
$objSP = new SplitWord();
$strok = $objSP->SplitRMM($strKeywords);
$arrKeywords = explode(' ', $strok);
foreach ($arrKeywords as $v) {
$v = trim($v);
if (!empty($v)) {
$arrWhere[] = "tag LIKE '%{$v}%'";
}
}
}
$arrLink[] = 'keywords=' . urlencode($strKeywords);
} else {
check::AlertExit("错误:关键词必须填写!", -1);
}
if (empty($_GET['page'])) {
$intPage = 1;
} else {
示例8: urldecode
$arraysi = $result->getRows($i_sqlstr, $conn);
$smarty->assign("video_type", $arraysi);
//获取更多相关视频
require "splitword.php";
//进行分词处理
require "common/function.php";
//过滤标点
if (isset($_GET["video_name"])) {
$keyword = urldecode($_GET['video_name']);
//获取内容
}
$yuan = trim($keyword);
$tt = $yuan;
$str = gl($tt);
$sp = new SplitWord();
$sp->SplitRMM($str);
$tt = $sp->SplitRMM($str);
//$sp->Clear();
$str = array(" ", "");
//定义一个数组
$cc = str_replace($str, "", $tt);
//去掉字符串中的空格
if (substr($cc, 0, 2) == "、") {
$cc = substr($cc, 2);
//去掉前面的“、”符号
}
if (substr($cc, -2, 2) == "、") {
$cc = substr($cc, 0, -2);
//去掉后面的“、”符号
}
if (substr($cc, 0, 2) == "、" && substr($cc, -2, 2) == "、") {
示例9: check
public function check()
{
import("@.ORG.SplitWord");
$sp = new SplitWord();
$m_leads = M('Leads');
$m_customer = M('Customer');
//ignore words
$useless_words = array(L('COMPANY'), L('LIMITED'), L('OF'), L('COMPANY_LIMITED'));
if ($this->isAjax()) {
$split_result = $sp->SplitRMM($_POST['name']);
if (!is_utf8($split_result)) {
$split_result = iconv("GB2312//IGNORE", "UTF-8", $split_result);
}
$result_array = explode(' ', trim($split_result));
if (count($result_array) < 2) {
$this->ajaxReturn(0, '', 0);
die;
}
foreach ($result_array as $k => $v) {
if (in_array($v, $useless_words)) {
unset($result_array[$k]);
}
}
$leads_commpany_list = $m_leads->getField('name', true);
$customer_commpany_list = $m_customer->getField('name', true);
$search_array = array();
foreach ($leads_commpany_list as $k => $v) {
$search = 0;
foreach ($result_array as $k2 => $v2) {
if (strpos($v, $v2) > -1) {
$v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count);
$search += $count;
}
}
if ($search > 2) {
$search_array[$k] = array('value' => $v, 'search' => $search);
}
}
$seach_sort_result['leads'] = array_sort($search_array, 'search', 'desc');
$customer_search_array = array();
foreach ($customer_commpany_list as $k => $v) {
$search = 0;
foreach ($result_array as $k2 => $v2) {
if (strpos($v, $v2) > -1) {
$v = str_replace("{$v2}", "<span style='color:red;'>{$v2}</span>", $v, $count);
$search += $count;
}
}
if ($search > 2) {
$customer_search_array[$k] = array('value' => $v, 'search' => $search);
}
}
$seach_sort_result['customer'] = array_sort($customer_search_array, 'search', 'desc');
$leads_search = $seach_sort_result['leads'];
$customer_search = $seach_sort_result['customer'];
if (empty($leads_search) && empty($customer_search)) {
$this->ajaxReturn(0, L('YOU_CAN_ADD'), 0);
} else {
$this->ajaxReturn($seach_sort_result, L('EXIST_SAME_LEADS_OR_COMPANY'), 1);
}
}
}
示例10: GetKeywords
function GetKeywords($keyword){
$keyword = cn_substr($keyword,50);
$row = $this->dsql->GetOne("Select spwords From #@__search_keywords where keyword='".addslashes($keyword)."'; ");
if(!is_array($row)){
if(strlen($keyword) > 16){
$sp = new SplitWord();
$keywords = $sp->SplitRMM($keyword);
$sp->Clear();
$keywords = ereg_replace("[ ]{1,}"," ",trim($keywords));
}else{
$keywords = $keyword;
}
$inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)
VALUES ('".addslashes($keyword)."', '".addslashes($keywords)."', '1', '0', '".time()."');
";
$this->dsql->ExecuteNoneQuery($inquery);
}else{
$this->dsql->ExecuteNoneQuery("Update #@__search_keywords set count=count+1,lasttime='".time()."' where keyword='".addslashes($keyword)."'; ");
$keywords = $row['spwords'];
}
return $keywords;
}
示例11: SplitWord
/**
* [SplitWord 分词]
* @param [type] $str [description]
*/
function SplitWord($str)
{
vendor('SplitWord/SplitWord');
$split = new SplitWord();
$data = $split->SplitRMM($str);
p($data);
$split->Clear();
return $data;
}
示例12: q
function q($wd, $domain = '')
{
global $db;
$this->db =& $db;
$this->wd = $wd;
require "../include/splitword.func.php";
$sp = new SplitWord();
$wd_split = $sp->SplitRMM($wd);
$sp->Clear();
$this->wd_split = $wd_split = ereg_replace("[ ]{1,}", " ", trim($wd_split));
$this->wd_array = $wd_array = explode(" ", $wd_split);
$this->wd_count = $wd_count = count($wd_split);
//echo $wd_count;
$tgarray = $this->GetTg();
$tgarray_count = count($tgarray);
$ordersql = " order by links.tuiguang desc,(";
foreach ($wd_array as $value) {
$ordersql .= "(case when links.title like '%" . $value . "%' then 1 else 0 end)+";
}
$ordersql .= "(case when links.title like '%" . $wd . "%' then 8 else 0 end)";
// $ordersql=rtrim($ordersql,"+");
$ordersql .= ") desc";
$keywordsql = $this->GetKeywordSql("links.title,' ',links.url,' ',links.keywords");
if (empty($keywordsql)) {
$keywordsql = "links.title like '%" . $wd . "%'";
}
if (empty($domain)) {
$sql = "select links.*,sites.qp from kuaso_links links left join kuaso_sites sites on links.site_id=sites.site_id where links.title<>'' and " . $keywordsql . $ordersql;
} else {
if ($domain == getdomain($domain)) {
$sql = "select * from kuaso_links where title<>'' and url like '%." . $domain . "%' or url like '%//" . $domain . "%'";
//echo $sql;
} else {
$sql = "select * from kuaso_links where title<>'' and url regexp 'http://" . $domain . "'";
//echo $sql;
}
}
//echo $sql;
$query = $db->query($sql);
$this->total = $total = $db->num_rows($query) + $tgarray_count;
$pagesize = 10;
$this->totalpage = $totalpage = ceil($total / $pagesize);
$p = intval($_GET["p"]);
if ($p <= 0) {
$p = 1;
}
$offset = ($p - 1) * $pagesize;
$query = $db->query($sql . " limit {$offset},{$pagesize}");
while ($row = $db->fetch_array($query)) {
$data["title"] = $this->GetRedKeyWord(str_cut($row["title"], 60));
$data["txt"] = $this->GetRedKeyWord(str_cut($row["fulltxt"], 250));
$data["url"] = str_cut($row["url"], 50);
$data["updatetime"] = date("Y-m-d", $row["updatetime"]);
$data["pagesize"] = $row["pagesize"];
$data["link_id"] = $row["link_id"];
$data["tuiguang"] = $row["tuiguang"];
$array[] = $data;
}
$array_count = count($array);
if (empty($array_count)) {
$newarray = $tgarray;
} elseif ($p == 1 && $tgarray_count > 0) {
$newarray = array_merge($tgarray, $array);
} else {
$newarray = $array;
}
return $newarray;
}