function porterstemmer_exception1 in Porter-Stemmer 7
Same name and namespace in other branches
- 6.2 porterstemmer.module \porterstemmer_exception1()
Checks exceptions for Porter Stemmer.
Parameters
string $word: Word to stem, modified in place if successful.
Return value
bool TRUE if it is time to stop stemming, FALSE to continue.
1 call to porterstemmer_exception1()
- porterstemmer_stem in includes/
standard-stemmer.inc - Stems a word, using the Porter Stemmer 2 algorithm.
File
- includes/
standard-stemmer.inc, line 573 - This is an implementation of the Porter 2 Stemming algorithm.
Code
function porterstemmer_exception1(&$word) {
// Special cases for stemming. Don't add anything in this list that
// is shorter than the minimum allowed length!
$repl = array(
'skis' => 'ski',
'skies' => 'sky',
'dying' => 'die',
'lying' => 'lie',
'tying' => 'tie',
'idly' => 'idl',
'gently' => 'gentl',
'ugly' => 'ugli',
'early' => 'earli',
'only' => 'onli',
'singly' => 'singl',
'sky' => 'sky',
'news' => 'news',
'howe' => 'howe',
'atlas' => 'atlas',
'cosmos' => 'cosmos',
'bias' => 'bias',
'andes' => 'andes',
);
// If our word is in that list, we're done.
if (isset($repl[$word])) {
$word = $repl[$word];
return TRUE;
}
return FALSE;
}