- this is another method for information extraction
- each words are first converted into tokens
- dependency parse links tokens directly to other tokens
- each link has three parts:
- head - the word that governs, each token has exactly 1 head, unless its the ROOT of the sentence (main verb, etc)
- dependent/modifier - the word that modifies the head
- label - the grammatical relation such as (
nsubj,det,amod, ...)
Each link/arc joins exactly 2 tokens. The dependency depends on the head, so the direction is from head to dependency. In displacy, the arrowhead points at the dependent.
A dependent is a general term, and modifier is a subtype of dependent.

nlp = spacy.load("en_core_web_sm")
sentence = "I saw a kitten eating chicken in the kitchen."
doc = nlp(sentence)
print('{:<15}|{:<8}|{:<15}|{:<20}'.format('Token','Relation','Head','Children'))
print('-'*70)
for token in doc:
#Print the token, dependency nature, head and all dependents of the token
print("{:<15} | {:<18} | {:<15} | {:<20}"
.format(str(token.text), str(token.dep_), str(token.head.text), \
str([child for child in token.children])))
displacy.render(doc, style='dep', jupyter=True, options={'distance':120})
Core arguments
| Label | Meaning | Example (head in italics) |
|---|---|---|
ROOT | Head of the whole sentence, depends on nothing | The drone transmits signals |
nsubj | Nominal subject (subject performing the action) | The drone transmits |
nsubjpass | Passive nominal subject (subject receiving the action) | The signal was jammed |
csubj | Clausal subject (clause contains a subject and a verb) | What he said matters |
csubjpass | Clausal passive subject | Whether it flew was disputed |
dobj | Direct object | transmits signals |
dative | Indirect object (spaCy's name for iobj) | gave him the data |
pobj | Object of a preposition | in the sky |
attr | Attribute: complement of a copula | it is a drone |
oprd | Object predicate | considered it useless |
agent | The "by" marking the agent in a passive | jammed by the operator |
Dependency parsing links words directly to each other, and the other view of sentence structure builds phrases from rules, which is Context-free Grammar (CFG).