ocr-stab5
This commit is contained in:
parent
ba2f57bb6c
commit
19a93d2443
|
@ -113,14 +113,15 @@ async def messages_routing(msg, state):
|
||||||
|
|
||||||
normalized_text = normalize(text)
|
normalized_text = normalize(text)
|
||||||
toxic_score = detector(normalized_text)
|
toxic_score = detector(normalized_text)
|
||||||
toxic_perc = math.floor(toxic_score * 100)
|
toxic_perc = toxic_score * 100
|
||||||
if toxic_score < 0.9 and text != text.replace(' ', ''):
|
logger.info(f'original toxic: {toxic_perc}')
|
||||||
|
if toxic_score < 0.91:
|
||||||
logger.info('re-check without spaces')
|
logger.info('re-check without spaces')
|
||||||
toxic_perc += check_stopwords(normalized_text)
|
toxic_perc += check_stopwords(normalized_text)
|
||||||
logger.info(f"text: {normalized_text}\ntoxic: {toxic_perc}%")
|
logger.info(f"text: {normalized_text}\ntoxic: {toxic_perc}%")
|
||||||
|
|
||||||
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}", math.floor(toxic_perc), ex=60 * 60 * 24 * 3)
|
||||||
if toxic_score > 0.75:
|
if toxic_score > 0.75:
|
||||||
if toxic_score > 0.90:
|
if toxic_score > 0.90:
|
||||||
await redis.set(f"removed:{uid}:{cid}:{mid}", text)
|
await redis.set(f"removed:{uid}:{cid}:{mid}", text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user