log-rechecked3
This commit is contained in:
parent
aa684102d9
commit
35823c43a0
|
@ -113,18 +113,19 @@ async def messages_routing(msg, state):
|
|||
segmented_text = segment_text(normalized_text)
|
||||
toxic_score = detector(segmented_text)
|
||||
toxic_perc = math.floor(toxic_score * 100)
|
||||
logger.info(f"\ntext: {text}\ntoxic: {toxic_perc}%")
|
||||
|
||||
nospaces_text = text.replace(' ', '')
|
||||
logger.info(f're-check this one: {nospaces_text}')
|
||||
nospaces_text_score = detector(nospaces_text)
|
||||
nospaces_text_perc = math.floor(toxic_score * 100)
|
||||
logger.info(f'no spaces text toxic: {nospaces_text_perc}%')
|
||||
|
||||
if (nospaces_text != text and nospaces_text_score > toxic_score) or nospaces_text_perc > 95:
|
||||
text_perc = nospaces_text_perc
|
||||
|
||||
await redis.set(f"toxic:{cid}", mid)
|
||||
await redis.set(f"toxic:{cid}:{uid}:{mid}", toxic_perc, ex=60 * 60 * 24 * 3)
|
||||
logger.info(f"\ntext: {text}\ntoxic: {toxic_perc}%")
|
||||
if toxic_score > 0.81:
|
||||
if toxic_score > 0.90:
|
||||
await redis.set(f"removed:{uid}:{cid}:{mid}", text)
|
||||
|
|
Loading…
Reference in New Issue
Block a user