protected function Porter2::step3 in Search API 8
Implements step 3 of the Porter2 algorithm.
1 call to Porter2::step3()
- Porter2::stem in src/
Plugin/ search_api/ processor/ Resources/ Porter2.php - Computes the stem of the word.
File
- src/
Plugin/ search_api/ processor/ Resources/ Porter2.php, line 292
Class
- Porter2
- Implements the Porter2 stemming algorithm.
Namespace
Drupal\search_api\Plugin\search_api\processor\ResourcesCode
protected function step3() {
$checks = [
'ational' => 'ate',
'tional' => 'tion',
'alize' => 'al',
'icate' => 'ic',
'iciti' => 'ic',
'ical' => 'ic',
'ness' => '',
'ful' => '',
];
foreach ($checks as $find => $replace) {
if ($this
->hasEnding($find)) {
if ($this
->inR1($find)) {
$this
->removeEnding($find);
$this
->addEnding($replace);
}
return;
}
}
if ($this
->hasEnding('ative')) {
if ($this
->inR2('ative')) {
$this
->removeEnding('ative');
}
}
}