当前位置: 首页>>代码示例>>PHP>>正文


PHP SplitWord::SetResultType方法代码示例

本文整理汇总了PHP中SplitWord::SetResultType方法的典型用法代码示例。如果您正苦于以下问题:PHP SplitWord::SetResultType方法的具体用法?PHP SplitWord::SetResultType怎么用?PHP SplitWord::SetResultType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SplitWord的用法示例。


在下文中一共展示了SplitWord::SetResultType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetKeywords

 /**
  *  获得关键字的分词结果,并保存到数据库
  *
  * @access    public
  * @param     string  $keyword  关键词
  * @return    string
  */
 function GetKeywords($keyword)
 {
     global $cfg_soft_lang;
     $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) > 7) {
             $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
             $sp->SetSource($keyword, $cfg_soft_lang, $cfg_soft_lang);
             $sp->SetResultType(2);
             $sp->StartAnalysis(TRUE);
             $keywords = $sp->GetFinallyResult();
             $idx_keywords = $sp->GetFinallyIndex();
             ksort($idx_keywords);
             $keywords = $keyword . ' ';
             foreach ($idx_keywords as $key => $value) {
                 if (strlen($key) <= 3) {
                     continue;
                 }
                 $keywords .= ' ' . $key;
             }
             $keywords = preg_replace("/[ ]{1,}/", " ", $keywords);
             //var_dump($idx_keywords);exit();
             unset($sp);
         } else {
             $keywords = $keyword;
         }
         $inquery = "INSERT INTO `#@__search_keywords`(`keyword`,`spwords`,`count`,`result`,`lasttime`)\n          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;
 }
开发者ID:wshudong,项目名称:hbypsy,代码行数:42,代码来源:arc.searchview.class.php

示例2: array

     $smarty->assign('brand_list', get_brand_list());
     $smarty->assign('action', 'form');
     $smarty->assign('use_storage', $_CFG['use_storage']);
     $action = 'form';
 }
 /* 初始化搜索条件 */
 $keywords = '';
 $tag_where = '';
 if (!empty($_REQUEST['keywords'])) {
     /* 代码修改_START   By    www.68ecshop.com   */
     include_once 'includes/lib_splitword_www_68ecshop_com.php';
     $Recordkw = str_replace(array("\\'"), array(''), trim($_REQUEST['keywords']));
     $cfg_soft_lang_www_68ecshop_com = 'utf-8';
     $sp_www_68ecshop_com = new SplitWord($cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com);
     $sp_www_68ecshop_com->SetSource($Recordkw, $cfg_soft_lang_www_68ecshop_com, $cfg_soft_lang_www_68ecshop_com);
     $sp_www_68ecshop_com->SetResultType(1);
     $sp_www_68ecshop_com->StartAnalysis(TRUE);
     $word_www_68ecshop_com = $sp_www_68ecshop_com->GetFinallyResult(' ');
     //echo  $word_www_68ecshop_com;
     $word_www_68ecshop_com = preg_replace("/[ ]{1,}/", " ", trim($word_www_68ecshop_com));
     $replacef_www_68ecshop_com = explode(' ', $word_www_68ecshop_com);
     $keywords = 'AND (';
     $goods_ids = array();
     foreach ($replacef_www_68ecshop_com as $key => $val) {
         if ($key > 0 && $key < count($replacef_www_68ecshop_com) && count($replacef_www_68ecshop_com) > 1) {
             $keywords .= " AND ";
         }
         $val = mysql_like_quote(trim($val));
         $sc_dsad = $_REQUEST['sc_ds'] ? " OR goods_desc LIKE '%{$val}%'" : '';
         $keywords .= "(goods_name LIKE '%{$val}%' OR goods_sn LIKE '%{$val}%' OR keywords LIKE '%{$val}%' {$sc_dsad})";
         $sql = 'SELECT DISTINCT goods_id FROM ' . $ecs->table('tag') . " WHERE tag_words LIKE '%{$val}%' ";
开发者ID:moonlight-wang,项目名称:feilun,代码行数:31,代码来源:search.php

示例3: SplitWord

 }
 $tjnum = $startdd;
 if ($limitSql != '') {
     $fquery = "SELECT arc.id,arc.title,arc.keywords,addon.body FROM `#@__archives` arc\n              LEFT JOIN `#@__addonarticle` addon ON addon.aid=arc.id WHERE arc.channel='1' {$limitSql} ";
     $dsql->SetQuery($fquery);
     $dsql->Execute();
     $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang);
     while ($row = $dsql->GetObject()) {
         if ($row->keywords != '') {
             continue;
         }
         $tjnum++;
         $id = $row->id;
         $keywords = "";
         $sp->SetSource($row->title, $cfg_soft_lang, $cfg_soft_lang);
         $sp->SetResultType(2);
         $sp->StartAnalysis(TRUE);
         $titleindexs = $sp->GetFinallyIndex();
         $sp->SetSource(Html2Text($row->body), $cfg_soft_lang, $cfg_soft_lang);
         $sp->SetResultType(2);
         $sp->StartAnalysis(TRUE);
         $allindexs = $sp->GetFinallyIndex();
         if (is_array($allindexs) && is_array($titleindexs)) {
             foreach ($titleindexs as $k => $v) {
                 if (strlen($keywords) >= 30) {
                     break;
                 } else {
                     if (strlen($k) <= 2) {
                         continue;
                     }
                     $keywords .= $k . ",";
开发者ID:hensonvip,项目名称:ymroad,代码行数:31,代码来源:article_keywords_make.php


注:本文中的SplitWord::SetResultType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。