Devuelve los tokens que componen una palabra

@param string $word

@return mixed[]
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);
    }
1163588
public function tokenize(string $text) : array
    {
        $pattern =
'/(\[
    \/?
    \w+
    (?:
        =
        (?:
            "[^"]+"
            |\'[^\']+\'
            |[^]]+
        )
    )?
\])/x';

        $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE;
        $tokens = preg_split($pattern, $text, -1, $flags);
        $tokens = array_map(function ($text) use ($pattern) {
            $matches = [];
            if (preg_match($pattern, $text, $matches)) {
                $token = new TagToken($text);

                // Fallback to a text token if tag is not valid.
                if (!$this->validateTagToken($token)) {
                    return new TextToken($text);
                }

                return $token;
            } else {
                return new TextToken($text);
            }
        }, $tokens);
        return $this->processRawContentTagTokens($tokens);
    }
906711
public static function underscore($word) {
		if (isset(static::$_underscored[$word])) {
			return static::$_underscored[$word];
		}
		return static::$_underscored[$word] = strtolower(static::slug($word, '_'));
	}
860023
public function getOnlyLemmas($word, $partOfSpeech = null) {
    $lemmas = $this->getLemmas($word, $partOfSpeech);
    $result = [];
    foreach($lemmas as $lemma) {
      if(!in_array($lemma->getLemma(), $result)) {
        $result[] = $lemma->getLemma();
      }
    }

    return $result;
  }
114588
public function GetWordProperty($word)
     {
        if( strlen($word)<4 )
        {
            return '/s';
        }
        $infos = $this->GetWordInfos($word);
        return isset($infos[1]) ? "/{$infos[1]}{$infos[0]}" : "/s";
     }
1331220
public static function pluralize($word)
    {
        $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('/(' . $plural . ')$/i', $word, $arr)) {
                return preg_replace(
                    '/(' . $plural . ')$/i',
                    substr($arr[0], 0, 1) . substr($singular, 1),
                    $word
                );
            }
        }
        foreach (static::$plurals as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                return preg_replace($rule, $replacement, $word);
            }
        }

        return false;
    }
347335
public function search(string $word) {
		$index   = $this->addFilter(new Search($word));
		$content = $this->listContents(true);
		$this->removeFilter($index);

		return $content;
	}
709644
public function getWord(string $word)
    {
        if (isset($this->words[strtolower($word)])) {
            return new SpecialWord($word, $this->words[strtolower($word)][0], $this->words[strtolower($word)][1]);
        }

        return new Word($word);
    }
461265
public static function camelCase($word)
    {
        if (isset(static::$camelCache[$word])) {

            return static::$camelCache[$word];

        }

        return static::$camelCache[$word] = lcfirst(static::studlyCase($word));
    }
623780
public static function underscore($word)
    {
        $word = preg_replace('/([A-Z]+)([A-Z][a-z])/', '\1_\2', $word);
        $word = preg_replace('/([a-z])([A-Z])/', '\1_\2', $word);

        return str_replace('-', '_', strtolower($word));
    }
12398
private function getCases($word)
    {
        $cases = array_fill_keys([
            'accusative',
            'genitive',
            'multiple',
        ], $word);

        if (!preg_match('/[а-яА-Я]+/', $word) || StringsUtil::isUppercase($word)) {
            return $cases;
        }

        $xml = @file_get_contents(self::CASE_API_URL.urlencode($word), null, stream_context_create([
            'http' => [
                'timeout' => self::CASE_API_TIMEOUT,
            ],
        ]));

        if (false === $xml) {
            return $cases;
        }

        $doc = simplexml_load_string($xml);

        if (false === $doc) {
            return $cases;
        }

        $doc = (array) $doc;

        if (isset($doc['code'])) {
            return $cases;
        }
        if (isset($doc['множественное'])) {
            $doc['множественное'] = (array) $doc['множественное'];
            $cases['multiple'] = $doc['множественное']['И'];
        }

        $cases['accusative'] = $doc['В'];
        $cases['genitive'] = $doc['Р'];

        return $cases;
    }
91193
public function removeHeadword($word)
    {
        if (is_string($word)) {
            $headword = $this->getHeadwords()->word($word)->one();
            return $headword && $headword->delete() == 1;
        }
        if ($word instanceof Headword && $word->extension == $this) {
            return $word->delete() == 1;
        }
    }
883461
public static function singularise($word)
    {
        // Run each rule over the word
        foreach (static::$singularRules as $rule => $replacement) {
            if (preg_match($rule, $word)) {
                return preg_replace($rule, $replacement, $word);
            }
        }

        return $word;
    }
1280870
public static function stem($word)
    {
        $word = mb_strtolower($word);
        //check for invalid characters
        preg_match("#.#u", $word);
        if (preg_last_error() !== 0) {
            throw new \InvalidArgumentException("Word '$word' seems to be errornous. Error code from preg_last_error(): " . preg_last_error());
        }
        if (!isset(self::$cache[$word])) {
            $result             = self::getStem($word);
            self::$cache[$word] = $result;
        }

        return self::$cache[$word];
    }
738654
public function suggest(string $word)
    {
        $this->processAbbreviations();
        $word = strtolower($word);
        $suggestions = [];

        if ($this->abbreviations) {
            $len = mb_strlen($word);

            foreach ($this->words as $w) {
                if (substr($w, 0, $len) === $word) {
                    $suggestions[] = $w;
                }
            }
        }

        return $suggestions;
    }
728202
public function findWord($word)
    {
        $key = $this->collator->getSortKey($word);

        /* In intl > 3.0.0a1, the key now ends with a trailing NUL byte.
         * We remove it for backward-compatibility with older releases. */
        if (substr($key, -1) === "\0") {
            $key = substr($key, 0, -1);
        }

        $this->existsQuery->execute(array(':key' => $key));
        $res = $this->existsQuery->fetchColumn();
        $this->existsQuery->closeCursor();
        if ($res === false || $res === null) {
            return null;
        }
        return $res;
    }
1334227
protected function stemSingularWord($word)
    {
        $context = new Context($word, $this->dictionary, $this->visitorProvider);
        $context->execute();

        return $context->getResult();
    }