diff --git a/handlers/messages_routing.py b/handlers/messages_routing.py index 18f7369..22718eb 100644 --- a/handlers/messages_routing.py +++ b/handlers/messages_routing.py @@ -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)