Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saimadhu-polamuri/12811aad035e49113c082dacd3a576fb to your computer and use it in GitHub Desktop.
Save saimadhu-polamuri/12811aad035e49113c082dacd3a576fb to your computer and use it in GitHub Desktop.
import spacy
nlp = spacy.load("en_core_web_sm")
# Example sentence
text = "The quick brown fox jumps over the lazy dog."
# Tokenize the text
doc = nlp(text)
# Remove stop words from the text
tokens = [token.text for token in doc if not token.is_stop]
# Print the filtered tokens
print(tokens)
"""
Output
['quick', 'brown', 'fox', 'jumps', 'lazy', 'dog', '.']
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment