Documents, spans and tokens
Quando você chama nlp em uma string, o spaCy primeiro tokeniza o texto e cria um objeto de documento. Neste exercício, você vai aprender mais sobre o Doc, assim como suas visões Token e Span.
Este exercício faz parte do curso
NLP Avançado com spaCy
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.____)