function porterstemmer_too_short in Porter-Stemmer 6.2
Same name and namespace in other branches
- 7 includes/standard-stemmer.inc \porterstemmer_too_short()
Returns TRUE if word is too short to continue stemming.
10 calls to porterstemmer_too_short()
- PorterStemmerInternalsUnitTest::testAdministered in ./
porterstemmer.test - Test internal steps on the word "administered".
- PorterStemmerInternalsUnitTest::testBaked in ./
porterstemmer.test - Test internal steps on the word "baked".
- PorterStemmerInternalsUnitTest::testGeology in ./
porterstemmer.test - Test internal steps on the word "geology".
- PorterStemmerInternalsUnitTest::testIesIed in ./
porterstemmer.test - Test internal steps on the words "ies" and "ied".
- PorterStemmerInternalsUnitTest::testShortWord in ./
porterstemmer.test - Tests the function that determines if a word is "short".
File
- ./
porterstemmer.module, line 204 - 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_too_short($word, $reset = FALSE) {
static $min_chars = 0;
if (!$min_chars || $reset) {
// Get Search module's idea of minimum characters
$min_chars = intval(variable_get('minimum_word_size', 3));
// Porter algorithm cannot handle less than 2 characters
if ($min_chars < 2) {
$min_chars = 2;
}
}
if (drupal_strlen($word) < $min_chars) {
return TRUE;
}
return FALSE;
}