LING 364: Introduction to Formal Semantics - PowerPoint PPT Presentation

About This Presentation
Title:

LING 364: Introduction to Formal Semantics

Description:

Give a basic DCG grammar for the following examples: ... add phrase structure for each rule. sbar(sbar(NP,S)) -- np(NP), s(S). sbar(sbar(S)) -- s(S) ... – PowerPoint PPT presentation

Number of Views:26
Avg rating:3.0/5.0
Slides: 24
Provided by: sandiw
Category:

less

Transcript and Presenter's Notes

Title: LING 364: Introduction to Formal Semantics


1
LING 364 Introduction to Formal Semantics
  • Lecture 12
  • February 21st

2
Administrivia
  • Reminder
  • Computer Lab Class on Thursday
  • meet in Social Sciences 224 (not here)
  • Homework 3 will be given out

3
Administrivia
  • Reading for Thursday
  • Chapter 4 Modifiers
  • already given out earlier with Chapter 3
  • no quiz but will be part of your homework
  • we will start looking at Chapter 4 today with
    adjectives

4
Homework 2 Review
5
Homework 2 Review
  • Exercises 1 through 3
  • Give a basic DCG grammar for the following
    examples
  • SbarS NP John VP V isNP DET aN
    student
  • SbarS NP Pete VP V isNP DET aN
    student
  • SbarS NP Mary VP V isNP DET aN
    baseball fan
  • SbarS NP Pete VP V isNP DET aN
    baseball fan
  • SbarS NP John VP V isNP DET aN
    baseball fan
  • Sbar NP Who S VP V isNP DET aN
    student
  • Sbar NP Who S VP V isNP DET aN
    baseball fan
  • Sbar NP Who S VP V isNP NEG not NP
    DET aN student
  • Sbar NP Who S VP V isNP NEG not NP
    DET aN baseball fan
  • Sbar NP Who S VP V is NPNP DET aN
    studentCONJ andNP DET aN baseball
    fan
  • Sbar NP Who S VP V is NPNP DET aN
    studentCONJ andNP NEG notNPDET aN
    baseball fan

6
Homework 2 Review
  • Basic DCG
  • i.e. no phrase structure or meaning computed,
    just Yes/No answers from query
  • ?- sbar(Sentence,).
  • Yes/No
  • Grammar rules
  • sbar --gt np, s.
  • sbar --gt s.
  • s --gt vp.
  • s --gt np, vp.
  • np --gt john.
  • np --gt pete.
  • np --gt mary.
  • np --gt det, n.
  • np --gt who.
  • np --gt neg, np.
  • np --gt np, conj, np.
  • n --gt student.
  • n --gt baseball,fan.
  • neg --gt not.
  • conj --gt and.
  • vp --gt v, np.
  • v --gt is.
  • det --gt a.

7
Homework 2 Review
  • Exercise 4
  • Modify the grammar to include phrase structure

?- sbar(PS,who,is,not,a,baseball,fan,). PS
sbar(np(who),s(vp(v(is),np(neg(not),np(det(a),n(
baseball_fan)))))) ? ?- sbar(PS,john,is,a,base
ball,fan,). PS sbar(s(np(john),vp(v(is),np(de
t(a),n(baseball_fan))))) ? ?-
sbar(PS,who,is,a,student,and,a,baseball,fan,).
PS sbar(np(who),s(vp(v(is),np(np(det(a),n(stude
nt)),conj(and),np(det(a), n(baseball_fan)))))) ?
?- sbar(PS,who,is,a,student,and,not,a,baseball
,fan,). PS sbar(np(who),s(vp(v(is),np(np(det(
a),n(student)),conj(and),np(neg(not), np(det(a),n(
baseball_fan))))))) ?
8
Homework 2 Review
  • Modify basic DCG into one that includes phrase
    structure

sentence(np(john),vp(v(likes),np(mary)))
  • Basic DCG
  • sentence --gt np, vp.
  • vp --gt v, np.
  • v --gt likes.
  • np --gt john.
  • np --gt mary.
  • Query (we supply two arguments sentence as a
    list and an empty list)
  • ?- sentence(john,likes,mary,).
  • Yes (Answer)
  • Phrase Structure DCG
  • sentence(sentence(NP,VP)) --gt np(NP), vp(VP).
  • vp(vp(V,NP)) --gt v(V), np(NP).
  • v(v(likes)) --gt likes.
  • np(np(john)) --gt john.
  • np(np(mary)) --gt mary.
  • Modified Query (supply one more argument)
  • ?- sentence(PS,john,likes,mary,).
  • PS sentence(np(john),vp(v(likes),np(mary)))

9
Homework 2 Review
  • Step 1
  • add phrase structure for each rule
  • sbar(sbar(NP,S)) --gt np(NP), s(S).
  • sbar(sbar(S)) --gt s(S).
  • s(s(VP)) --gt vp(VP).
  • s(s(NP,VP)) --gt np(NP), vp(VP).
  • np(np(who)) --gt who.
  • np(np(john)) --gt john.
  • np(np(pete)) --gt pete.
  • np(np(mary)) --gt mary.
  • np(np(Det,N)) --gt det(Det), n(N).
  • np(np(Neg,NP)) --gt neg(Neg), np(NP).
  • np(np(NP1,Conj,NP2)) --gt np(NP1), conj(Conj),
    np(NP2).
  • neg(neg(not)) --gt not.
  • conj(conj(and)) --gt and.
  • vp(vp(V,NP)) --gt v(V), np(NP).
  • v(v(is)) --gt is.
  • det(det(a)) --gt a.
  • n(n(student)) --gt student.
  • n(n(baseball_fan)) --gt baseball,fan.

10
Homework 2 Review
  • Step 1
  • add phrase structure for each rule
  • sbar(sbar(NP,S)) --gt np(NP), s(S).
  • sbar(sbar(S)) --gt s(S).
  • Problem
  • ?- sbar(X,who,is,a,student,).
  • X sbar(np(who),s(vp(v(is),np(det(a),n(student)))
    ))
  • ?- sbar(X,john,is,a,student,).
  • X sbar(np(john),s(vp(v(is),np(det(a),n(student))
    ))) ?

11
Homework 2 Review
  • Step 1
  • add phrase structure for each rule
  • Flipping the rule order doesnt help
  • sbar(sbar(S)) --gt s(S). sbar(sbar(NP,S)) --gt
    np(NP), s(S).
  • Problem
  • ?- sbar(X,john,is,a,student,).
  • X sbar(s(np(john),vp(v(is),np(det(a),n(student))
    )))
  • ?- sbar(X,who,is,a,student,).
  • X sbar(s(np(who),vp(v(is),np(det(a),n(student)))
    ))

12
Homework 2 Review
  • Step 2
  • need to separate who from other noun phrases
  • Solution realize you can rename a non-terminal
    and still return the same phrase
  • sbar(sbar(S)) --gt s(S). sbar(sbar(NP,S)) --gt
    wh_np(NP), s(S).
  • wh_np(np(who)) --gt who.
  • Correct output
  • ?- sbar(X,who,is,a,student,).
  • X sbar(np(who),s(vp(v(is),np(det(a),n(student)))
    )) ?
  • ?- sbar(X,john,is,a,student,).
  • X sbar(s(np(john),vp(v(is),np(det(a),n(student))
    )))

13
Homework 2 Review
  • Exercise 5
  • Modify the grammar to generate meaning

Note _A is an internally-generated Prolog
variable
?- sbar(M,who,is,not,a,baseball,fan,). M
\baseball_fan(_A) ? ?- sbar(M,john,is,a,baseb
all,fan,). M baseball_fan(john) ? ?-
sbar(M,who,is,a,student,and,a,baseball,fan,).
M student(_A),baseball_fan(_A) ? ?-
sbar(M,who,is,a,student,and,not,a,baseball,fan,
). M student(_A),\baseball_fan(_A) ?
14
Homework 2 Review
likes(john,mary)
  • modify basic DCG into one that includes meaning

likes(X,mary)
john
  • Basic DCG
  • sentence --gt np, vp.
  • vp --gt v, np.
  • v --gt likes.
  • np --gt john.
  • np --gt mary.
  • Query (we supply two arguments sentence as a
    list and an empty list)
  • ?- sentence(john,likes,mary,).
  • Yes (Answer)

mary
likes(X,Y)
  • Meaning DCG
  • sentence(P) --gt np(NP1), vp(P),
    saturate1(P,NP1).
  • vp(P) --gt v(P), np(NP2), saturate2(P,NP2).
  • v(likes(X,Y)) --gt likes.
  • np(john) --gt john.
  • np(mary) --gt mary.
  • saturate1(P,A) - arg(1,P,A).
  • saturate2(P,A) - arg(2,P,A).
  • Query (supply one more argument)
  • ?- sentence(M,john,likes,mary,).
  • M likes(john,mary)

argument saturation arg(Nth,Predicate,Argument) m
eans make Nth argument of Predicate equal to
Argument ltGoalgt means call Prolog
ltGoalgt arg(2,VBm,NPm) means call arg(2,VBm,NPm)
15
Homework 2 Review
  • Step 1
  • add meaning for each rule
  • note we dont have to do the wh_np renaming here
  • sbar(P) --gt np(x), s(P), saturate1(P,x).
  • sbar(P) --gt s(P).
  • s(P) --gt vp(P).
  • s(P) --gt np(X), vp(P), saturate1(P,X).
  • np(john) --gt john.
  • np(pete) --gt pete.
  • np(mary) --gt mary.
  • np(P) --gt det(a), n(P).
  • np((\ P)) --gt neg, np(P).
  • np((P1,P2)) --gt np(P1), conj(and), np(P2).
  • np(x) --gt who.
  • neg --gt not.
  • conj(and) --gt and.
  • vp(P) --gt v(copula), np(P).
  • v(copula) --gt is.
  • det(a) --gt a.
  • n(student(X)) --gt student.
  • n(baseball_fan(X)) --gt baseball,fan.

16
Homework 2 Review
  • Step 2
  • generalize saturate1/2 to work with logical
    connectives like \ and ,
  • sbar(P) --gt np(x), s(P), saturate1(P,x).
  • sbar(P) --gt s(P).
  • s(P) --gt vp(P).
  • s(P) --gt np(X), vp(P), saturate1(P,X).
  • np(john) --gt john.
  • np(pete) --gt pete.
  • Redefine
  • saturate1((P1,P2),X) - saturate1(P1,X),
    saturate1(P2,X).
  • saturate1((\ P),X) - saturate1(P,X).
  • saturate1(P,X) - arg(1,P,X).

17
Lambda Calculus
  • Two lectures ago...
  • Basic mechanisms
  • lambda expression
  • variable substitution
  • variable substitution
  • aka Beta (ß)-reduction
  • cut-and-paste
  • variable renaming
  • aka Alpha (a)-reduction
  • to avoid variable name clashes
  • e.g. rename xs to ys

likes likes(X,Y). likes ?y.?x.x likes y
?y.?x.x likes y(Mary)
?x.x likes Mary ?y.y likes Mary
18
Lambda Calculus
  • Relative Clauses (also Topicalization)
  • (7) Hannibal is who Shelby saw
  • who Shelby saw has meaning ?x.Shelby saw x

Hannibal happy
Shelby saw Hannibal
?x.x happy
Hannibal
?x.Shelby saw x
?x.x happy
?y.y
?x.Shelby saw x
?y.y saw x(Shelby)
Shelby saw x
?x
?y.y saw x
Shelby
?x.?y.y saw x
x
19
Chapter 4 Modifiers
20
Chapter 4 Modifiers
  • Examples
  • (1) Ossie is a bird bird(ossie).
  • bird predicative nominal
  • (2) Ossie is tall tall(ossie).
  • tall predicative adjective
  • (3) Ossie is a tall bird
  • tall attributive adjective (modifies noun bird)
  • what is the semantics of (3)?

21
Chapter 4 Modifiers
  • Example
  • (3) Ossie is a tall bird
  • One view (intersective)
  • tall tall(X).
  • bird bird(X).
  • tall bird tall(X), bird(X).
  • Ossie is a tall bird tall(ossie), bird(ossie).
  • How do we encode this in the lambda calculus?

22
Chapter 4 Modifiers
  • Example
  • (3) Ossie is a tall bird
  • Problems with the intersective viewpoint
  • tall(X) set of things that are tall, say, T
  • bird(X) set of birds, say, B
  • tall(X), bird(X) intersection, so T n B.

But isnt tall a relative concept? e.g. tall bird
tall for a bird (cf. dead as in dead bird)
set intersection
Not all adjectives are intersective e.g. former
as in former teacher
23
Chapter 4 Modifiers
  • Example
  • (3) Ossie is a tall bird
  • Another viewpoint (roughly)
  • (diagram 23 in Chapter 4)
  • tall ?p.?x.p x x is taller_than p average
  • bird bird
  • tall bird ?p.?x.p x x is taller_than p
    average(bird)
  • ?x. bird x x is taller_than bird average
  • Ossie is a tall bird
  • ?x. bird x x is taller_than bird
    average(Ossie)
  • bird Ossie Ossie is taller_than bird average
Write a Comment
User Comments (0)
About PowerShow.com