Grammars and Constituency Structure › Worked Example
Language AI HandbookAll chapters Grammars and Constituency Structure › Worked ExampleSection view · Sections in this chapter7 / 11 ↓
Reading tools Definitions, links & notes
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Let us work through the ambiguous sentence with the grammar from earlier:
the dog chased the cat with a telescope
The tokens are:
CodeExpand
the dog chased the cat with a telescopeThe grammar allows two complete S trees.
Parse A: the prepositional phrase modifies the object noun phrase.
CodeExpand
[S
[NP [Det the] [N dog]]
[VP
[V chased]
[NP
[NP [Det the] [N cat]]
[PP [P with] [NP [Det a] [N telescope]]]]]]In this parse, "the cat with a telescope" is a single NP. The cat is the one with the telescope. The VP is "chased the cat with a telescope", where the object is the entire NP. The attachment is noun phrase attachment because the PP is a sister of the inner NP "the cat" inside the larger object NP.
Parse B: the prepositional phrase modifies the verb phrase.
CodeExpand
[S
[NP [Det the] [N dog]]
[VP
[VP [V chased] [NP [Det the] [N cat]]]
[PP [P with] [NP [Det a] [N telescope]]]]]In this parse, "with a telescope" is a sister of the VP "chased the cat". The dog used a telescope to chase the cat. The object NP is just "the cat". The attachment is verb phrase attachment because the PP combines with the VP rather than with the object NP.
Both trees have the same yield:
CodeExpand
the dog chased the cat with a telescopeThe grammar does not distinguish them. A PCFG can rank them if its rule probabilities favor one attachment pattern. For example, assuming the shared rule factors have positive probability, if the grammar assigns a higher probability to than to , Parse B will score higher. When a PCFG is estimated from a treebank, its preferences come from those observed rule uses. In our code example below, we instead assign probabilities by hand to illustrate the scoring calculation. The worked example therefore shows both the strength and the weakness of CFGs. The grammar precisely defines the space of possible structures, but it does not by itself tell us which structure is intended.
The grammar gives us a precise space of possible structures. Ambiguity means that space contains more than one tree for the same string. Scoring can rank the alternatives; identifying a speaker's intended reading may require contextual information.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!