1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP...

76
1 Syntax Sudeshna Sarkar 25 Aug 2008

Transcript of 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP...

Page 1: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

1

Syntax

Sudeshna Sarkar

25 Aug 2008

Page 2: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

2

Sentence-Types

Declaratives: A plane leftS -> NP VP

Imperatives: Leave!S -> VP

Yes-No Questions: Did the plane leave?S -> Aux NP VP

WH Questions: When did the plane leave?S -> WH Aux NP VP

Page 3: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

3

Recursion

We’ll have to deal with rules such as the following where the non-terminal on the left also appears somewhere on the right (directly).

Nominal -> Nominal PP [[flight] [to Boston]]

VP -> VP PP [[departed Miami] [at noon]]

Page 4: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

4

Recursion

Of course, this is what makes syntax interestingflights from Denver

Flights from Denver to Miami

Flights from Denver to Miami in February

Flights from Denver to Miami in February on a Friday

Flights from Denver to Miami in February on a Friday under $300

Flights from Denver to Miami in February on a Friday under $300 with lunch

Page 5: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

5

The Point

If you have a rule likeVP -> V NP

It only cares that the thing after the verb is an NP. It doesn’t have to know about the internal affairs of that NP

Page 6: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

6

The Point

Page 7: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

7

Conjunctive Constructions

S -> S and SJohn went to NY and Mary followed him

NP -> NP and NP

VP -> VP and VP

In fact the right rule for English isX -> X and X

Page 8: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

8

Problems

Agreement

Subcategorization

Movement (for want of a better term)

Page 9: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

9

Agreement

This dog

Those dogs

This dog eats

Those dogs eat

*This dogs

*Those dog

*This dog eat

*Those dogs eats

Page 10: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

10

Agreement

In English,

subjects and verbs have to agree in person and number

Determiners and nouns have to agree in number

Many languages have agreement systems that are far more complex than this.

Page 11: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

11

Subcategorization

Sneeze: John sneezed

Find: Please find [a flight to NY]NP

Give: Give [me]NP[a cheaper fare]NP

Help: Can you help [me]NP[with a flight]PP

Prefer: I prefer [to leave earlier]TO-VP

Told: I was told [United has a flight]S

Page 12: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

12

Subcategorization

*John sneezed the book

*I prefer United has a flight

*Give with a flight

Subcat expresses the constraints that a predicate (verb for now) places on the number and syntactic types of arguments it wants to take (occur with).

Page 13: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

13

So?

So the various rules for VPs overgenerate.

They permit the presence of strings containing verbs and arguments that don’t go together

For example

VP -> V NP therefore

Sneezed the book is a VP since “sneeze” is a verb and “the book” is a valid NP

Page 14: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

14

So What?

Now overgeneration is a problem for a generative approach.

The grammar is supposed to account for all and only the strings in a language

From a practical point of view... Not so clear that there’s a problem

Why?

Page 15: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

15

Possible CFG Solution

S -> NP VP

NP -> Det Nominal

VP -> V NP

SgS -> SgNP SgVP

PlS -> PlNp PlVP

SgNP -> SgDet SgNom

PlNP -> PlDet PlNom

PlVP -> PlV NP

SgVP ->SgV Np

Page 16: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

16

CFG Solution for Agreement

It works and stays within the power of CFGs

But its ugly

And it doesn’t scale all that well

Page 17: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

17

Forward Pointer

It turns out that verb subcategorization facts will provide a key element for semantic analysis (determining who did what to who in an event).

Page 18: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

18

Movement

Core (canonical) exampleMy travel agent booked the flight

Page 19: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

19

Movement

Core example[[My travel agent]NP [booked [the flight]NP]VP]S

I.e. “book” is a straightforward transitive verb. It expects a single NP arg within the VP as an argument, and a single NP arg as the subject.

Page 20: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

20

Movement

What about?Which flight do you want me to have the travel agent book?

The direct object argument to “book” isn’t appearing in the right place. It is in fact a long way from where its supposed to appear.And note that its separated from its verb by 2 other verbs.

Page 21: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

21

The Point

CFGs appear to be just about what we need to account for a lot of basic syntactic structure in English.But there are problems

That can be dealt with adequately, although not elegantly, by staying within the CFG framework.

There are simpler, more elegant, solutions that take us out of the CFG framework (beyond its formal power)

Page 22: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

22

Grammars

Before you can parse you need a grammar.

So where do grammars come from?Grammar Engineering

– Lovingly hand-crafted decades-long efforts by humans to write grammars (typically in some particular grammar formalism of interest to the linguists developing the grammar).

TreeBanks– Semi-automatically generated sets of parse trees for the

sentences in some corpus. Typically in a generic lowest common denominator formalism (of no particular interest to any modern linguist).

Page 23: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

23

TreeBank Grammars

Reading off the grammar…

The grammar is the set of rules (local subtrees) that occur in the annotated corpus

They tend to avoid recursion (and elegance and parsimony)

Ie. they tend to the flat and redundant

Penn TreeBank (III) has about 17500 grammar rules under this definition.

Page 24: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

24

TreeBanks

Page 25: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

25

TreeBanks

Page 26: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

26

Sample Rules

Page 27: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

27

Example

Page 28: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

28

TreeBanks

TreeBanks provide a grammar (of a sort).

As we’ll see they also provide the training data for various ML approaches to parsing.

But they can also provide useful data for more purely linguistic pursuits.

You might have a theory about whether or not something can happen in particular language.

Or a theory about the contexts in which something can happen.

TreeBanks can give you the means to explore those theories. If you can formulate the questions in the right way and get the data you need.

Page 29: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

29

Tgrep

You might for example like to grep through a file filled with trees.

Page 30: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

30

TreeBanks

Finally, you should have noted a bit of a circular argument here.

Treebanks provide a grammar because we can read the rules of the grammar out of the treebank.

But how did the trees get in there in the first place? There must have been a grammar theory in there someplace…

Page 31: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

31

TreeBanks

Typically, not all of the sentences are hand-annotated by humans.

They’re automatically parsed and then hand-corrected.

Page 32: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

32

Parsing

Parsing with CFGs refers to the task of assigning correct trees to input strings

Correct here means a tree that covers all and only the elements of the input and has an S at the top

It doesn’t actually mean that the system can select the correct tree from among all the possible trees

Page 33: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

33

Parsing

As with everything of interest, parsing involves a search which involves the making of choices

We’ll start with some basic (meaning bad) methods before moving on to the one or two that you need to know

Page 34: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

34

For Now

Assume…You have all the words already in some buffer

The input isn’t POS tagged

We won’t worry about morphological analysis

All the words are known

Page 35: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

35

Top-Down Parsing

Since we’re trying to find trees rooted with an S (Sentences) start with the rules that give us an S.

Then work your way down from there to the words.

Page 36: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

36

Top Down Space

Page 37: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

37

Bottom-Up Parsing

Of course, we also want trees that cover the input words. So start with trees that link up with the words in the right way.

Then work your way up from there.

Page 38: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

38

Bottom-Up Space

Page 39: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

39

Bottom Up Space

Page 40: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

40

Control

Of course, in both cases we left out how to keep track of the search space and how to make choices

Which node to try to expand next

Which grammar rule to use to expand a node

Page 41: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

41

Top-Down and Bottom-Up

Top-downOnly searches for trees that can be answers (i.e. S’s)

But also suggests trees that are not consistent with any of the words

Bottom-upOnly forms trees consistent with the words

But suggest trees that make no sense globally

Page 42: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

42

Problems

Even with the best filtering, backtracking methods are doomed if they don’t address certain problems

Ambiguity

Shared subproblems

Page 43: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

43

Ambiguity

Page 44: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

44

Shared Sub-Problems

No matter what kind of search (top-down or bottom-up or mixed) that we choose.

We don’t want to unnecessarily redo work we’ve already done.

Page 45: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

45

Shared Sub-Problems

ConsiderA flight from Indianapolis to Houston on TWA

Page 46: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

46

Shared Sub-Problems

Assume a top-down parse making bad initial choices on the Nominal rule.

In particular…Nominal -> Nominal Noun

Nominal -> Nominal PP

Page 47: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

47

Shared Sub-Problems

Page 48: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

48

Shared Sub-Problems

Page 49: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

49

Shared Sub-Problems

Page 50: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

50

Shared Sub-Problems

Page 51: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

51

Parsing

CKY

Earley

Both are dynamic programming solutions that run in O(n**3) time.

CKY is bottom-up

Earley is top-down

Page 52: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

52

Sample Grammar

Page 53: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

53

Dynamic Programming

DP methods fill tables with partial results andDo not do too much avoidable repeated work

Solve exponential problems in polynomial time (sort of)

Efficiently store ambiguous structures with shared sub-parts.

Page 54: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

54

CKY Parsing

First we’ll limit our grammar to epsilon-free, binary rules (more later)

Consider the rule A -> BCIf there is an A in the input then there must be a B followed by a C in the input.

If the A spans from i to j in the input then there must be some k st. i<k<j– Ie. The B splits from the C someplace.

Page 55: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

55

CKY

So let’s build a table so that an A spanning from i to j in the input is placed in cell [i,j] in the table.So a non-terminal spanning an entire string will sit in cell [0, n]If we build the table bottom up we’ll know that the parts of the A must go from i to k and from k to j

Page 56: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

56

CKY

Meaning that for a rule like A -> B C we should look for a B in [i,k] and a C in [k,j].In other words, if we think there might be an A spanning i,j in the input… ANDA -> B C is a rule in the grammar THENThere must be a B in [i,k] and a C in [k,j] for some i<k<j

Page 57: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

57

CKY

So to fill the table loop over the cell[i,j] values in some systematic way

What constraint should we put on that?

For each cell loop over the appropriate k values to search for things to add.

Page 58: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

58

CKY Table

Page 59: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

59

CKY Algorithm

Page 60: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

60

CKY Parsing

Is that really a parser?

Page 61: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

61

Note

We arranged the loops to fill the table a column at a time, from left to right, bottom to top.

This assures us that whenever we’re filling a cell, the parts needed to fill it are already in the table (to the left and below)

Page 62: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

62

Example

Page 63: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

63

Other Ways to Do It?

Are there any other sensible ways to fill the table that still guarantee that the cells we need are already filled?

Page 64: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

64

Other Ways to Do It?

Page 65: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

65

Sample Grammar

Page 66: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

66

Problem

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.What does this mean?

The resulting grammar accepts (and rejects) the same set of strings as the original grammar.But the resulting derivations (trees) are different.

Page 67: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

67

Problem

More specifically, rules have to be of the formA -> B C

Or

A -> w

That is rules can expand to either 2 non-terminals or to a single terminal.

Page 68: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

68

Binarization Intuition

Eliminate chains of unit productions.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 CX - A B

Where X is a symbol that doesn’t occur anywhere else in the the grammar.

Page 69: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

69

CNF Conversion

Page 70: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

70

CKY Algorithm

Page 71: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

71

Example

Filling column 5

Page 72: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

72

Example

Page 73: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

73

Example

Page 74: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

74

Example

Page 75: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

75

Example

Page 76: 1 Syntax Sudeshna Sarkar 25 Aug 2008. 2 Sentence-Types Declaratives: A plane left S -> NP VP Imperatives: Leave! S -> VP Yes-No Questions: Did the plane.

76

END