function PorterStemmerInternalsUnitTest::testStemLength4UnitTest in Porter-Stemmer 7
Same name and namespace in other branches
- 6.2 porterstemmer.test \PorterStemmerInternalsUnitTest::testStemLength4UnitTest()
Verify that short words are not stemmed, and longer ones are.
File
- ./
porterstemmer.test, line 576 - Tests for the Porter Stemmer module. By Jennifer Hodgdon of Poplar ProductivityWare, www.poplarware.com Unit tests are based on sample words from http://snowball.tartarus.org/algorithms/english/stemmer.html which are stored in a separate file…
Class
- PorterStemmerInternalsUnitTest
- Unit tests for Porter Stemmer - Stemming internals.
Code
function testStemLength4UnitTest() {
// Words 4 letters or less should not be stemmed if min word length is 4
variable_set('minimum_word_size', 4);
porterstemmer_too_short('', TRUE);
$words = array(
'a' => 'a',
'at' => 'at',
'say' => 'say',
'fished' => 'fish',
'saying' => 'saying',
);
foreach ($words as $in => $out) {
$stem = porterstemmer_stem($in);
$this
->assertEqual($out, $stem, "Stemming length 4 test for {$in} gives {$out} (was {$stem})", t('Stemming length'));
}
}