A dependent is a word whose grammatical role is defined by its relationship to a governing head word. Dependency parsing represents these relationships as a tree: the head governs, the dependent attaches to it, and one word serves as the root. These links support information extraction and knowledge-graph construction. section 11.6
Finding dependents with spaCy
In “Gebru was unethically fired from her Ethical AI team,” fired is the ROOT. Gebru is its passive nominal subject, while the token’s children include Gebru, was, unethically, from, and the punctuation. Inspecting children reveals which words depend directly on a token. section 11.6
>>> def doc2df(doc):
... df = pd.DataFrame([token_dict2(t) for t in doc])
... return df.set_index('TOK')
>>> doc2df(doc)
POS TAG ENT_TYPE DEP children
TOK
Gebru PROPN NNP PERSON nsubjpass []
was AUX VBD auxpass []
unethically ADV RB advmod []
fired VERB VBN ROOT [Gebru, was, une...
from ADP IN prep [team]
her PRON PRP$ poss []
Ethical PROPN NNP ORG compound []
AI PROPN NNP ORG compound [Ethical]
team NOUN NN pobj [her, AI]
. PUNCT . punct []
Inspect a token table that adds each token’s children, making dependent relationships visible alongside part-of-speech and dependency labels. section 11.6
