You are here

function porterstemmer_step3 in Porter-Stemmer 6.2

Same name and namespace in other branches
  1. 7 includes/standard-stemmer.inc \porterstemmer_step3()

Step 3 of algorithm: misc endings in region R1.

Parameters

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

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

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

Return value

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

1 call to porterstemmer_step3()
porterstemmer_stem in ./porterstemmer.module
Stems a word, using the Porter Stemmer 2 algorithm.

File

./porterstemmer.module, line 600
This is an implementation of the Porter 2 Stemming algorithm from http://snowball.tartarus.org/algorithms/english/stemmer.html by Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com

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);
}