ComeçarComece de graça

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.

Este exercício faz parte do curso

Advanced NLP with spaCy

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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.____)
Editar e executar o código