From 6fffea0df4dfad59bbacf3f7b9a8a7b35e1ff587 Mon Sep 17 00:00:00 2001 From: Untone Date: Sun, 29 Sep 2024 10:21:23 +0300 Subject: [PATCH] stopwords-+40 --- nlp/stopwords_detector.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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