Chapter 19
Context-Free Grammars and Constituency Parsing
Chapter: Context-Free Grammars and Constituency Parsing, in Daniel Jurafsky and James H. Martin, Speech and Language Processing, 3rd edition draft, August 19, 2026.
Topics to learn
Page numbers refer to the linked chapter PDF.
- Constituents and grammars p. 2
- What a constituent is p. 2
- Context-free rules and the formal definition p. 6
- Treebanks as the source of trees and rules p. 6
- Grammar form and ambiguity pp. 8-9
- Equivalence and normal form p. 8
- Why one sentence can have more than one tree p. 9
- Conversion to Chomsky normal form p. 11
- CKY p. 11
- Recognition p. 12
- Recovering a parse p. 14
- What changes in practice p. 15
- Neural constituency parsing p. 17
- A score for a span p. 17
- Turning span scores into a tree p. 18
- Evaluation p. 19
- How parser output is compared with a treebank tree p. 19
- Heads and head-finding p. 20
FAQ
Does a grammar that accepts a sentence give one analysis?
No. A context-free grammar can license several trees for the same sentence. Recognition and disambiguation are different jobs.
Why convert to Chomsky normal form before CKY?
The classic CKY recurrence assumes binary rules, plus unary handling at the end of a cell. The conversion makes the grammar fit that recurrence. It does not change the language if done correctly.
What is a span score doing in a neural parser?
It scores a candidate constituent from position i to j, often with a label. The parser then searches for a tree whose spans fit together, rather than expanding handwritten rules one at a time.
Is a high sentence-level exact match the usual parse score?
The chapter's evaluation compares constituents with the reference tree. A tree can share most spans with the reference and still fail an exact whole-tree match.