function porterstemmer_stem in Porter-Stemmer 7
Same name and namespace in other branches
- 6.2 porterstemmer.module \porterstemmer_stem()
Stems a word, using the Porter Stemmer 2 algorithm.
Parameters
string $word: Word to stem.
Return value
string 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 - Implements hook_sbp_excerpt_match().
- porterstemmer_search_preprocess in ./
porterstemmer.module - Implements hook_search_preprocess().
File
- includes/
standard-stemmer.inc, line 45 - This is an implementation of the Porter 2 Stemming algorithm.
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.
// Position of R1 region in original word.
$r1 = 0;
// Position of R1 region in original word.
$r2 = 0;
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;
}