mb

cky parser

a parser builds the structure of a sentence from grammar rules. cky fills a chart from short spans to long ones: each cell lists what those words can be, built from two smaller cells. it is the same “can” problem as on the viterbi page, with a different tool: instead of the likeliest tags it keeps every reading the grammar allows.

thefishcanfish
the
fish
can
fish

each cell: what words row to column can be. inked: the cells of the parse drawn below. dashed: the two cells behind the selected one

parse 1 of 3

S
|- NP
|  |- Det the
|  `- N   fish
`- VP
   |- Aux can
   `- VP  fish
parses
3
cell
the fish can fish

the top cell holds S 3 ways: 3 parses

how “the fish can fish” was built

labelfromsplitways
NPDet Nthe | fish can fish2
SNP VPthe fish | can fish2
SNP VPthe fish can | fish1

the grammar

S → NP VPa sentence is a noun phrase and a verb phrase
NP → Det Nthe + a noun
VP → Aux VPcan + do something: is able to
VP → V NPa verb with an object: can (put in cans) + fish
N → N Ntwo nouns make one: a fish can
theDet
dogsN, NP
fishN, NP, V, VP
canN, Aux, V
swimVP
rustsVP

try this

  1. “the fish can fish” has three parses. flip between the first two and find the cell where they split.
  2. under more, turn noun compounds off. “the fish can” stops being a noun, and the third parse goes with it.
  3. pick “the can rusts”. viterbi needed probabilities to make can a noun here; this grammar has only one reading, because no rule lets “the” stand before an aux.