Created
March 31, 2023 12:08
-
-
Save saimadhu-polamuri/12811aad035e49113c082dacd3a576fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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