Documenti, span e token
Quando chiami nlp su una stringa, spaCy prima tokenizza il testo e crea un oggetto documento. In questo esercizio conoscerai meglio il Doc, oltre alle sue viste Token e Span.
Questo esercizio fa parte del corso
NLP avanzato con spaCy
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# 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.____)