CKY-based decoding makes extensive use of charts, which maintain information about spans (i, j) over the length-n input sentence, 0 <= i <= j <= n. These charts are used for many things; for example, lattices use a chart to denote whether there is a path between nodes i and j, and what their costs is, and the decoder uses charts to record the partial application of rules ( DotChart) and the existence of proved items (PhraseChart).
The dummy way to implement a chart is to initialize a two-dimensional array; however, this wastes a lot of space, because the constraint (i <= j) means that only half of this space can ever be used. This is especially a problem for lattices, where the sentence length (n) is the number of nodes in the lattice!
Fortunately, there is a smarter way, since there is a simple deterministic mapping between chart spans under a given maximum length. This class implements that in a generic way, introducing large savings in both space and time.
- Author:
- Matt Post post@.nosp@m.cs.j.nosp@m.hu.ed.nosp@m.u