PHP5 Implementation of the Porter Stemmer algorithm. Certain elements were borrowed from the (broken) implementation by Jon Abernathy.
Usage:
$stem = PorterStemmer::Stem($word);
How easy is that?
| package | core |
|---|
stem(string $word) : string
stringWord to stem
stringStemmed wordcvc(string $str) : boolean
stringString to check
booleanResultdoubleConsonant(string $str) : boolean
stringString to check
booleanResultm(string $str) : integer
m() measures the number of consonant sequences in $str. if c is a consonant sequence and v a vowel sequence, and <..> indicates arbitrary presence,
stringThe string to return the m count for
integerThe m countreplace(string $str, string $check, string $repl, integer $m = null) : boolean
stringString to check
stringEnding to check for
stringReplacement string
integerOptional minimum number of m() to meet
booleanWhether the $check string was at the end
of the $str string. True does not necessarily mean
that it was replaced.step1ab($word)
step1c(string $word)
stringWord to stem
step2(string $word)
stringWord to stem
step3(string $word)
stringString to stem
step4(string $word)
stringWord to stem
step5(string $word)
stringWord to stem
$regex_consonant : string
'(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)'$regex_vowel : string
'(?:[aeiou]|(?