You are here

protected function SearchApiPorter2::removeDoubles in Search API 7

Removes certain double consonants from the word's end.

Return value

bool TRUE if a match was found and removed, FALSE otherwise.

1 call to SearchApiPorter2::removeDoubles()
SearchApiPorter2::step1b in includes/processor_stemmer.inc
Handles various suffixes, of which the longest is replaced.

File

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

Class

SearchApiPorter2
Implements the Porter2 stemming algorithm.

Code

protected function removeDoubles() {
  $found = FALSE;
  $doubles = array(
    'bb',
    'dd',
    'ff',
    'gg',
    'mm',
    'nn',
    'pp',
    'rr',
    'tt',
  );
  foreach ($doubles as $double) {
    if (substr($this->word, -2) == $double) {
      $this->word = substr($this->word, 0, -1);
      $found = TRUE;
      break;
    }
  }
  return $found;
}