stopwords-+40

This commit is contained in:
Untone 2024-09-29 10:21:23 +03:00
parent d113674012
commit 6fffea0df4

View File

@ -16,12 +16,10 @@ def check_stopwords(text):
Returns: Returns:
bool: True if any stopword is found in the text, False otherwise. bool: True if any stopword is found in the text, False otherwise.
""" """
# Normalize the text by converting it to lower case and splitting into words
words = text.replace(' ', '').lower().split()
# Iterate through each word and check for stopwords # Iterate through each word and check for stopwords
for word in words: for word in stopword_set:
if word in stopword_set: if word in text:
return True # Stop iteration and return True if a stopword is found return True # Stop iteration and return True if a stopword is found
return False # Return False if no stopwords are found return False # Return False if no stopwords are found