Professional Documents
Culture Documents
Review
Julia Hockenmaier
juliahmr@illinois.edu
3324 Siebel Center
Office Hours: Fri, 2:00-3:00pm
http://www.cs.uiuc.edu/~juliahmr/cs598
What is the structure
of a sentence?
A set of terminals Σ
(e.g. Σ = {I, you, he, eat, drink, sushi, ball, })
A set of rules R
R ⊆ {A → β with left-hand-side (LHS) A ∈ N
and right-hand-side (RHS) β ∈ (N ∪ Σ)* }
A start symbol S (sentence)
N: noun
P: preposition
NP: “noun phrase”
PP: “prepositional phrase”
CFGs define parse trees
N → {sushi, tuna}
P → {with} Correct analysis
V → {eat} VP
NP
NP → N PP
V NP P NP
NP → NP PP
eat sushi with tuna eat
PP → P NP
VP
VP → V NP
VP PP
V NP P NP
eat sushi with chopsticks eat sus
Incorrect analys
CFGs are equivalent to
Pushdown automata (PDAs)
PDAs are FSAs with an additional stack:
Emit a symbol and push/pop a symbol from the stack
Context- Linear
Type 1 exponential
sensitive Bounded
Recursively Turing
Type 0
Enumerable machine
Constituents:
Heads and dependents
There are different kinds of constituents:
Noun phrases: the man, a girl with glasses, Illinois
Prepositional phrases: with glasses, in the garden
Verb phrases: eat sushi, sleep, sleep soundly
VP PP
V NP P NP
eat sushi with chopsticks eat sushi with chopsticks
Incorrect analysis
Structure (Syntax)
corresponds to
Meaning (Semantics)
Correct analysis
VP
NP
PP
V NP P NP
eat sushi with tuna eat sushi with tuna
VP
VP PP
V NP P NP
eat sushi with chopsticks eat sushi with chopsticks
Incorrect analysis
VP
VP PP
V NP P NP
eat sushi with tuna eat sushi with tuna
VP
NP
PP
V NP P NP
eat sushi with chopsticks eat sushi with chopsticks
Dependency grammar
DGs describe the structure of sentences as graph.
The nodes of the graph are the words
The edges of the graph are the dependencies.
Complexity: O(n3|G|)
n: length of string, |G|: size of grammar)
NP
we we eat S
we eat sushi
S → NP VP V
eat VP
eat sushi
VP → V NP
V → eat
NP → we NP
sushi
NP → sushi
We eat sushi
NP VP
Exercise: CKY parser
DT N VP PP
S → NP VP
NP → NP PP
NP → Noun
VP → VP PP
VP → Verb NP
( )
VP
NP
PP
V NP P NP
yield eat sushi with tuna eat sushi
= eat sushiwith with
tuna tuna
VP
CS 598 JH: Advanced NLP (Springʼ09)
VP PP 18
Computing P(τ)
T is the (infinite) set of all trees in the language:
L = {s ∈ Σ | ∃τ ∈ T : yield(τ) = s}
∗