deleted container.py and fix detector
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
from app.moderation.profanity.detector import ProfanityDetector
|
|
||||||
from app.moderation.profanity.dictionary import ProfanityDictionary
|
|
||||||
from app.moderation.profanity.lemmatizer import Lemmatizer
|
|
||||||
|
|
||||||
dictionary = ProfanityDictionary(
|
|
||||||
"app/resources/profanity_words.txt"
|
|
||||||
)
|
|
||||||
|
|
||||||
lemmatizer = Lemmatizer()
|
|
||||||
|
|
||||||
profanity_detector = ProfanityDetector(
|
|
||||||
dictionary,
|
|
||||||
lemmatizer
|
|
||||||
)
|
|
||||||
@@ -33,7 +33,7 @@ class ProfanityDetector:
|
|||||||
|
|
||||||
for bad_word in self.dictionary.words:
|
for bad_word in self.dictionary.words:
|
||||||
|
|
||||||
if lemma.startswith(bad_word):
|
if lemma == bad_word or lemma.startswith(bad_word + "-"):
|
||||||
|
|
||||||
result.append(word)
|
result.append(word)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user