masroore/php-stemmer

Native PHP Stemmer

v3.0.1 2022-06-12 14:13 UTC

This package is auto-updated.

Last update: 2024-11-12 19:46:00 UTC


README

PHP native implementation of Snowball stemmer https://snowballstem.org/

Accept only UTF-8

Languages

Available :

  • Catalan (by Orestes Sanchez Benavente orestes@estotienearreglo.es)
  • Danish
  • Dutch
  • English
  • Finnish (by Mikko Saari)
  • French
  • German
  • Italian
  • Norwegian
  • Portuguese
  • Romanian
  • Russian
  • Spanish
  • Swedish

Installation

Requires PHP 8.0+

You can install the package via composer:

composer require masroore/php-stemmer

Usage

use Kaiju\Snowball\StemmerFactory;

// use ISO_639 (2 or 3 letters) or language name in english
$stemmer = StemmerFactory::create('fr');
$stemmer = StemmerFactory::create ('spanish');

// then 
$stem = $stemmer->stem('automóvil');

Or the manager

use Kaiju\Snowball\StemmerManager;

$manager = new StemmerManager();
$stem = $manager->stem('automóvil', 'es');