Created
August 30, 2024 06:21
-
-
Save saimadhu-polamuri/a04fdee5d406ca20d3df9de40e60b36d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Preprocess text | |
def preprocess_text(text): | |
# Remove stop words stop_words = set(stopwords.words("english")) | |
words = word_tokenize(text.lower()) | |
filtered_words = [word for word in words if word not in stop_words] | |
return " ".join(filtered_words) | |
data["preprocessed_text"] = data["text"].apply(preprocess_text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment