protected function SearchApiPorter2::step2 in Search API 7
Implements step 2 of the Porter2 algorithm.
1 call to SearchApiPorter2::step2()
- SearchApiPorter2::stem in includes/
processor_stemmer.inc - Computes the stem of the word.
File
- includes/
processor_stemmer.inc, line 330 - Contains SearchApiPorterStemmer and SearchApiPorter2.
Class
- SearchApiPorter2
- Implements the Porter2 stemming algorithm.
Code
protected function step2() {
$checks = array(
"ization" => "ize",
"iveness" => "ive",
"fulness" => "ful",
"ational" => "ate",
"ousness" => "ous",
"biliti" => "ble",
"tional" => "tion",
"lessli" => "less",
"fulli" => "ful",
"entli" => "ent",
"ation" => "ate",
"aliti" => "al",
"iviti" => "ive",
"ousli" => "ous",
"alism" => "al",
"abli" => "able",
"anci" => "ance",
"alli" => "al",
"izer" => "ize",
"enci" => "ence",
"ator" => "ate",
"bli" => "ble",
"ogi" => "og",
);
foreach ($checks as $find => $replace) {
if ($this
->hasEnding($find)) {
if ($this
->inR1($find)) {
$this
->removeEnding($find);
$this
->addEnding($replace);
}
return;
}
}
if ($this
->hasEnding('li')) {
if ($this
->length() > 4 && $this
->validLi($this
->charAt(-3))) {
$this
->removeEnding('li');
}
}
}