From d113674012cc3bd52effa4e4771eaecebaf59da6 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 29 Sep 2024 10:17:29 +0300 Subject: [PATCH] nosegm8 --- handlers/messages_routing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 22718eb..0d4b3eb 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -113,10 +113,10 @@ async def messages_routing(msg, state): normalized_text = normalize(text) toxic_score = detector(normalized_text) toxic_perc = math.floor(toxic_score * 100) - logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%") - if text !== text.replace(' ', '') and check_stopwords(normalized_text): + if toxic_score < 0.9 and text != text.replace(' ', '') and check_stopwords(normalized_text): logger.info('stopword detected without spaces, toxicity +40%') toxic_perc += 40 + logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%") await redis.set(f"toxic:{cid}", mid) await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3)