Dependency trees

Report a typo

Look at the code below. It prints a dependency tree of the given sentence. The tree is represented in the following way: X --> Y, where X is the head of each phrase, and Y is the dependant word.

However, one part of the code is replaced with *. Print what should be instead of *.

import spacy


en_sm_model = spacy.load("en_core_web_sm")
doc = en_sm_model("London was built many years ago.")
for i in doc:
  print("{0} --> {1}".format(*, i.text))
# built --> London 
# built --> was 
# built --> built 
# years --> many 
# ago --> years 
# built --> ago 
# built --> .
Enter a short text
___

Create a free account to access the full topic