cii-text-analysis/vendor/yooper/php-text-analysis/tests/TextAnalysis/Stemmers/DictionaryStemmerTest.php
Jéremy Munsch f68d2ac333
premier poc
2026-02-11 08:24:04 +01:00

28 lines
800 B
PHP
Executable file

<?php
namespace Tests\TextAnalysis\Stemmers;
use TextAnalysis\Adapters\PspellAdapter;
use TextAnalysis\Stemmers\DictionaryStemmer;
use TextAnalysis\Stemmers\RegexStemmer;
/**
*
* @author yooper
*/
class DictionaryStemmerTest extends \PHPUnit\Framework\TestCase
{
public function testPspell()
{
if( getenv('SKIP_TEST') || !extension_loaded('stem')) {
return;
}
$stemmer = new DictionaryStemmer(new PspellAdapter(), new RegexStemmer('ing$|s$|e$', 4));
$this->assertEquals("judge", $stemmer->stem("judges"));
// some times approach does not work
$this->assertEquals('university', $stemmer->stem("universities"));
$this->assertEquals('hammock', $stemmer->stem("hammok"));
}
}