10-Syntax_part2
10-Syntax_part2
Spring Semester
Natural Language
Processing
Dr. Wafaa Samy
Dr. Hanaa Eissa
Syntax (Part 2)
Lecture (10)
2
Contents
• Context-Free Grammar (CFG) (Cont.)
o Grammar Equivalence
o Sentence Types
Noun Phrase
• Agreement
Verb Phrase
• Subcategorization
3
Grammar Equivalence
• Two Context Free Grammars (CFG) are
equivalent if they generate the same language
(i.e. set of strings).
4
Example (1)
Set of Non-Terminals Set of Terminals Set of Non-Terminals Set of Terminals
Start Symbol
Set of Rules
5
An English Grammar Fragment
• Sentences
• Noun phrases
o Agreement
• Verb phrases
o Subcategorization
• Prepositional phrases
6
Sentence Types
1. Declaratives: (e.g. A plane left.)
S NP VP
9
Example (2): Noun Phrase
• The statement, “a flight” can be parsed (or derived) from
the rules as:
NP → Proper-Noun
NP → Det Nominal
Nominal → Noun | Noun Nominal
Proper-Noun → Cairo | Adel
Det → a
Det → the
Noun → flight
10
Determiners
• Noun phrases can start with determiners.
• Determiners can be:
o Simple lexical items: the, this, a, an, etc.
A car.
o Or simple possessives.
John’s car.
Nominal Nominal PP
Nominal Nominal GerundVP
Nominal Nominal RelClause
14 Head
Agreement
• By agreement, we have in mind constraints that hold
among various constituents that take part in a rule or
set of rules.
17
Subcategorization
• But, even though there are many valid VP rules in
English, not all verbs are allowed to participate in all
those VP rules.
• We can subcategorize the verbs in a language
according to the sets of VP rules that they participate
in.
• This is a modern take on the traditional notion of
transitive/intransitive.
• Modern grammars may have many (i.e. 100s or such)
classes.
18
Subcategorization (Cont.)
• 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
• …
(Correct)
19
Subcategorization (Cont.)
• *John sneezed the book.
• *I prefer United has a flight.
• *Give with a flight.
(Incorrect)
20
Why?
• Right now, the various rules for VPs
overgenerate.
o They permit the presence of strings containing
verbs and arguments that don’t go together.
o For example: *John sneezed the book. (Incorrect)
VP V NP
therefore, Sneezed the book is a VP since “sneeze” is
a verb and “the book” is a valid NP.
21
Possible CFG Solution
• Possible solution for
agreement. SgS SgNP SgVP
• Can use the same trick for PlS PlNP PlVP
all the verb/VP classes.
SgNP SgDet SgNom
• Disadvantage: Explosion of
rules can be a problem. PlNP PlDet PlNom
• In English, subjects and verbs have to PlVP PlV NP
agree in person and number. Determiners
and nouns have to agree in number. SgVP SgV NP
…
22
(Accepted) (Not Accepted)
Possible CFG Solution (Cont.)
• Verb-with-NP-complement find | leave | …
• Verb-with-S-complement think | say | believe | …
• Verb-with-no-complement sneeze | disappear | …
• VP Verb-with-NP-complement NP
• VP Verb-with-S-complement S
• VP Verb-with-no-complement
• …
23
CFG Solution for Agreement
• It works and stays within the power of CFGs.
• But it’s ugly.
• And it doesn’t scale all that well because of
the interaction among the various constraints
explodes the number of rules in our grammar.
24
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.
o That can be dealt with adequately, although not elegantly,
by staying within the CFG framework.
25