Skip to content

Instantly share code, notes, and snippets.

@fsndzomga
Created September 7, 2023 11:48
Show Gist options
  • Save fsndzomga/74646bed863182c7de9824cd42e09886 to your computer and use it in GitHub Desktop.
Save fsndzomga/74646bed863182c7de9824cd42e09886 to your computer and use it in GitHub Desktop.
Tokenize using spaCy
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Natural Language Processing is fascinating.")
tokens = [token.text for token in doc]
print(tokens)
# Output: ['Natural', 'Language', 'Processing', 'is', 'fascinating', '.']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment