In dependency parsing, a head is the governing word in a grammatical relationship; the attached word is its dependent. Each sentence has one word with no governing dependency: the root. Together, heads and dependents form a dependency tree that exposes relationships useful for extracting facts. section 11.6
Finding a head in spaCy
In “Gebru was unethically fired from her Ethical AI team,” fired is the ROOT and therefore the sentence's central head. Its children include Gebru, was, unethically, from, and the punctuation mark. The dependency from fired to Gebru can support a knowledge-graph fact. section 11.6
>>> text = "Gebru was unethically fired from her Ethical AI team."
>>> doc = nlp(text)
>>> doc2df(doc)
TOK POS TAG ENT_TYPE DEP
0 Gebru PROPN NNP PERSON nsubjpass
1 was AUX VBD auxpass
2 unethically ADV RB advmod
3 fired VERB VBN ROOT
4 from ADP IN prep
5 her PRON PRP$ poss
6 Ethical PROPN NNP ORG compound
7 AI PROPN NNP ORG compound
8 team NOUN NN pobj
9 . PUNCT . punct
Inspect the parsed sentence row by row to compare each token's dependency label with its position in the dependency tree. section 11.6
