stopwords-+40--2
This commit is contained in:
parent
ad0ad2febe
commit
45f3774a1e
|
@ -115,10 +115,13 @@ async def messages_routing(msg, state):
|
|||
toxic_score = detector(normalized_text)
|
||||
toxic_perc = math.floor(toxic_score * 100)
|
||||
if toxic_score < 0.9 and text != text.replace(' ', ''):
|
||||
logger.info('check without spaces')
|
||||
if check_stopwords(normalized_text.replace(' ', '')):
|
||||
logger.info('stopword detected without spaces, toxicity +40%')
|
||||
toxic_perc += 40
|
||||
logger.info(f"\text: {normalized_text}\ntoxic: {toxic_perc}%")
|
||||
else:
|
||||
logger.info('ok')
|
||||
logger.info(f"text: {normalized_text}\ntoxic: {toxic_perc}%")
|
||||
|
||||
await redis.set(f"toxic:{cid}", mid)
|
||||
await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3)
|
||||
|
|
Loading…
Reference in New Issue
Block a user