Make blacklist and whitelist cleaner
This commit is contained in:
@ -19,8 +19,7 @@ def is_word_in_text(words: str, text: str) -> bool:
|
|||||||
for word in word_list:
|
for word in word_list:
|
||||||
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
|
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
|
||||||
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
|
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
|
||||||
matches: re.Match[str] | None = re.search(pattern, text)
|
if re.search(pattern, text):
|
||||||
if matches:
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -19,8 +19,7 @@ def is_word_in_text(words: str, text: str) -> bool:
|
|||||||
for word in word_list:
|
for word in word_list:
|
||||||
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
|
look_for: str = rf"(^|[^\w]){word}([^\w]|$)"
|
||||||
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
|
pattern: re.Pattern[str] = re.compile(look_for, re.IGNORECASE)
|
||||||
matches: re.Match[str] | None = re.search(pattern, text)
|
if re.search(pattern, text):
|
||||||
if matches:
|
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user