function __construct(phpMorphy_Fsa_FsaInterface $fsa, phpMorphy_AnnotDecoder_AnnotDecoderInterface $annotDecoder, $encoding, phpMorphy_GramInfo_GramInfoInterface $graminfo, $minPostfixMatch = 2, $collectLimit = 32) { parent::__construct($fsa, $annotDecoder); $this->graminfo = $graminfo; $this->min_postfix_match = $minPostfixMatch; $this->collector = $this->createCollector($collectLimit, $this->getAnnotDecoder()); $this->unicode = phpMorphy_UnicodeHelper_UnicodeHelperAbstract::getHelperForEncoding($encoding); }
protected function doFindWord($word) { $word_len = $this->unicode->strlen($word); if (!$word_len) { return false; } $skip_len = 0; for ($i = 1, $c = $word_len - $this->min_suf_len; $i < $c; $i++) { $first_char_size = $this->unicode->getFirstCharSize($word); $skip_len += $first_char_size; $word = substr($word, $first_char_size); if (false !== ($result = parent::doFindWord($word))) { break; } } if ($i < $c) { return $this->fixAnnots($this->decodeAnnot($result, true), $skip_len); } else { return false; } }