You are here

protected function Porter2::step0 in Search API 8

Searches for the longest among the "s" suffixes and removes it.

Implements step 0 of the Porter2 algorithm.

1 call to Porter2::step0()
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 134

Class

Porter2
Implements the Porter2 stemming algorithm.

Namespace

Drupal\search_api\Plugin\search_api\processor\Resources

Code

protected function step0() {
  $found = FALSE;
  $checks = [
    "'s'",
    "'s",
    "'",
  ];
  foreach ($checks as $check) {
    if (!$found && $this
      ->hasEnding($check)) {
      $this
        ->removeEnding($check);
      $found = TRUE;
    }
  }
}