Documents, spans and tokens
When you call nlp
on a string, spaCy first tokenizes the text and creates a document object. In this exercise, you'll learn more about the Doc
, as well as its views Token
and Span
.
Diese Übung ist Teil des Kurses
Advanced NLP with spaCy
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Import the English language class and create the nlp object
from ____ import ____
nlp = ____
# Process the text
doc = ____("I like tree kangaroos and narwhals.")
# Select the first token
first_token = doc[____]
# Print the first token's text
print(first_token.____)