average-stabw
This commit is contained in:
parent
773a01cdb1
commit
c9728e14a7
|
@ -92,7 +92,7 @@ async def messages_routing(msg, state):
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
toxic_score = detector(text)
|
toxic_score = detector(normalize(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)
|
||||||
|
|
|
@ -44,8 +44,10 @@ def normalize(text):
|
||||||
"""
|
"""
|
||||||
Normalize English text to resemble Russian characters.
|
Normalize English text to resemble Russian characters.
|
||||||
"""
|
"""
|
||||||
|
t = text.replace(" ", " ").replace(" ", " ").replace(" ", " ")
|
||||||
|
|
||||||
# Segment the text first
|
# Segment the text first
|
||||||
t = segment_text(text.replace(" ", " ").replace(" ", " ").replace(" ", " "))
|
# t = segment_text(t)
|
||||||
|
|
||||||
t = t.lower()
|
t = t.lower()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user