ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Advanced NLP with spaCy

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# 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 y ejecutar código