You are here

protected function Porter2::step5 in Search API 8

Implements step 5 of the Porter2 algorithm.

1 call to Porter2::step5()
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 359

Class

Porter2
Implements the Porter2 stemming algorithm.

Namespace

Drupal\search_api\Plugin\search_api\processor\Resources

Code

protected function step5() {
  if ($this
    ->hasEnding('e')) {

    // Delete if in R2, or in R1 and not preceded by a short syllable.
    if ($this
      ->inR2('e') || $this
      ->inR1('e') && !$this
      ->isShortSyllable($this
      ->length() - 3)) {
      $this
        ->removeEnding('e');
    }
    return;
  }
  if ($this
    ->hasEnding('l')) {

    // Delete if in R2 and preceded by l.
    if ($this
      ->inR2('l') && $this
      ->charAt(-2) == 'l') {
      $this
        ->removeEnding('l');
    }
  }
}