diff --git a/plugins/StemWord/StemWord.php b/plugins/StemWord/StemWord.php new file mode 100644 index 0000000000..899e8ac529 --- /dev/null +++ b/plugins/StemWord/StemWord.php @@ -0,0 +1,37 @@ +. + +// }}} + +namespace Plugin\StemWord; + +use App\Core\Event; +use App\Core\Modules\Plugin; +use Wamania\Snowball\StemmerFactory; + +class StemWord extends Plugin +{ + public function onStemWord(string $language, string $word, string &$out) + { + $out = StemmerFactory::create($language)->stem($word); + return Event::stop; + } +} diff --git a/plugins/StemWord/composer.json b/plugins/StemWord/composer.json new file mode 100644 index 0000000000..4c472d8bdf --- /dev/null +++ b/plugins/StemWord/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "wamania/php-stemmer": "^3.0" + } +}