You are here

function porterstemmer_stem in Porter-Stemmer 6.2

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

Stems a word, using the Porter Stemmer 2 algorithm.

Parameters

$word: Word to stem.

Return value

Stemmed word

5 calls to porterstemmer_stem()
PorterStemmerInternalsUnitTest::testStemLength3UnitTest in ./porterstemmer.test
Verify that short words are not stemmed, and longer ones are.
PorterStemmerInternalsUnitTest::testStemLength4UnitTest in ./porterstemmer.test
Verify that short words are not stemmed, and longer ones are.
PorterStemmerOutput1UnitTest::_run_porterstemmer_stem_test in ./porterstemmer.test
Runs a unit test for a portion of words in the test file.
porterstemmer_sbp_excerpt_match in ./porterstemmer.module
Implementation of hook_sbp_excerpt_match().
porterstemmer_search_preprocess in ./porterstemmer.module
Implementation of hook_search_preprocess().

File

./porterstemmer.module, line 178
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_stem($word) {

  // Each of these helper functions returns TRUE if it is time to stop
  // stemming and return. If everything is fine, they modify params by
  // reference, as necessary, for the next function.
  $r1 = 0;

  // position of R1 region in original word
  $r2 = 0;

  // position of R1 region in original word
  porterstemmer_prestemming($word, $r1, $r2) or porterstemmer_exception1($word) or porterstemmer_step0($word) or porterstemmer_step1a($word) or porterstemmer_exception2($word) or porterstemmer_step1b($word, $r1) or porterstemmer_step1c($word) or porterstemmer_step2($word, $r1) or porterstemmer_step3($word, $r1, $r2) or porterstemmer_step4($word, $r2) or porterstemmer_step5($word, $r1, $r2);
  porterstemmer_poststemming($word);
  return $word;
}