CYK Parsing with Span Dynamic Programming
Fill a triangular table of parse spans and retain split witnesses when a derivation tree is needed.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
The table stores nonterminals that generate a substring
For a grammar in Chomsky normal form, initialize a length-one span with every variable having a rule for that terminal. Fill longer spans \([i,j)\) in increasing length. For each split \(k\), a production \(A\to BC\) can add \(A\) when \(B\) generates \([i,k)\) and \(C\) generates \([k,j)\). A parse tree of a longer nonempty span necessarily has exactly such a root split, proving completeness by induction.
Store a successful rule and split to reconstruct
Membership asks whether the start variable appears in the full span. One successful rule and split per table entry lets the parser recover one tree. All derivations can share substructures in a packed representation, which can be much smaller than listing their trees individually. Straightforward evaluation uses \(O(n^3)\) time for fixed grammar and quadratic space. Dynamic programming state design explains why a span and its variable summarize sufficient information.[1][2]