forked from wait-what/is-furry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathis_furry.py
32 lines (26 loc) · 976 Bytes
/
is_furry.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import re
expressions = \
{
'True':
{
r"\b(owo|uwu)\b",
r"\b[oо0u🇴🇺]+[w🇼]+[oо0u🇴🇺]+\b",
r"\b[oо0>u🇴🇺^]+[\s.,*_-`\\]*[w3🇼]+[\s,.*_-`\\]*[oо0^<u🇴🇺]\b"
},
'False':
{
r"(owo|uwu)",
r"[oо0u🇴🇺]+[w🇼]+[oо0u🇴🇺]",
r"[oо0>u🇴🇺^]+[\s.,*_-`\\]*[w3🇼]+[\s,.*_-`\\]*[oо0^<u🇴🇺]"
}
}
def evaluate(message: str, word_boundaries: bool = False) -> bool:
"""Returns True if the message contains an OwO-like expression.
:param word_boundaries: enable/disable boundary checks
:param message: message to be evaluated
:return: True if the message contains an 'owo'-like expression
"""
for expression in expressions[str(word_boundaries)]:
if re.search(expression, message, re.IGNORECASE):
return True
return False