Last active
October 27, 2022 03:31
-
-
Save Abhayparashar31/63a0c3270007ceeb9496cdb0249e2983 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
import nltk | |
nltk.download('stopwords') | |
from nltk.corpus import stopwords | |
english_stopwords = set(stopwords.words('english')) | |
corpus = ['Food is Bad', | |
'Bad Service Bad Food', | |
'Food is Good', | |
'Good Service With Good Food.', | |
'Service is Bad but Food is Good.'] | |
cleaned_corpus = [] | |
for sent in corpus: | |
sent = sent.lower() | |
cleaned_corpus.append(' '.join([word for word in sent.split() if word not in english_stopwords])) | |
print(cleaned_corpus) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment