LemmatizerProtocol#

class scikitplot.corpus.LemmatizerProtocol(*args, **kwargs)[source]#

Structural protocol for word lemmatizers.

The pos parameter is optional context (part-of-speech tag). Implementations that do not use pos can ignore it.

Examples

>>> class MyLemma:
...     def lemmatize(self, word: str, pos: str = None) -> str:
...         return word.lower()
>>> isinstance(MyLemma(), LemmatizerProtocol)
True
lemmatize(word, pos=None)[source]#

Return the lemma of word.

Parameters:
wordstr

Input word.

posstr, optional

Part-of-speech hint (e.g. "n" for noun, "v" for verb).

Returns:
str

Lemma form.

Parameters:
Return type:

str