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


PHP Lookup::stopwords方法代码示例

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


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

示例1: StopFilter

	/**
	 * Removes stop words from the text
	 *
	 * Stop words are words that are common English words that
	 * are not particularly useful for searching.
	 *	 
	 * @since 1.1
	 *
	 * @param string $text The text to clean up
	 * @return string The cleaned text
	 **/
	static function StopFilter ($text) {
		$stopwords = Lookup::stopwords();
		$replacements = implode('|',$stopwords);
		return preg_replace("/\b($replacements)\b/",'',$text);
	}
开发者ID:robbiespire,项目名称:paQui,代码行数:16,代码来源:Search.php

示例2: StopFilter

 /**
  * Removes stop words from the text
  *
  * Stop words are words that are common English words that
  * are not particularly useful for searching.
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @param string $text The text to clean up
  * @return string The cleaned text
  **/
 public static function StopFilter($text)
 {
     $stopwords = Lookup::stopwords();
     $replacements = implode('|', $stopwords);
     // Protect quoted strings
     $result = '';
     $unquoted = preg_split('/("[^"]*"|\'[^\']*\')/', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
     while ($unquoted) {
         $result .= preg_replace("/\\b({$replacements})\\b/", '', array_shift($unquoted)) . array_shift($unquoted);
     }
     return $result;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:24,代码来源:Search.php


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