This commit is contained in:
Untone 2024-09-29 10:16:29 +03:00
parent 1cd21b5026
commit 2344928934

View File

@ -114,8 +114,8 @@ async def messages_routing(msg, state):
toxic_score = detector(normalized_text)
toxic_perc = math.floor(toxic_score * 100)
logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%")
if len(text) != len(normalized_text) and check_stopwords(normalized_text):
logger.info('stopword detected with no spaces, toxicity +40%')
if text !== text.replace(' ', '') and check_stopwords(normalized_text):
logger.info('stopword detected without spaces, toxicity +40%')
toxic_perc += 40
await redis.set(f"toxic:{cid}", mid)