You are here

public function Porter2::stem in Search API 8

Computes the stem of the word.

Return value

string The word's stem.

File

src/Plugin/search_api/processor/Resources/Porter2.php, line 95

Class

Porter2
Implements the Porter2 stemming algorithm.

Namespace

Drupal\search_api\Plugin\search_api\processor\Resources

Code

public function stem() {

  // Ignore exceptions & words that are two letters or less.
  if ($this
    ->exceptions() || $this
    ->length() <= 2) {
    return strtolower($this->word);
  }
  else {
    $this
      ->step0();
    $this
      ->step1a();
    $this
      ->step1b();
    $this
      ->step1c();
    $this
      ->step2();
    $this
      ->step3();
    $this
      ->step4();
    $this
      ->step5();
  }
  return strtolower($this->word);
}