Articles → SPACY → Stop-Words In Spacy

Stop-Words In Spacy






What Are Stop Words?





Example


import spacy
from spacy.lang.en.stop_words import STOP_WORDS

# Convert set → sorted list
stop_words_list = sorted(list(STOP_WORDS))

# Print top 10 stop words
print(stop_words_list[:10])



Output


Picture showing the list of top 10 stop words



How To Add And Remove The Stop Word From The Spacy Stop Word List?




import spacy
nlp = spacy.load("en_core_web_sm")

print("Before adding apple in stop words:", nlp.vocab["apple"].is_stop);

nlp.Defaults.stop_words.add("apple")
nlp.vocab["apple"].is_stop = True

print("After adding apple in stop words:", nlp.vocab["apple"].is_stop);

nlp.Defaults.stop_words.remove("apple")
nlp.vocab["apple"].is_stop = False

print("After removing apple in stop words:", nlp.vocab["apple"].is_stop);



Output


Picture showing how to add and remove stops words in spacy





Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, November 25, 2025

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250