Sastrawi\Stemmer\CachedStemmer::stem PHP Метод

stem() публичный Метод

public stem ( $text )
    public function stem($text)
    {
        $normalizedText = Filter\TextNormalizer::normalizeText($text);
        $words = explode(' ', $normalizedText);
        $stems = array();
        foreach ($words as $word) {
            if ($this->cache->has($word)) {
                $stems[] = $this->cache->get($word);
            } else {
                $stem = $this->delegatedStemmer->stem($word);
                $this->cache->set($word, $stem);
                $stems[] = $stem;
            }
        }
        return implode(' ', $stems);
    }