function PorterStemmerInternalsUnitTest::testBaked in Porter-Stemmer 7
Same name and namespace in other branches
- 6.2 porterstemmer.test \PorterStemmerInternalsUnitTest::testBaked()
Test internal steps on the word "baked".
File
- ./
porterstemmer.test, line 666 - 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 testBaked() {
variable_set('minimum_word_size', 2);
porterstemmer_too_short('', TRUE);
$r1 = 0;
$r2 = 0;
$word = 'baked';
porterstemmer_prestemming($word, $r1, $r2);
// Test calculation of R1 and R2
$this
->assertEqual($r1, 3, "R1 for baked should be 3, was {$r1}", 'Stemmer steps');
$this
->assertEqual($r2, 5, "R2 for baked should be 5, was {$r2}", 'Stemmer steps');
// Test step 1b of the algorithm
porterstemmer_step1b($word, $r1);
$this
->assertEqual($word, 'bake', "Step1b should be bake, was {$word}", 'Stemmer steps');
// Test step 5 of the algorithm
porterstemmer_step5($word, $r1, $r2);
$this
->assertEqual($word, 'bake', "Step5 should be bake, was {$word}", 'Stemmer steps');
}