2. ๏ฝ What if your grammar isnโt binary?
โฆ As in the case of the TreeBank grammar?
๏ฝ Convert it to binaryโฆ any arbitrary CFG
can be rewritten into Chomsky-Normal
Form automatically.
โฆ The resulting grammar accepts (and rejects)
the same set of strings as the original
grammar.
โฆ But the resulting derivations (trees) are
different.
โฆ We saw this in the last set of lecture notes
3. ๏ฝ More specifically, we want our rules to be of
the form
A ๏ฎ B C
Or
A ๏ฎ w
That is, rules can expand to either 2 non-terminals
or to a single terminal.
4. ๏ฝ Introduce new intermediate non-terminals
into the grammar that distribute rules with
length > 2 over several rules.
โฆ Soโฆ S ๏ฎ A B C turns into
S ๏ฎ X C and
X ๏ฎ A B
Where X is a symbol that doesnโt
occur anywhere else in the the
grammar.
4
5. 1. Copy all conforming rules to the new
grammar unchanged
2. Convert terminals within rules to
dummy non-terminals
3. Convert unit productions
4. Make all rules with NTs on the right
binary
In lecture: what these mean; apply to
example on next two slides
5