You are here

protected static function Porter2::step0 in Porter-Stemmer 8

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

Parameters

string $word: The word to stem.

Return value

string The modified word.

1 call to Porter2::step0()
Porter2::stem in src/Porter2.php
Computes the stem of the word.

File

src/Porter2.php, line 92

Class

Porter2
PHP Implementation of the Porter2 Stemming Algorithm.

Namespace

Drupal\porterstemmer

Code

protected static function step0($word) {
  $found = FALSE;
  $checks = [
    "'s'",
    "'s",
    "'",
  ];
  foreach ($checks as $check) {
    if (!$found && self::hasEnding($word, $check)) {
      $word = self::removeEnding($word, $check);
      $found = TRUE;
    }
  }
  return $word;
}