Articles → NLP → Stop Words In NLP
Stop Words In NLP
What Are Stop Words?
Example
from nltk.corpus import stopwords
# Get English stopwords
stop_words = set(stopwords.words('english'))
print(len(stop_words)) # Number of stopwords
print(list(stop_words)[:20]) # First 20 stopwords
Output
How To Remove Stop Words?
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
stop_words = set(stopwords.words('english'))
sentence = "This is an example showing off stopwords removal in NLP."
words = word_tokenize(sentence)
filtered = [w for w in words if w.lower() not in stop_words]
print("Original:", words)
print("Without stopwords:", filtered)
Posted By - | Karan Gupta |
|
Posted On - | Friday, August 29, 2025 |