Methode to get soundex/phonix numric code for given word

@param string $word The word that we want to encode it

@return string The calculated soundex/phonix numeric code
@author Khaled Al-Sham'aa <khaled@ar-php.org>
17610
protected function mapCode($word)
    {
        $encodedWord = '';
        
        $max   = mb_strlen($word, 'UTF-8');
        
        for ($i=0; $i < $max; $i++) {
            $char = mb_substr($word, $i, 1, 'UTF-8');
            if (isset($this->_map["$char"])) {
                $encodedWord .= $this->_map["$char"];
            } else {
                $encodedWord .= '0';
            }
        }
        
        return $encodedWord;
    }
409953
public function match(string $word)
    {
        $this->processAbbreviations();
        $word = strtolower($word);

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

        return false;
    }
219444
public static function camelize($word)
    {
        if (preg_match_all('/\/(.?)/', $word, $got)) {
            foreach ($got[1] as $k => $v)
                $got[1][$k] = '::'.strtoupper($v);

            $word = str_replace($got[0], $got[1], $word);
        }
        return str_replace(' ', '', ucwords(preg_replace('/[^A-Z^a-z^0-9^:]+/', ' ', $word)));
    }
137385
public function disambiguate($word)
    {
        $matches  = null;
        $contains = preg_match('/^men([aiueo])(.*)$/', $word, $matches);

        if ($contains === 1) {
            return 'n' . $matches[1] . $matches[2];
        }
    }
370650
public static function pluralize(string $word): string
    {
        if (isset(static::$inflectorCache['pluralize'][$word])) {
            return static::$inflectorCache['pluralize'][$word];
        }

        if (!isset(static::$inflectorCache['irregular']['pluralize'])) {
            static::$inflectorCache['irregular']['pluralize'] = '(?:' . implode('|', array_keys(static::$irregular)) . ')';
        }

        if (preg_match('/(.*?(?:\\b|_))(' . static::$inflectorCache['irregular']['pluralize'] . ')$/i', $word, $regs)) {
            static::$inflectorCache['pluralize'][$word] = $regs[1] . substr($regs[2], 0, 1) .
                substr(static::$irregular[strtolower($regs[2])], 1);

            return static::$inflectorCache['pluralize'][$word];
        }

        if (!isset(static::$inflectorCache['uninflected'])) {
            static::$inflectorCache['uninflected'] = '(?:' . implode('|', static::$uninflected) . ')';
        }

        if (preg_match('/^(' . static::$inflectorCache['uninflected'] . ')$/i', $word, $regs)) {
            static::$inflectorCache['pluralize'][$word] = $word;

            return $word;
        }

        foreach (static::$plural as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                static::$inflectorCache['pluralize'][$word] = preg_replace($rule, $replacement, $word);

                return static::$inflectorCache['pluralize'][$word];
            }
        }

        return $word;
    }
1248722
protected function trimRep($word)
    {
        $lastChar  = null;
        $cleanWord = null;
        $max       = mb_strlen($word, 'UTF-8');
        
        for ($i = 0; $i < $max; $i++) {
            $char = mb_substr($word, $i, 1, 'UTF-8');
            if ($char != $lastChar) {
                $cleanWord .= $char;
            }
            $lastChar = $char;
        }
        
        return $cleanWord;
    }
900872
public static function underscorize($word)
    {
        $regex1 = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', $word);
        $regex2 = preg_replace('/([a-zd])([A-Z])/', '\1_\2', $regex1);
        $regex3 = preg_replace('/[^A-Z^a-z^0-9]+/', '_', $regex2);

        return strtolower($regex3);
    }
854406
protected function hasDash($word)
    {
        $wordWithoutDashes = str_replace('-', '', $word);

        return preg_match("/\-/", $word) && mb_strlen($wordWithoutDashes, $this->encoding) > 1;
    }
909955
private static function step0b($word)
    {
        $word = str_replace(array('ä', 'ö', 'ü', 'U', 'Y'), array('a', 'o', 'u', 'u', 'y'), $word);

        return $word;
    }
1010787
protected function pluralize($word)
    {
        $result = strval($word);

        if (in_array(strtolower($result), $this->uncountableWords())) {
            return $result;
        } else {
            foreach ($this->pluralRules() as $rule => $replacement) {
                if (preg_match($rule, $result)) {
                    $result = preg_replace($rule, $replacement, $result);
                    break;
                }
            }

            return $result;
        }
    }
1034027
public function pluralize ($word) {
		$word .= 's';
		$word = preg_replace ('/(x|ch|sh|ss])s$/', '\1es', $word);
		$word = preg_replace ('/ss$/', 'ses', $word);
		$word = preg_replace ('/([ti])ums$/', '\1a', $word);
		$word = preg_replace ('/sises$/', 'ses', $word);
		$word = preg_replace ('/([^aeiouy]|qu)ys$/', '\1ies', $word);
		$word = preg_replace ('/(?:([^f])fe|([lr])f)s$/', '\1\2ves', $word);
		$word = preg_replace ('/ieses$/', 'ies', $word);
		if (isset ($this->pleural_corrections[$word])) {
			return $this->pleural_corrections[$word];
		}
		return $word;
	}
1108105
public static function singularize(string $word): string
    {
        if (isset(static::$inflectorCache['singularize'][$word])) {
            return static::$inflectorCache['singularize'][$word];
        }

        if (!isset(static::$inflectorCache['irregular']['singular'])) {
            static::$inflectorCache['irregular']['singular'] = '(?:' . implode('|', static::$irregular) . ')';
        }

        if (preg_match('/(.*?(?:\\b|_))(' . static::$inflectorCache['irregular']['singular'] . ')$/i', $word, $regs)) {
            static::$inflectorCache['singularize'][$word] = $regs[1] . substr($regs[2], 0, 1) .
                substr(array_search(strtolower($regs[2]), static::$irregular), 1);

            return static::$inflectorCache['singularize'][$word];
        }

        if (!isset(static::$inflectorCache['uninflected'])) {
            static::$inflectorCache['uninflected'] = '(?:' . implode('|', static::$uninflected) . ')';
        }

        if (preg_match('/^(' . static::$inflectorCache['uninflected'] . ')$/i', $word, $regs)) {
            static::$inflectorCache['pluralize'][$word] = $word;

            return $word;
        }

        foreach (static::$singular as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                static::$inflectorCache['singularize'][$word] = preg_replace($rule, $replacement, $word);

                return static::$inflectorCache['singularize'][$word];
            }
        }

        static::$inflectorCache['singularize'][$word] = $word;

        return $word;
    }
395030
public static function singular($word)
    {
        if(is_array($word)) {
            $keys = array_keys($word);
            $size = sizeof($keys);

            for($i = 0; $i < $size; $i++) {
                $word[$keys[$size]] = Str::singular($word);
            }

            return $word;
        }

        return Inflector::singular($word);
    }
748681
public static function singularize($word) {
		if (isset(self::$_cache['singularize'][$word])) {
			return self::$_cache['singularize'][$word];
		}

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

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

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

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

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

		foreach (self::$_singular['rules'] as $rule => $replacement) {
			if (preg_match($rule, $word)) {
				self::$_cache['singularize'][$word] = preg_replace($rule, $replacement, $word);
				return self::$_cache['singularize'][$word];
			}
		}
		self::$_cache['singularize'][$word] = $word;
		return $word;
	}
622887
private static function step1c($word)
	{
		$v = self::$regexVowel;

		if (substr($word, -1) == 'y' && preg_match("#$v+#", substr($word, 0, -1)))
		{
			self::replace($word, 'y', 'i');
		}

		return $word;
	}
747603
function _subWord($word)
    {
        static $sbox;
        if (empty($sbox)) {
            list(, , , , $sbox) = $this->_getTables();
        }

        return  $sbox[$word       & 0x000000FF]        |
               ($sbox[$word >>  8 & 0x000000FF] <<  8) |
               ($sbox[$word >> 16 & 0x000000FF] << 16) |
               ($sbox[$word >> 24 & 0x000000FF] << 24);
    }
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);
    }