This commit is contained in:
Untone 2024-09-27 13:23:03 +03:00
parent 7e0d4a2811
commit 6d4df35f52
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ from bot.api import telegram_api
from bot.config import FEEDBACK_CHAT_ID from bot.config import FEEDBACK_CHAT_ID
from handlers.handle_private import handle_private from handlers.handle_private import handle_private
from nlp.toxicity_detector import detector from nlp.toxicity_detector import detector
from nlp.normalize import normalize # from nlp.normalize import normalize
logger = logging.getLogger("handlers.messages_routing") logger = logging.getLogger("handlers.messages_routing")
@ -87,7 +87,7 @@ async def messages_routing(msg, state):
except: except:
pass pass
else: else:
toxic_score = detector(normalize(text)) toxic_score = detector(text)
toxic_perc = math.floor(toxic_score * 100) toxic_perc = math.floor(toxic_score * 100)
await redis.set(f"toxic:{cid}", mid) await redis.set(f"toxic:{cid}", mid)
await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3) await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3)

View File

@ -73,7 +73,7 @@ def normalize(text):
) )
return normalized_text return normalized_text
logger.debug('normalized: ', t)
return t return t