Ch4-Phrase-Structure Grammars and Dependency Grammars PDF
Ch4-Phrase-Structure Grammars and Dependency Grammars PDF
CS 1462
1
Some slides borrows from Carl Sable
If you are following along in the book…
2
Syntax
3
Phrase Structure Grammars
4
Phrases
Examples of noun phrases: "Harry the Horse", "the Broadway coppers", "they",
"a high-class spot such as Mindy's", "the reason he comes into the Hot Box",
"three parties from Brooklyn"
One piece of evidence that these words group together (i.e., form constituents
or phrases) is that they appear in similar syntactic environments (for example,
before a verb)
Another piece of evidence is that each phrase can be moved around together in
some sentences
However, you can't generally break a phrase into parts and put the parts in
different places
The book discusses an example involving the prepositional phrase "on
September seventeenth" (see the next slide)
Many examples in this topic come from the Air Traffic Information System
(ATIS) domain; this involves examples of spoken language by users booking
airline reservations
Book: "ATIS systems were an early example of spoken language systems for
helping book airline reservations"; users would interact with the system to book
5
flights
Phrase Example
6
Context-free Grammars
7
CFG Terminology
8
Sample Grammar Rules
9
Sample Lexical Rules
10
Parse Trees
11
Parse Tree Example
12
Formal Languages
13
Formal Description of CFGs
14
Sample Rules for English Sentences
15
Declarative Structure
16
Imperative Structure
18
Wh-Subject-Question Structure
20
Embedded Sentences
The book also points out that S can also occur on the right-hand
side of grammar rules
A sentence within a larger sentence can be called an embedded
sentence
The embedded S then corresponds "to the notion of a clause, which
traditional grammars often describe as forming a complete thought"
[book]
Although the book does not give any rules for this, one obvious rule
(I included it on a previous slide) combines two S phrases with a
coordinating conjunction
My made-up example: "I like sitting in an aisle seat, but I do not like
stopovers."
Another type of embedded sentence occurs in dependent clauses
after certain verbs (we will not look at a rule for this)
My made-up example: "I think that the meal contains a flight."
21
English Noun Phrases
22
English Noun Phrases
Note that this rule is recursive, since an NP can start with a Det
(allowing the previous example)
In some cases, determiners are optional (but the book does not discuss
modifying the rule)
For example, if the noun is plural: "Show me flights from San Francisco
to Denver on weekdays"
Mass nouns, including substances and certain abstract nouns, also
don't require a determiner; for example, "Does this flight serve
dinner?"
Some noun phrases also include a predeterminer before the
determiner; e.g., "all" in the phrase "all the morning flights" (we would
need a new rule for this)
23
English Nominals
A nominal consists of a head noun along with various modifiers that can occur before or
after the head
I add: Although our textbook uses the phrase "head noun" several times in the context of
noun phrases, they don't fully define the notion of a "head"
The head of a phrase is the word that is syntactically the most significant to the phrase;
they often, but don't always, match my intuition
We will discuss the concept of heads of phrases in more detail in our next topic
The book shows several examples of pre- and post-head noun modifiers, which they
consider part of the nominal (as is typical); we will look at some of these over the next
two slides
Some linguistic theories would call the full phrase, including the determiner, a
determiner phrase, with the determiner as the head, as opposed to a noun phrase
Some other linguistic theories don't distinguish between noun phrases and nominals at
all
In the simplest case, the nominal consists only of a single noun
The rule we have seen in L0 recursively allows multiple nouns to combine to form a
nominal (e.g., to allow nominals such as "dinner flight")
24
Pre-head Noun Modifiers
Pre-head noun modifiers can appear before the head noun in a nominal; these include
cardinal numbers (e.g., "one", "ten"), ordinal numbers, quantifiers (e.g., "many", "few"),
and adjectives
Ordinal numbers include "first", "second", etc. but also words like "next", "past", and
"another"
Adjectives can be grouped into an adjective phrase (AP) and placed before the head noun
APs can include an adverb before an adjective; for example, "the least expensive fare"
The textbook does not provide rules for this, but we could include something such as:
Nominal (Card) (Ord) (Quant) (AP) Nominal
The parentheses here are used to mark optional constituents of the NP; it is really a
shorthand for multiple rules (with and without the optional constituent)
Of course, each of the optional constituents would require their own rules
Cardinal numbers, ordinal numbers, and quantifiers may be considered parts of speech,
but the adjective phrase is a type of phrase consisting of one or more adjectives
Also note that this rule implies that there is a particular order to prenominal modifiers;
other orders would not sound right
25
Postmodifiers
A head noun can also be followed by post-head noun modifiers, or postmodifiers,
which are part of the nominal
Examples include prepositional phrases ("all flights from Cleveland"), non-finite
clauses ("any flights arriving after eleven a.m."), and relative clauses ("a flight that
serves breakfast")
Prepositional phrases (PPs) can be strung together; for example, "all flights from
Cleveland to Newark" or "a reservation on flight six oh six from Tampa to Montreal"
A possible rule to handle such PPs is: Nominal Nominal PP
Three kinds of non-finite (meaning they do not indicate tense) postmodifiers are the
gerundive (-ing), -ed ("the aircraft used by this flight"), and infinitive forms ("the
last flight to arrive in Boston")
Gerundive postmodifiers consist of a verb phrase that begins with the gerundive (-
ing) form of a verb, optionally followed by other types of phrases; e.g., "any flights
arriving after eleven a.m."
Possible new rules for gerundive non-finite postmodifiers are:
Nominal Nominal GerundVP
GerundVP GerundV NP | GerundV PP | GerundV | GerundV NP PP
GerundV being | arriving | leaving | … 26
Postnominal Relative Clauses
27
Verb Phrases
30
Rules for Subcategorization
32
Conjunctions
33
Agreement
We have seen when discussing morphology that nouns and verbs have different
forms; in some cases, the form used for one word depends on the context of the
surrounding words
Example: Most present tense verbs have a separate form for third-person singular
subjects (e.g., "The flight leaves in the morning", "The flights leave in the morning",
"I leave…", etc.)
One way to handle this requirement for subject-verb agreement is to expand the
grammar with multiple sets of rules; e.g., the rule S NP VP might be replaced
with these two rules:
S 3sgNP 3sgVP
S Non3sgNP Non3pVP
However, handling agreement like this can possibly double the size of the grammar
for every type of agreement (thus increasing the size of the grammar exponentially)
Other types of agreement include:
Case agreement; for example, English pronouns have nominative (e.g., "I", "she", "he", "they") and
accusative (e.g., "me", "her", "him", "them") versions
Some determiners require determiner-noun agreement, meaning that they must agree in number
with the nouns they modify (for example, "this flight" versus "these flights")
In some languages, there is also a requirement for gender agreement
34
Augmented Grammars
There are various ways to augment grammars to handle various agreement rules
that must be enforced, without exponentially increasing the size of the grammar
For example, our textbook discusses lexicalized grammars in Section 12.6, but we
will skip this
Instead, we are going to briefly discuss a notation used in "Artificial Intelligence: A
Modern Approach" by Stuart Russell and Peter Norvig (I use this textbook for my AI
course)
Consider the following rules representing part of an augmented grammar:
S(head) NP(Sbj, pn, h) VP(pn, head) | …
NP(c, pn, head) Pronoun(c, pn, head) | Noun(c, pn, head) | …
VP(pn, head) VP(pn, head) NP(Obj, pn, h) | …
PP(head) Prep(head) NP(Obj, pn, h)
Pronoun(Sbj, 1S, I) I
Pronoun(Sbj, 1P, we) we
Pronoun(Obj, 1S, me) me
Pronoun(Obj, 3P, them) them
Here, "c" and "pn" represent parameters, or features, for case (subject or object)
and person/number, respectively; "head" and "h" are parameters representing
heads of phrases
35
Interpreting Augmented Grammars
36
Why CFGs?
Recall again that CFGs are one type of grammar that is part of the Chomsky hierarchy
We have previously learned that regular expressions can be useful to express morphology rules
It is typically wise to use the least powerful formalism that can be used to solve a task, because it
generally makes it easier compared to using a more powerful formalism
It has been well established that natural languages cannot be defined by regular grammars
It has long been debated whether CFGs are capable of defining natural languages
It has been shown that a few constructs in some languages (but not English) are not context free
Nonetheless, CFGs have been the most common formalism used by linguists to represent
grammar
More generally, the previous edition of the textbook discussed some evidence from psychology
experiments supporting the notion that constituents (phrases) may be mentally depicted when
humans process language
For example, one study started by asking subjects to read sentences that contain a constituent
(e.g., a verb phrase) with a particular structure (e.g., V NP PP)
If the subjects were then asked to describe a picture, they were more likely to use the same
structure
One possible explanation for this is that the particular form of the constituent has been primed,
suggesting that the constituent is mentally represented
37
Treebanks
38
Sample Parses from the Penn Treebank
39
Treebanks and Grammars
40
Dependency Grammars
41
Depicting Dependency Parses
The arrow from "root" to "prefer" implies that "prefer" is the head of the entire
sentence
Two slides from now, we will discuss the labels along the arrows
Dependency parses can also be depicted as parse trees; the next slide shows an
example
42
Parse Trees
43
Dependency Relations
44
Examples of Dependency Relations
45
Constraints on Dependency Parses
Unlike with constituency grammars, there are no specific rules for how words or phrases can
combine to form other phrases; however, there are constraints imposed on the dependency
parses
We can consider the constraints to be imposed on the dependency tree, consisting of a set of
vertices V (representing words) and the arcs connecting them (representing dependency
relations)
Here are three constraints, copied from the textbook:
1. There is a single designated root node that has no incoming arcs.
2. With the exception of the root node, each vertex has exactly one incoming arc.
3. There is a unique path from the root node to each vertex in V.
Additionally, some dependency grammar formalisms require projectivity
Book: "An arc from a head to a dependent is said to be projective if there is a path from the head
to every word that lies between the head and the dependent in the sentence"
It turns out that an equivalent constraint is to impose that arrows cannot cross each other (i.e.,
a sentence is projective if it is possible to draw the dependencies with no crossing arrows)
It is well-known that some sentences (including in English) violate this constraint (projectivity)
However, it was a useful constraint to impose for some traditional dependency parsing
algorithms
We will cover constituency parsing in a future topic, but we will not cover dependency parsing
46
Spoken English
47
Wishing you a fruitful educatio
nal experience
48