From c8582b8ac8b1c48797aaa2fab9f2fc3a19c30bc2 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 29 Sep 2024 10:24:03 +0300 Subject: [PATCH] stopwords-+40 --- handlers/messages_routing.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 0d4b3eb..176a193 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -111,11 +111,13 @@ async def messages_routing(msg, state): text += '\n' normalized_text = normalize(text) + logger.info(f'noramalized: {normalized_text}') toxic_score = detector(normalized_text) toxic_perc = math.floor(toxic_score * 100) - 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 + if toxic_score < 0.9 and text != text.replace(' ', ''): + if 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)