You are here

function porterstemmer_step4 in Porter-Stemmer 7

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

Step 4 of algorithm: misc endings in region R2.

Parameters

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

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

Return value

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

2 calls to porterstemmer_step4()
PorterStemmerInternalsUnitTest::testAdministered in ./porterstemmer.test
Test internal steps on the word "administered".
porterstemmer_stem in includes/standard-stemmer.inc
Stems a word, using the Porter Stemmer 2 algorithm.

File

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

Code

function porterstemmer_step4(&$word, $r2) {
  $tmp = $word;
  $didit = FALSE;
  porterstemmer_suffix($tmp, 'ement', '', $didit, NULL, $r2 + 5) or porterstemmer_suffix($tmp, 'able', '', $didit, NULL, $r2 + 4) or porterstemmer_suffix($tmp, 'ance', '', $didit, NULL, $r2 + 4) or porterstemmer_suffix($tmp, 'ence', '', $didit, NULL, $r2 + 4) or porterstemmer_suffix($tmp, 'ible', '', $didit, NULL, $r2 + 4) or porterstemmer_suffix($tmp, 'ment', '', $didit, NULL, $r2 + 4) or porterstemmer_suffix($tmp, 'ant', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ate', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ent', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ion', '', $didit, '/[st]ion$/', $r2 + 3) or porterstemmer_suffix($tmp, 'ism', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'iti', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ive', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ize', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'ous', '', $didit, NULL, $r2 + 3) or porterstemmer_suffix($tmp, 'al', '', $didit, NULL, $r2 + 2) or porterstemmer_suffix($tmp, 'er', '', $didit, NULL, $r2 + 2) or porterstemmer_suffix($tmp, 'ic', '', $didit, NULL, $r2 + 2);
  return porterstemmer_step_ending($word, $tmp);
}