/** * Detects "short" words. * * @param string $word * @return void * @author John Anderson * @see http://snowball.tartarus.org/algorithms/english/stemmer.html */ public static function isShort($word) { //Should end on a short syllable $suffixes = Stemmer::getShortSyllables($word); if (!count($suffixes)) { return false; } $matches = false; foreach ($suffixes as $suffix) { if (substr($word, -strlen($suffix)) == $suffix) { $matches = true; } } if (!$matches) { return false; } //R1 should also be empty return !Stemmer::getR1($word); }