semantics
DESCRIPTION
Semantics. cCS 224n / Lx 237 Tuesday, May 11 2004. With slides borrowed from Jason Eisner. Objects. Three Kinds: Boolean – semantic value of sentences Entities Objects, NPs Maybe space / time specifications Functions Predicates – function returning a boolean - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/1.jpg)
Semantics
cCS 224n / Lx 237Tuesday, May 11
2004
With slides borrowed from Jason Eisner
![Page 2: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/2.jpg)
Objects
Three Kinds: Boolean – semantic value of sentences Entities
Objects, NPs Maybe space / time specifications
Functions Predicates – function returning a boolean Functions might return other functions Functions might take other functions as
arguments.
![Page 3: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/3.jpg)
Nouns and their modifiers expert
g expert(g) big fat expert
g big(g) fat(g) expert(g) But: bogus expert
Wrong: g bogus(g) expert(g) Right: g (bogus(expert))(g) … bogus maps to new concept
Baltimore expert (white-collar expert, TV expert …) g Related(Baltimore, g) expert(g) Or with different intonation: g (Modified-by(Baltimore, expert))(g) Can’t use Related for that case: law expert and dog catcher
= g Related(law,g) expert(g) Related(dog, g) catcher(g) = dog expert and law catcher
![Page 4: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/4.jpg)
We’ve discussed what semantic representations should look like.
But how do we get them from sentences???
First - parse to get a syntax tree. Second - look up the semantics for each word. Third - build the semantics for each constituent
Work from the bottom up The syntax tree is a “recipe” for how to do it
Compositional Semantics
![Page 5: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/5.jpg)
Add a “sem” feature to each context-free rule S NP loves NP S[sem=loves(x,y)] NP[sem=x] loves NP[sem=y] Meaning of S depends on meaning of NPs
Compositional Semantics
NPVloves
VP
S
NPx
y
loves(x,y)
NP the bucket
Vkicked
VP
S
NPx
died(x)
![Page 6: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/6.jpg)
Instead of S NP loves NP S[sem=loves(x,y)] NP[sem=x] loves NP[sem=y]
might want general rules like S NP VP: V[sem=loves] loves VP[sem=v(obj)] V[sem=v] NP[sem=obj] S[sem=vp(subj)] NP[sem=subj] VP[sem=vp]
Now George loves Laura has sem=loves(Laura)(George) In this manner we’ll sketch a version where
Still compute semantics bottom-up Grammar is in Chomsky Normal Form So each node has 2 children: 1 function & 1 argument To get its semantics, apply function to argument!
Compositional Semantics
![Page 7: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/7.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
![Page 8: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/8.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)the meaning that we want here: how can we arrange to get it?
![Page 9: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/9.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
Gwhat function shouldapply to G to yield the desired blue result? (this is like division!)
![Page 10: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/10.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
x loves(x,L)G
![Page 11: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/11.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
x loves(x,L)G
a ax loves(x,L)
We’ll say that“to” is just a bit of syntax that
changes a VPstem to a VPinf with the same meaning.
![Page 12: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/12.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
x loves(x,L)G
a ax loves(x,L)
y x loves(x,y)
L
![Page 13: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/13.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
x loves(x,L)G
a a
y x loves(x,y)
L
x loves(x,L)
x wants(x, loves(G,L))by analogy
![Page 14: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/14.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
loves(G,L)
x loves(x,L)G
a a
yx loves(x,y)
L
x loves(x,L)
x wants(x, loves(G,L))
y x wants(x,y)
by analogy
![Page 15: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/15.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
x wants(x, loves(G,L))
x present(wants(x, loves(G,L)))
NPGeorge
v x present(v(x)
)
![Page 16: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/16.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
x present(wants(x, loves(G,L)))
NPGeorge
present(wants(every(nation), loves(G,L))))
every(nation)
![Page 17: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/17.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
present(x wants(x, loves(G,L)))
NPGeorge
present(wants(every(nation), loves(G,L))))
every(nation)
n every(n) nation
![Page 18: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/18.jpg)
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
NPGeorge
present(wants(every(nation), loves(G,L))))
s assert(s)
![Page 19: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/19.jpg)
In Summary: From the Words
NPLaura
Vstem
love
VPstem
VPinf
Tto
Sinf
NPGeorge
VPstem
Vstem
want
VPfin
T-s
Sfin
NP
Nnation
DetEvery
START
Punc.
G
a a
y x loves(x,y) L
y x wants(x,y)
v x present(v(x))
every nation
s assert(s)
assert(present(wants(every(nation), loves(G,L))))
![Page 20: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/20.jpg)
So now what?
Now that we have the semantic meaning, what do we do with it? Huge literature on logical reasoning, and
knowledge learning. Reasoning versus Inference
“John ate a Pizza” Q:What was eaten by John? A: pizza
“John ordered a pizza, but it came with anchovies. John then yelled at the waiter and stormed out.”
Q: What was eaten by John? A: nothing
![Page 21: Semantics](https://reader034.vdocument.in/reader034/viewer/2022051401/56814652550346895db36607/html5/thumbnails/21.jpg)
Problem 1a
Write grammar rules complete with semantic translations that could be added
to thegrammar fragment, which will parse the
above sentence and generate a semantic representation
using the own predicate.