Skip to content

Instantly share code, notes, and snippets.

@fsndzomga
Created September 7, 2023 22:53
Show Gist options
  • Save fsndzomga/5061d631fe2b6399ffd2e67d74c41fab to your computer and use it in GitHub Desktop.
Save fsndzomga/5061d631fe2b6399ffd2e67d74c41fab to your computer and use it in GitHub Desktop.
stop words
from spacy.lang.en.stop_words import STOP_WORDS
sentence = "This is a sample sentence."
doc = nlp(sentence)
filtered_tokens = [token.text for token in doc if token.text.lower() not in STOP_WORDS]
print(filtered_tokens)
# Output: ['sample', 'sentence', '.']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment