20 lines
235 B
Python
20 lines
235 B
Python
import pymorphy3
|
|
|
|
|
|
class Lemmatizer:
|
|
|
|
|
|
def __init__(self):
|
|
|
|
self.morph = pymorphy3.MorphAnalyzer()
|
|
|
|
|
|
|
|
def normalize(
|
|
self,
|
|
word: str
|
|
) -> str:
|
|
|
|
result = self.morph.parse(word)
|
|
|
|
return result[0].normal_form |