nonorm
This commit is contained in:
parent
7e0d4a2811
commit
6d4df35f52
|
@ -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)
|
||||||
|
|
|
@ -73,7 +73,7 @@ def normalize(text):
|
||||||
)
|
)
|
||||||
|
|
||||||
return normalized_text
|
return normalized_text
|
||||||
|
logger.debug('normalized: ', t)
|
||||||
return t
|
return t
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user