Process given string and return appropriate size value.

@param $word
@return int
333389
private function parseSizeWord($word)
    {
        $sizeWord = strtoupper(preg_replace('/([a-z])([A-Z])/', '$1_$2', $word));
        if (array_key_exists($sizeWord, $this->sizes)) {
            $size = $this->sizes[$sizeWord];
        } else {
            $size = 0;
        }
        return $size;
    }
332401
private function getTokens(string $word): array
    {
        $flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY;

        return (array) preg_split(self::TOKEN_DELIMITER, $word, -1, $flags);
    }
307107
private static function step5($word)
	{
		// Part a
		if (substr($word, -1) == 'e')
		{
			if (self::m(substr($word, 0, -1)) > 1)
			{
				self::replace($word, 'e', '');
			}
			elseif (self::m(substr($word, 0, -1)) == 1)
			{
				if (!self::cvc(substr($word, 0, -1)))
				{
					self::replace($word, 'e', '');
				}
			}
		}

		// Part b
		if (self::m($word) > 1 && self::doubleConsonant($word) && substr($word, -1) == 'l')
		{
			$word = substr($word, 0, -1);
		}

		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;
        }
    }
75932
public static function rtrimWord($string, $word)
    {
        $end = mb_substr($string, 0-mb_strlen($word));
        if ($end != $word) {
            return $string;
        }
        return mb_substr($string, 0, mb_strlen($string)-mb_strlen($word));
    }
1005318
public static function singularize($word)
    {

        static::$uncountables = array(
            'equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'media'
        );
        static::$irregulars = array(
            'person'  => 'people',
            'man'     => 'men',
            'child'   => 'children',
            'sex'     => 'sexes',
            'move'    => 'moves'
        );
        $lowerCasedWord = strtolower($word);
        foreach (static::$uncountables as $uncountable) {
            if (substr($lowerCasedWord, (-1 * strlen($uncountable))) == $uncountable) {
                return $word;
            }
        }
        foreach (static::$irregulars as $plural => $singular) {
            if (preg_match('/(' . $singular.')$/i', $word, $arr)) {
                return preg_replace(
                    '/(' . $singular . ')$/i',
                    substr($arr[0], 0, 1) . substr($plural, 1),
                    $word
                );
            }
        }
        foreach (static::$singulars as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                return preg_replace($rule, $replacement, $word);
            }
        }

        return $word;
    }
906711
public static function underscore($word) {
		if (isset(static::$_underscored[$word])) {
			return static::$_underscored[$word];
		}
		return static::$_underscored[$word] = strtolower(static::slug($word, '_'));
	}
1103929
public static PaperSize lookup( String word ) {
		for( PaperSize paper : values ) {
			if( paper.name.compareToIgnoreCase(word) == 0 ) {
				return paper;
			}
		}

		return null;
	}
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);
    }
1074251
private static function getR($word)
    {
        self::$R1 = "";
        self::$R2 = "";

        $vowels        = implode("", self::$vowels);
        $vowelGroup    = "[{$vowels}]";
        $nonVowelGroup = "[^{$vowels}]";
        // R1 is the region after the first non-vowel following a vowel, or is the null region at the end of the word if there is no such non-vowel.
        $pattern = "#(?P<rest>.*?{$vowelGroup}{$nonVowelGroup})(?P<r>.*)#u";
        if (preg_match($pattern, $word, $match)) {
            $rest = $match["rest"];
            $r1   = $match["r"];
            // [...], but then R1 is adjusted so that the region before it contains at least 3 letters.
            $cutOff = 3 - mb_strlen($rest);
            if ($cutOff > 0) {
                $r1 = mb_substr($r1, $cutOff);
            }
            self::$R1 = $r1;
        }

        //R2 is the region after the first non-vowel following a vowel in R1, or is the null region at the end of the word if there is no such non-vowel.
        if (preg_match($pattern, self::$R1, $match)) {
            self::$R2 = $match["r"];
        }
    }
445040
private static function step0a($word)
    {
        $word = str_replace(array('ä','ö','ü'), array('A','O','U'), $word);
        $vstr = implode('', self::$vowels);
        $word = preg_replace('#(['.$vstr.'])u(['.$vstr.'])#', '$1Z$2', $word);
        $word = preg_replace('#(['.$vstr.'])y(['.$vstr.'])#', '$1Y$2', $word);

        return $word;
    }
93472
private static function step1ab($word)
    {
        $word = self::doPartA($word);
        $word = self::doPartB($word);

        return $word;
    }
1263774
protected function _prepareRegex($word) {
        $letters = str_split($word);
        $regex = '';

        foreach ($letters as $letter) {
            $regex .= preg_quote($letter, '/') . '+';
        }

        $suffix = $this->getConfig('suffix');

        if (is_array($suffix)) {
            $suffix = implode('|', $suffix);
        }

        $regex .= '(?:' . $suffix . ')?';

        return $regex;
    }
389215
private static function step0a($word)
    {
        $vstr = implode('', self::$vowels);
        $word = preg_replace('#([' . $vstr . '])u([' . $vstr . '])#u', '$1U$2', $word);
        $word = preg_replace('#([' . $vstr . '])y([' . $vstr . '])#u', '$1Y$2', $word);

        return $word;
    }
1282599
public static function singularize(string $word): string
	{
		if (isset(static::$_cache['singularize'][$word])) {
			return static::$_cache['singularize'][$word];
		}

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

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

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

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

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

			return $word;
		}

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

				return static::$_cache['singularize'][$word];
			}
		}
		static::$_cache['singularize'][$word] = $word;

		return $word;
	}
714815
protected function stripTagAttributes($word)
    {
        $space = $this->stringUtil->strpos($word, ' ', 1);

        if ($space) {
            return '<' . $this->stringUtil->substr($word, 1, $space) . '>';
        }

        return trim($word, '<>');
    }
369384
public function grep( $word ) {
		$found = array();
		foreach($this->logs as $log) {
			if (strpos($log,$word)!==false) {
				$found[] = $log;
			}
		}
		return $found;
	}