stem method
Stems word
. Only stems words that are at least 3 characters,
otherwise will return word
.
Implementation
String stem(String word) {
String stem = word.toLowerCase();
if (_pool.containsKey(word)) {
return _pool[word]!;
}
if (word.length <= 2) {
// With this line, strings of length 1 or 2 don't go through
// the stemming process, although no mention is made of this
// in the published algorithm.
return word;
}
stem = _step1a(stem);
stem = _step1b(stem);
stem = _step1c(stem);
stem = _step2(stem);
stem = _step3(stem);
stem = _step4(stem);
stem = _step5a(stem);
stem = _step5b(stem);
return stem;
}