liveBook · Manning

Head

As explained in Natural Language Processing in Action, Second Edition

A head is the governing word in a dependency relationship to which another word is attached.

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

How Natural Language Processing in Action, Second Edition covers it

How deep it goes
Explains heads, dependents, roots, dependency relations, and children, then stops short of broader parsing internals.
Examples
Uses a sentence about Gebru being fired, spaCy token tables, child lists, and a rendered dependency diagram.
What it assumes
Assumes familiarity with words and sentences while teaching dependency roles, roots, and tree structure from their basic meanings.
What you can do after
Apply it via spaCy to inspect token children and identify relationships that can populate knowledge-graph facts.
How it connects
Connects heads with dependency parsing, dependency trees, roots, dependents, children, spaCy, and knowledge graphs.

This explainer was generated by Manning's knowledge graph from the text of Natural Language Processing in Action, Second Edition. The section links point to the parts of the book it draws on.