function PorterStemmerInternalsUnitTest::testShortWord in Porter-Stemmer 7
Same name and namespace in other branches
- 6.2 porterstemmer.test \PorterStemmerInternalsUnitTest::testShortWord()
Tests the function that determines if a word is "short".
File
- ./
porterstemmer.test, line 598 - 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 testShortWord() {
// Test "shortness", using examples from algorithm web page,
// as well as several variations on the word "administ...".
variable_set('minimum_word_size', 2);
porterstemmer_too_short('', TRUE);
$this
->assertFalse(porterstemmer_short_word('administered', 2, 'Stemmer steps'), "administered should not be a short word");
$this
->assertFalse(porterstemmer_short_word('administer', 2, 'Stemmer steps'), "administer should not be a short word");
$this
->assertFalse(porterstemmer_short_word('admin', 2, 'Stemmer steps'), "admin should not be a short word");
$this
->assertTrue(porterstemmer_short_word('bed', 3, 'Stemmer steps'), "bed should be a short word");
$this
->assertTrue(porterstemmer_short_word('shed', 4, 'Stemmer steps'), "shed should be a short word");
$this
->assertTrue(porterstemmer_short_word('shred', 5, 'Stemmer steps'), "shred should be a short word");
$this
->assertFalse(porterstemmer_short_word('bead', 4, 'Stemmer steps'), "bead should not be a short word");
$this
->assertFalse(porterstemmer_short_word('beds', 3, 'Stemmer steps'), "beds should not be a short word");
$this
->assertFalse(porterstemmer_short_word('bake', 3, 'Stemmer steps'), "bake should not be a short word");
$this
->assertTrue(porterstemmer_short_word('bak', 3, 'Stemmer steps'), "bak should be a short word");
}