protected function Porter2::step4 in Search API 8
Implements step 4 of the Porter2 algorithm.
1 call to Porter2::step4()
- 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 322
Class
- Porter2
- Implements the Porter2 stemming algorithm.
Namespace
Drupal\search_api\Plugin\search_api\processor\ResourcesCode
protected function step4() {
$checks = [
'ement',
'ment',
'ance',
'ence',
'able',
'ible',
'ant',
'ent',
'ion',
'ism',
'ate',
'iti',
'ous',
'ive',
'ize',
'al',
'er',
'ic',
];
foreach ($checks as $check) {
// Among the suffixes, if found and in R2, delete.
if ($this
->hasEnding($check)) {
if ($this
->inR2($check)) {
if ($check !== 'ion' || in_array($this
->charAt(-4), [
's',
't',
])) {
$this
->removeEnding($check);
}
}
return;
}
}
}