Semantic Analysis Read J & M Chapter 15.

advertisement
Semantic Analysis
Read J & M Chapter 15.
The Principle of Compositionality
•There’s an infinite number of possible sentences and an infinite
number of possible meanings.
•But we need to specify the relationship between the two with a
finite number of rules.
•What finite classes can we work with:
•Words
•Grammar rules
•So we need to find a way to define the meaning of an entire
sentence as a function of the meaning of the words it contains
and the rules that are used to put those words together.
Deriving the Meaning of Sentences
John saw Bill.
e Isa(e, Seeing)  Agent(e, John)  AE(e, Bill)
S
NP
VP
PN
V
NP
John
saw
PN
Bill
Attaching Semantic Rules to Grammar Rules
John saw Bill. e Isa(e, Seeing)  Agent(e, John)  AE(e, Bill)
S
NP
A…
{f(.sem, .sem …)
PN  John
{John}
VP
PN
V
NP
John
saw
PN
{e Isa(o,Person) 
Name(o, John)}
Bill
NP  PN
{PN.sem}
Handling the Verb
S
NP
VP
PN
V
NP
John
saw
PN
Bill
S  NP VP
NP  PN
PN  John
PN  Bill
VP  V NP
V  saw
{VP.sem(NP.sem)}
{PN.sem}
{John}
{Bill}
{V.sem(NP.sem)}
{x y e Isa(e, Seeing)  Agent(e,y)  AE(e,x) }
Common NPs
John has a cat.
e,x Isa(e, Owning)  Agent(e, John)  AE(e, x)  Isa(x, Cat)
S
NP
VP
PN
V
John
has
NP
DET
a
Nom
N
cat
When Arguments Are Quantified
e,x Isa(e, Owning)  Agent(e, John)  AE(e, x)  Isa(x, Cat)
S  NP VP {VP.sem(NP.sem)}
NP  PN
{PN.sem}
NP  DET Nom
{DET.sem x Nom.sem}
PN  John {John}
DET  a
{}
Nom  N
{Isa(x N.sem)}
N  cat
{cat}
VP  V NP {V.sem(NP.sem)}
V  has
{x y e Isa(e, Owning)  Agent(e,y)  AE(e,x) }
We Get the Wrong Answer
The answer we want:
e,x Isa(e, Owning)  Agent(e, John)  AE(e, x)  Isa(x, Cat)
The answer we’re going to get as things stand now:
e Isa(e, Owning)  Agent(e, John)  AE(e, x Isa(x, Cat))
This isn’t even a valid formula.
Complex Terms
A complex term has the following structure:
<Quantifier variable body>
Using one in our example, we get:
e Isa(e, Owning)  Agent(e, John)  AE(e, < x Isa(x, Cat)>)
Now we add the following rewrite rule for converting complex
terms to ordinary FOPC expressions:
P(<Quantifier variable body>) 
Quantifer variable body Connective P(variable)
In this case:
AE(e, < x Isa(x, Cat)>)   x Isa(x, Cat)  AE(e, x)
Note: If Quantifier is  then Connective is . If , then it’s .
The Revised Grammar
S  NP VP {VP.sem(NP.sem)}
NP  PN
{PN.sem}
NP  DET Nom
{<DET.sem x Nom.sem(x)>}
PN  John {John}
DET  a
{}
Nom  N
{z Isa(z, N.sem)}
N  cat
{cat}
VP  V NP {V.sem(NP.sem)}
V  has
{x y e Isa(e, Owning)  Agent(e,y)  AE(e,x) }
Do We Yet Have the Right Answer?
The answer we’ve got now:
e,x Isa(e, Owning)  Agent(e, John)  AE(e, x)  Isa(x, Cat)
But suppose we want something like:
x Isa (x, Cat)  Owner-of(x, John)
In this case, we can view our initial answer as an intermediate
representation and use it to form whatever other answer we
like by applying inference rules.
Or Suppose We Want a Completely
Different Kind of Representation
More on Quantifiers
Everyone ate a cookie.
S  NP VP {VP.sem(NP.sem)}
NP  Pro
{Pro.sem}
NP  DET Nom
{<DET.sem x Nom.sem(x)>}
DET  a
{}
Nom  N
{z Isa(z, N.sem)}
Pro  everyone
{<  x person(x)>}
N  cookie {cookie}
VP  V NP {V.sem(NP.sem)}
V  ate
{x y e Isa(e, Eating)  Agent(e,y)  AE(e,x) }
e x x' Isa(e, Eating)  (person(x')  Agent(e, x')) 
Isa(x, cookie)  AE(e,x)
Different Argument Structures
John served Bill.
John served steak.
S  NP VP
{VP.sem(NP.sem)}
NP  PN
{PN.sem}
NP  MassN {MassN.sem}
MassN  steak {steak}
PN  John
{John}
PN  Bill
{Bill}
VP  V NP
{V.sem(NP.sem)}
VP  V NP1 NP2 {V.sem(NP1.sem)(NP2.sem)
V  served
{x y e Isa(e, Serving)  Agent(e,y)  AE(e,x) }
V  served
{x y e Isa(e, Serving)  Agent(e,y)  Ben(e,x) }
V  served
{x y z e Isa(e, Serving)  Agent(e,z)  AE(e,y)
 Ben(e, x)}
Sentences that Aren’t Declarative
Close the window.
S  VP
{IMP(VP.sem(DummyYou))}
Do you sell pretzels?
S  Aux NP VP
{YNQ(VP.sem(NP.sem))}
Who sells pretzels?
S  WhPro VP {WHQ(x, VP.sem(x)}}
WHQ(x, e Isa(e, Selling)  Agent(e,x)  AE(e, pretzels)
Compound Noun Phrases
leather jacket
{x Isa(x, jacket)  NN(x, leather)}
riding jacket
winter jacket
letter jacket
Nom  N
{x Isa(x, N.sem)}
Nom  N Nom
{x Nom.sem(x)  NN(x, N.sem)}
N  jacket
{jacket}
N  leather
{leather}
Compound NPs, an Alternative
leather jacket
{x Isa(x, jacket)  madeof(x, leather)}
riding jacket
{x Isa(x, jacket)  usedfor(x,riding)}
winter jacket
letter jacket
Nom  N
Nom  N Nom
Nom  N Nom
N  jacket
N  leather
N  winter
{x Isa(x, N.sem)}
{x Nom.sem(x)  madeof(x, N.sem)}
{x Nom.sem(x)  usedfor(x, N.sem)}
{jacket}
{leather}
{winter}
Infinitive Verb Phrases
I told Mary to eat.
S
NP
VP
Pro
V
NP
I
told
PN
Mary
VPto
infTo
VP
to
V
eat
e, f Isa(e, telling)  Isa(f, eating)  Agent(e, Speaker) 
Ben(e, Mary)  AE(e, f)  Agent(f, Mary)
Noncompositional Semantics
Coupons are just the tip of the iceberg.
That’s just the tip of Mrs. Ford’s iceberg.
John kicked the bucket.
John would have kicked the bucket.
# The bucket was kicked by John.
She turned up her toes.
# She turned up his toes.
Mary threw in the towel.
Mary thought about throwing in the towel.
# Mary threw in the white towel.
willy nilly
pell mell
helter skelter
Semantic Grammars
If we know we have a limited semantic representation, then
build a grammar that is less general and that maps more
directly to the semantic interpretation we want.
Example – Eating Italian Food
An Alternative
InfoRequest  I want to go (to) eat (some) FoodType Time
{Retrieve (x, isa(x, Restaurant) 
nationality(x, FoodType.sem))}
FoodType  Nationality (food)
{Nationality.sem}
Retrieve(x, isa(x, Restaurant)  nationality(x, Italian))
Download