class PorterStemmer extends Stemmer
Copyright 2013 Katharopoulos Angelos <katharas@gmail.com>
This class implements the Porter stemming algorithm. It is almost a
one to one conversion from Porter's ANSI C implementation and can
thus be regarded as canonical as the C implementation found at
http://www.tartarus.org/~martin/PorterStemmer
The rewrite instead of using Richard Heyes's implementation has
been to improve performance. I tried to keep as close to the C
implementation, minimize string creations (change in place) and
avoid regexes.
The result is a bit more than 25% faster algorithm with php 5.3 (not
that much but since I wrote I thought I'd keep it).
Methods
string |
stem($word)
Remove the suffix from $word |
|
array |
stemAll(array $tokens)
Apply the stemmer to every single token. |
from Stemmer |
mixed |
transform($word)
Return the value transformed. |
from Stemmer |
Details
at line 437
public string
stem($word)
Remove the suffix from $word
in Stemmer at line 25
public array
stemAll(array $tokens)
Apply the stemmer to every single token.
in Stemmer at line 34
public mixed
transform($word)
Return the value transformed.