Gets the singular version of the given word

@param   string  the word to singularize
@return  string  the singular version of $word
493737
public function singularize($word)
	{
		$result = strval($word);

		if ( ! $this->isCountable($result))
		{
			return $result;
		}

		foreach ($this->singularRules as $rule => $replacement)
		{
			if (preg_match($rule, $result))
			{
				$result = preg_replace($rule, $replacement, $result);
				break;
			}
		}

		return $result;
	}
881914
public static function pluralise($word)
    {
        // Run each rule over the word
        foreach (static::$pluralRules as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                return preg_replace($rule, $replacement, $word);
            }
        }

        return $word;
    }
1320773
public function stem($word)
    {
        if(empty(trim($word))) { 
            return null;
        }
        
        $this->originalToken = $word;
        
        //only iterate out loop if a rule is applied        
        do {
            $ruleApplied = false;
            $lookupChar = $word[strlen($word)-1];

            //check that the last character is in the index, if not return the origin token
            if(!array_key_exists($lookupChar, $this->indexedRules)){
                return $word;
            }
            foreach($this->indexedRules[$lookupChar] as $rule)
            {
                if(strrpos($word, substr($rule[self::ENDING_STRING],-1)) === 
                        (strlen($word)-strlen($rule[self::ENDING_STRING]))){

                    
                    if(!empty($rule[self::INTACT_FLAG])){ 
                        
                        if($this->originalToken == $word && 
                            $this->isAcceptable($word, (int)$rule[self::REMOVE_TOTAL])){

                            $word = $this->applyRule($word, $rule);
                            $ruleApplied = true;
                            if($rule[self::CONTINUE_FLAG] === '.'){
                                return $word;
                            } 
                            break;
                        }
                    } elseif($this->isAcceptable($word, (int)$rule[self::REMOVE_TOTAL])){
                        $word = $this->applyRule($word, $rule);
                        $ruleApplied = true;
                        if($rule[self::CONTINUE_FLAG] === '.'){
                            return $word;
                        }
                        break;
                    }
                } else {
                    $ruleApplied = false;
                }
            }
        } while($ruleApplied);
        
        return $word;
                        
    }
982347
public static function singular($string)
	{
		//assing the input string to a result variable
		$result = $string;

		//loop through the array of singular patterns, getting the regular exppression patters
		foreach ($self::$singulars as $rule => $replacement) 
		{
			//get the regular expression friendly pattern
			$rule = self::normalize($rule);

			//check if there is a matching pattern in the input string
			if ( preg_match($rule, $string) ) 
			{
				//replace with the appropriate string and return
				$result = preg_replace($rule, $replacement, $string);

				//once  a replacement is found, break out of the loop
				break;

			}

		}

		//return the result that was found
		return $result;

	}
137385
public function disambiguate($word)
    {
        $matches  = null;
        $contains = preg_match('/^men([aiueo])(.*)$/', $word, $matches);

        if ($contains === 1) {
            return 'n' . $matches[1] . $matches[2];
        }
    }
976035
private function blockWord($word)
    {
        if ($this->strictClean) {
            return str_repeat($this->blocker[0], strlen($word));
        }

        return $this->blocker;
    }
1130127
public static function capitalize($word) {
        if (is_array($word)) {
            $word = $word[0];
        }

        return str_replace(' ', '', ucwords(str_replace(array('-', '_'), ' ', $word)));
    }
1030005
static public function underscore($word)
 	{
 		$let = strtolower(substr($word,0,1));
 		$word = $let.substr($word,1);
		$word = preg_replace('/([A-Z])/', '_\\1', $word);
		return strtolower($word);
	}
1214043
private function morseWord($word) {
        $chars = $this->strSplit($word);
        $morse = array_map([$this, 'morseCharacter'], $chars);
        return implode(' ', $morse);
    }
664836
public static function oneByWord($word)
	{
		$word = trim($word);
		$word = strtolower($word);

		return self::blank()
			->whereEquals('word', $word)
			->row();
	}
1161392
private static function _toPinYin($word) {
        if ($word > 0 && $word < 160 ) {
            return chr($word);
        }
        if ($word < -20319 || $word>-10247) {
            return '';
        }
        $result = '';
        foreach (self::$_maps as $py  =>  $code) {
            if($code > $word) break;
            $result = $py;
        }
        return $result;
    }
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;
    }
367707
public static function pluralize($word)
    {
        if (isset(self::$_cache['pluralize'][$word])) {
            return self::$_cache['pluralize'][$word];
        }

        if (!isset(self::$_plural['merged']['irregular'])) {
            self::$_plural['merged']['irregular'] = self::$_plural['irregular'];
        }

        if (!isset(self::$_plural['merged']['uninflected'])) {
            self::$_plural['merged']['uninflected'] = array_merge(self::$_plural['uninflected'], self::$_uninflected);
        }

        if (!isset(self::$_plural['cacheUninflected']) || !isset(self::$_plural['cacheIrregular'])) {
            self::$_plural['cacheUninflected'] = '(?:' . implode('|', self::$_plural['merged']['uninflected']) . ')';
            self::$_plural['cacheIrregular'] = '(?:' . implode('|', array_keys(self::$_plural['merged']['irregular'])) . ')';
        }

        if (preg_match('/(.*)\\b(' . self::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
            self::$_cache['pluralize'][$word] = $regs[1] . substr($word, 0, 1) . substr(self::$_plural['merged']['irregular'][strtolower($regs[2])], 1);
            return self::$_cache['pluralize'][$word];
        }

        if (preg_match('/^(' . self::$_plural['cacheUninflected'] . ')$/i', $word, $regs)) {
            self::$_cache['pluralize'][$word] = $word;
            return $word;
        }

        foreach (self::$_plural['rules'] as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                self::$_cache['pluralize'][$word] = preg_replace($rule, $replacement, $word);
                return self::$_cache['pluralize'][$word];
            }
        }
    }
413189
public static function singularize($word)
	{
		$result = strval($word);

		if (! static::is_countable($result))
		{
			return $result;
		}

		foreach (static::$singular_rules as $rule => $replacement)
		{
			if (preg_match($rule, $result))
			{
				$result = preg_replace($rule, $replacement, $result);
				break;
			}
		}

		return $result;
	}
1160810
public static function plural($word)
    {
        if(is_array($word)) {
            $ret = [];
            foreach($word as $key => $value) {
                $ret[$key] = Str::plural($value);
            }

            return $ret;
        }

        return Inflector::plural($word);
    }
887470
public static function convertToPascalCase($word)
    {
        // separate into block for easier readability
        $word = str_replace('_', ' ', $word);
        $word = strtolower($word);
        $word = ucwords($word);
        return str_replace(' ', '', $word);
    }
1306112
protected function uppercaseWord($word)
    {
        // see if first characters are special
        $prefix = '';
        $hasPunctuation = true;
        do {
            $first = mb_substr($word, 0, 1, $this->encoding);
            if ($this->isPunctuation($first)) {
                $prefix .= $first;
                $word = mb_substr($word, 1, -1, $this->encoding);
            } else {
                $hasPunctuation = false;
            }
        } while ($hasPunctuation === true);

        return $prefix . ucwords($word);
    }