You are here

protected function SearchApiPorter2::step5 in Search API 7

Implements step 5 of the Porter2 algorithm.

1 call to SearchApiPorter2::step5()
SearchApiPorter2::stem in includes/processor_stemmer.inc
Computes the stem of the word.

File

includes/processor_stemmer.inc, line 442
Contains SearchApiPorterStemmer and SearchApiPorter2.

Class

SearchApiPorter2
Implements the Porter2 stemming algorithm.

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');
    }
  }
}