In [3]:
from nltk.tokenize import word_tokenize, sent_tokenize
sample_sentence="Hi I am Learning NLP with Itronix Solutions"
a=word_tokenize(sample_sentence)
print(a)
['Hi', 'I', 'am', 'Learning', 'NLP', 'with', 'Itronix', 'Solutions']
In [4]:
from nltk.corpus import stopwords
stop_words=set(stopwords.words("english"))
print(stop_words)
for word in a:
if word not in stop_words:
print(word,end=" ")
{'she', 'into', 'were', 'more', 'with', "hasn't", 'won', 'some', 'couldn', 'wouldn', 'her', 'what', "haven't", 'o', 'mightn', 'mustn', 'he', 'in', 'not', 'those', 'up', 'wasn', 'yours', 'haven', 'it', 'weren', 'hers', 'why', 'by', "you're", 'as', 'then', 'over', 'are', 'have', 'during', 'don', 'them', 'how', 'such', 'but', 'ourselves', 'y', 'itself', 'did', 'now', "mustn't", 'being', 'only', 'after', 'theirs', 'than', "shouldn't", 'you', 'the', 'll', 'very', "you've", 'its', 'no', 'off', 'while', 'their', 'herself', 'that', 'under', 'needn', 'my', 'or', 'when', 'be', 'above', 'until', 'him', 'below', 'again', "didn't", 'doesn', "shan't", 'should', 'we', 'at', 'myself', 'against', 'hadn', "aren't", 'your', 'which', 'further', "should've", 'here', 'whom', 'aren', 'am', "isn't", 'too', "she's", 'has', 'isn', "weren't", 'can', 'm', 'any', 'before', 'his', 'where', 'few', 'was', 'an', 'both', 'does', 'who', "couldn't", 'of', 'same', 'had', 'shouldn', 'out', 'd', 'because', "mightn't", 'on', "it's", 're', 'just', 'doing', 'other', "you'll", 'a', "wouldn't", 'between', 'there', 'shan', "doesn't", "wasn't", "won't", "you'd", 'each', 'do', 'most', 'to', 'himself', 'our', 'all', 's', 'didn', "hadn't", 'yourselves', 'nor', "don't", 'about', 'down', 'they', 'hasn', 'through', 'yourself', 'i', 'me', 'will', "that'll", 't', 'themselves', 'this', 've', 'ours', 'once', 'from', 'having', "needn't", 'these', 'for', 'so', 'ain', 'ma', 'if', 'own', 'been', 'is', 'and'} Hi I Learning NLP Itronix Solutions
In [ ]: