toxicity-detector
This commit is contained in:
59
nlp/replying.py
Normal file
59
nlp/replying.py
Normal file
@@ -0,0 +1,59 @@
|
||||
# "👍", "👎", "❤", "🔥", "🥰", "👏", "😁",
|
||||
# "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩",
|
||||
# "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱",
|
||||
# "🥴", "😍", "🐳", "❤🔥", "🌚", "🌭", "💯",
|
||||
# "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐",
|
||||
# "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭",
|
||||
# "🤓", "👻", "👨💻", "👀", "🎃", "🙈", "😇",
|
||||
# "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄",
|
||||
# "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉",
|
||||
# "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷♂",
|
||||
# "🤷", "🤷♀", "😡"
|
||||
|
||||
toxic_reactions = {
|
||||
"071": "🕊",
|
||||
"073": "👀",
|
||||
"075": "🙈",
|
||||
"077": "🙊",
|
||||
"079": "💩",
|
||||
"081": "🤔",
|
||||
"083": "😐",
|
||||
"085": "🤨",
|
||||
"087": "🥴",
|
||||
"089": "🤯",
|
||||
"091": "😢",
|
||||
"093": "😭",
|
||||
"095": "😨",
|
||||
"097": "😱",
|
||||
"099": "🤬"
|
||||
}
|
||||
|
||||
grads = list(toxic_reactions.keys())
|
||||
grads.sort()
|
||||
grads.reverse()
|
||||
|
||||
abusive_reactions = {
|
||||
"085": "🫡",
|
||||
"088": "💅",
|
||||
"091": "🤷♀",
|
||||
"094": "👾",
|
||||
"097": "👻",
|
||||
"099": "😈"
|
||||
}
|
||||
|
||||
abusive_grads = list(abusive_reactions.keys())
|
||||
abusive_grads.sort()
|
||||
abusive_grads.reverse()
|
||||
|
||||
def get_toxic_reply(tx):
|
||||
percentage = tx * 100
|
||||
for key in grads:
|
||||
if percentage > int(key):
|
||||
return toxic_reactions[key]
|
||||
|
||||
|
||||
def get_abusive_reply(tx):
|
||||
percentage = tx * 100
|
||||
for key in abusive_grads:
|
||||
if percentage > int(key):
|
||||
return abusive_reactions[key]
|
Reference in New Issue
Block a user