You are here

function porterstemmer_step3 in Porter-Stemmer 7

Same name and namespace in other branches
  1. 6.2 porterstemmer.module \porterstemmer_step3()

Step 3 of algorithm: misc endings in region R1.

Parameters

string $word: Word to stem, modified in place if successful.

int $r1: Position of start of R1 region in word.

int $r2: Position of start of R2 region in word.

Return value

bool TRUE if it is time to stop stemming, FALSE to continue.

1 call to porterstemmer_step3()
porterstemmer_stem in includes/standard-stemmer.inc
Stems a word, using the Porter Stemmer 2 algorithm.

File

includes/standard-stemmer.inc, line 473
This is an implementation of the Porter 2 Stemming algorithm.

Code

function porterstemmer_step3(&$word, $r1, $r2) {
  $tmp = $word;
  $didit = FALSE;
  porterstemmer_suffix($tmp, 'ational', 'ate', $didit, NULL, $r1 + 7) or porterstemmer_suffix($tmp, 'tional', 'tion', $didit, NULL, $r1 + 6) or porterstemmer_suffix($tmp, 'alize', 'al', $didit, NULL, $r1 + 5) or porterstemmer_suffix($tmp, 'ative', '', $didit, NULL, $r2 + 5) or porterstemmer_suffix($tmp, 'icate', 'ic', $didit, NULL, $r1 + 5) or porterstemmer_suffix($tmp, 'iciti', 'ic', $didit, NULL, $r1 + 5) or porterstemmer_suffix($tmp, 'ical', 'ic', $didit, NULL, $r1 + 4) or porterstemmer_suffix($tmp, 'ness', '', $didit, NULL, $r1 + 4) or porterstemmer_suffix($tmp, 'ful', '', $didit, NULL, $r1 + 3);
  return porterstemmer_step_ending($word, $tmp);
}