From 6385d48d7c7b703b8d49080c15c47ccf5a4fa7e1 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 29 Sep 2024 08:23:28 +0300 Subject: [PATCH] recheck-fix --- handlers/messages_routing.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 6755c29..953455d 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -114,13 +114,12 @@ async def messages_routing(msg, state): toxic_score = detector(segmented_text) toxic_perc = math.floor(toxic_score * 100) - if toxic_perc > 49: - logger.info('re-check this one...') - nospaces_text = text.replace(' ', '') - nospaces_text_score = detector(nospaces_text) - logger.info(f'no spaces text toxic: {nospaces_text_score}') - if nospaces_text_score > toxic_score: - toxic_score = nospaces_text + 10 + logger.info('re-check this one...') + nospaces_text = text.replace(' ', '') + nospaces_text_score = detector(nospaces_text) + logger.info(f'no spaces text toxic: {nospaces_text_score}') + if nospaces_text != text and nospaces_text_score > toxic_score: + toxic_score = nospaces_text + 10 await redis.set(f"toxic:{cid}", mid) await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3)