You are here

protected function SearchApiPorter2::step3 in Search API 7

Implements step 3 of the Porter2 algorithm.

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

File

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

Class

SearchApiPorter2
Implements the Porter2 stemming algorithm.

Code

protected function step3() {
  $checks = array(
    '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');
    }
  }
}