stopwords-+40--

This commit is contained in:
Untone 2024-09-29 10:25:09 +03:00
parent c8582b8ac8
commit ad0ad2febe

View File

@ -115,7 +115,7 @@ async def messages_routing(msg, state):
toxic_score = detector(normalized_text) toxic_score = detector(normalized_text)
toxic_perc = math.floor(toxic_score * 100) toxic_perc = math.floor(toxic_score * 100)
if toxic_score < 0.9 and text != text.replace(' ', ''): if toxic_score < 0.9 and text != text.replace(' ', ''):
if check_stopwords(normalized_text): if check_stopwords(normalized_text.replace(' ', '')):
logger.info('stopword detected without spaces, toxicity +40%') logger.info('stopword detected without spaces, toxicity +40%')
toxic_perc += 40 toxic_perc += 40
logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%") logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%")