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
string
Word to stem
string
Stemmed wordcvc(string $str) : boolean
string
String to check
boolean
ResultdoubleConsonant(string $str) : boolean
string
String to check
boolean
Resultm(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,
string
The string to return the m count for
integer
The m countreplace(string $str, string $check, string $repl, integer $m = null
) : boolean
string
String to check
string
Ending to check for
string
Replacement string
integer
Optional minimum number of m() to meet
boolean
Whether 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)
string
Word to stem
step2(string $word)
string
Word to stem
step3(string $word)
string
String to stem
step4(string $word)
string
Word to stem
step5(string $word)
string
Word to stem
$regex_consonant : string
'(?:[bcdfghjklmnpqrstvwxz]|(?<=[aeiou])y|^y)'
$regex_vowel : string
'(?:[aeiou]|(?