Returns a string of words whose words are mixed.

@param string $words

@return string
327515
public static function shuffleWords($words)
    {
        $wordParts = explode(' ', trim($words));

        $wordPartsLen = count($wordParts);

        $rand = [];

        do {
            $r = rand(0, $wordPartsLen - 1);

            if (!in_array($r, $rand)) {
                $rand[] = $r;
            }
        } while (count($rand) != $wordPartsLen);

        $sentence = '';

        foreach ($rand as $word) {
            $sentence .= $wordParts[$word] . ' ';
        }

        return trim($sentence);
    }
465828
protected function getKeywordAsCondition($keywords) {
        $keywords = $keywords->toArray();
        foreach ($keywords as &$keyword) {
            $keyword = $keyword->getLabel();
        }

        return implode(',', $keywords);
    }
596347
public static function depluralize($word) {
        $rules = array(
            'ss' => false,
            'os' => 'o',
            'ies' => 'y',
            'xes' => 'x',
            'oes' => 'o',
            'ies' => 'y',
            'ves' => 'f',
            'hes' => 'h',
            's' => '');

        foreach(array_keys($rules) as $key) {

            if(substr($word, (strlen($key) * -1)) != $key) {
                continue;
            }

            if($rules[$key] === false) {
                return $word;
            }

            return substr($word, 0, strlen($word) - strlen($key)) . $rules[$key];
        }

        return $word;
    }
1253139
public static function fromList(array $words, array $options = [])
	{
		$options += [
			'delimiter'       => '/',
			'caseInsensitive' => false,
			'specialChars'    => [],
			'unicode'         => true
		];

		// Normalize ASCII if the regexp is meant to be case-insensitive
		if ($options['caseInsensitive'])
		{
			foreach ($words as &$word)
			{
				$word = strtr($word, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
			}
			unset($word);
		}

		$builder = new Builder([
			'delimiter' => $options['delimiter'],
			'meta'      => $options['specialChars'],
			'input'     => $options['unicode'] ? 'Utf8' : 'Bytes',
			'output'    => $options['unicode'] ? 'Utf8' : 'Bytes'
		]);

		return $builder->build($words);
	}
1054822
private function buildSearchQuery(array $words)
    {
        $qb = $this->app->make(PackageRepository::class)->createQueryBuilder('p');
        $expr = $qb->expr();
        $orFields = $expr->orX();
        foreach (['p.handle', 'p.name'] as $fieldName) {
            $and = $expr->andX();
            foreach ($words as $word) {
                $and->add($expr->like($fieldName, $expr->literal('%' . $word . '%')));
            }
            $orFields->add($and);
        }
        $qb->where($orFields);
        if ($this->maximumSearchResults) {
            $qb->setMaxResults($this->maximumSearchResults);
        }

        return $qb;
    }
409953
public function match(string $word)
    {
        $this->processAbbreviations();
        $word = strtolower($word);

        if ($this->abbreviations && isset($this->abbreviations[$word])) {
            return $this->abbreviations[$word];
        }

        return false;
    }
724657
public function match($text, array $words)
    {
        if (! $this->isHan($text)) {
            return $this->matchExact($text, $words);
        }

        return Match\Chinese::match($text, $words);
    }
1201397
public static function match($text, array $words)
    {
        foreach ($words as $word) {
            if (false !== mb_strpos($text, $word)) {
                return true;
            }
        }

        return false;
    }
918690
public static function verbalize($word)
    {
        //Get the cached noun of it exists
        if (isset(self::$_cache['verbalized'][$word])) {
            return self::$_cache['verbalized'][$word];
        }
 
        foreach (self::$_rules['verbalization'] as $regexp => $replacement) {
            $matches = null;
            $verbal = preg_replace($regexp, $replacement, $word, -1, $matches);
            if ($matches > 0) {
                self::$_cache['verbalized'][$word] = $verbal;
                return $verbal;
            }
        }

        return $word;
    }
502189
function &checkWords($lang, $words) {
		$r = enchant_broker_init();
		
		if (enchant_broker_dict_exists($r,$lang)) {
			$d = enchant_broker_request_dict($r, $lang);
			
			$returnData = array();
			foreach($words as $key => $value) {
				$correct = enchant_dict_check($d, $value);
				if(!$correct) {
					$returnData[] = trim($value);
				}
			}
	
			return $returnData;
			enchant_broker_free_dict($d);
		} else {

		}
		enchant_broker_free($r);
	}
158454
protected function stemWord($word)
    {
        if ($this->isPlural($word)) {
            return $this->stemPluralWord($word);
        } else {
            return $this->stemSingularWord($word);
        }
    }
99921
protected function get_parts($word)
    {
        $parts = array();
        $word_l = mb_strlen($word);
        $min_l = min($this->minPart, $word_l);
        $max_l = min($this->maxPart, $word_l);
        for ($size = $min_l; $size <= $max_l; $size ++)
        {
            for ($i = 0; $i <= $word_l - $size; $i++)
            {
                $parts[] = mb_substr($word, $i, $size, "UTF-8");
            }
        }
        return $parts;
    }
662251
public List<String> phraseDel(String[] words){
		List<String> list = new ArrayList<String>(); 
		String s;
		int length= words.length;
		for(int i = 0; i < length; i++){
			s = words[i];
			if(!isStopWord(s))
				list.add(s);
		}
		return list;
	}
1325042
public static function getWords($words, $len)
    {
        $wordParts = explode(' ', $words);

        $sentence = '';

        for ($i = 0; $i < $len; $i++) {
            $sentence .= ' ' . $wordParts[$i];
        }

        return trim($sentence);
    }
1058446
protected function singularize($word)
    {
        if (isset($this->singulars[$word])) {
            return $this->singulars[$word];
        }

        foreach ($this->singularRules as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                $this->singulars[$word] = preg_replace($rule, $replacement, $word);
                return $this->singulars[$word];
            }
        }

        $this->singulars[$word] = $word;
        return $word;
    }
317242
public function words($words = 100, $end = '')
	{
		$matches = $this->newRegex('^\s*+(?:\S++\s*+){1,'.$words.'}')->match($this);

		$trancated = isset($matches[0]) ? $this->getNew($matches[0]) : null;

		if (is_null($trancated) || $this->length() === $trancated->length()){
			return $this->getNew();
		}

		$trancated = $trancated->trimRight();
		$trancated->str = $trancated->str . $end;

		return $trancated;
	}
1061609
protected function getWordsRegexp(array $words)
	{
		$expr  = RegexpBuilder::fromList($words, $this->regexpOptions);
		$regexp = new Regexp('/(?<![\\pL\\pN])' . $expr . '(?![\\pL\\pN])/Siu');

		// JavaScript regexps don't support Unicode properties, so instead of Unicode letters
		// we'll accept any non-whitespace, non-common punctuation
		$expr = str_replace('[\\pL\\pN]', '[^\\s!-\\/:-?]', $expr);
		$expr = str_replace('(?>',        '(?:',            $expr);
		$regexp->setJS('/(?:^|\\W)' . $expr . '(?!\\w)/gi');

		return $regexp;
	}