Complete the code to import the spaCy library for dependency parsing.
import [1]
spaCy is a popular library for natural language processing, including dependency parsing.
Complete the code to load the English language model in spaCy.
nlp = spacy.load('[1]')
The English small model in spaCy is named 'en_core_web_sm'.
Fix the error in the code to get the dependency label of the first token.
doc = nlp('I love AI') label = doc[0].[1]
The dependency label of a token is accessed with the dep_ attribute in spaCy.
Fill both blanks to create a dictionary of tokens and their dependency labels.
dep_dict = {token.[1]: token.[2] for token in doc}We use text for the token string and dep_ for its dependency label.
Fill all three blanks to print each token, its head token, and the dependency relation.
for token in doc: print(f"Token: {token.[1], Head: {token.[2].[3]")
We print the token's text, the head token object, and the head token's text.
