FunctionStemmer#

class scikitplot.corpus.FunctionStemmer(fn, name='custom')[source]#

Wrap any Callable[[str], str] as a StemmerProtocol.

Parameters:
fnCallable[[str], str]

Stemming function; takes a single word, returns its stem.

namestr, optional

Human-readable name.

Parameters:

Examples

>>> st = FunctionStemmer(lambda w: w[:4] if len(w) > 4 else w)
>>> st.stem("running")
'runn'
stem(word)[source]#

Stem word.

Parameters:
wordstr

Input word.

Returns:
str

Stemmed form.

Parameters:

word (str)

Return type:

str