added image ai-moderation
This commit is contained in:
20
ai-moderation/app/moderation/profanity/lemmatizer.py
Normal file
20
ai-moderation/app/moderation/profanity/lemmatizer.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user