NlpTools API
Class

NlpTools\Stemmers\RegexStemmer

class RegexStemmer extends Stemmer

This stemmer removes affixes according to a regular expression.

Methods

string stem($word)

Remove the suffix from $word

array stemAll(array $tokens)

Apply the stemmer to every single token.

from Stemmer
mixed transform($word)

Return the value transformed.

from Stemmer
__construct(string $regexstr, integer $min)

Details

at line 24
public string stem($word)

Remove the suffix from $word

Parameters

$word

Return Value

string

in Stemmer at line 25
public array stemAll(array $tokens)

Apply the stemmer to every single token.

Parameters

array $tokens

Return Value

array

in Stemmer at line 34
public mixed transform($word)

Return the value transformed.

Parameters

$word

Return Value

mixed

at line 18
public __construct(string $regexstr, integer $min)

Parameters

string $regexstr The regex that will be passed to preg_replace
integer $min Do nothing for tokens smaller than $min length