diff --git a/nlp/stopwords_detector.py b/nlp/stopwords_detector.py index ac8085b..968bf58 100644 --- a/nlp/stopwords_detector.py +++ b/nlp/stopwords_detector.py @@ -16,12 +16,10 @@ def check_stopwords(text): Returns: 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 - for word in words: - if word in stopword_set: + for word in stopword_set: + if word in text: return True # Stop iteration and return True if a stopword is found return False # Return False if no stopwords are found