LING 364: Introduction to Formal Semantics Lecture 8 February 7th.

Slides:



Advertisements
Similar presentations
Review of Homework 4 November 20, Exercise 1 (A) 1 pt Modify the DCG to accept the omission of the complementizer that for object relative clauses.
Advertisements

CSA2050: DCG I1 CSA2050 Introduction to Computational Linguistics Lecture 8 Definite Clause Grammars.
Logic Programming – Part 2 Lists Backtracking Optimization (via the cut operator) Meta-Circular Interpreters.
Logic Programming – Part 2 Lists Backtracking Optimization (via the cut operator) Meta-Circular Interpreters.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/5.
LING 364: Introduction to Formal Semantics Lecture 24 April 13th.
LING 388: Language and Computers Sandiway Fong Lecture 5: 9/8.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 13: 10/9.
LING 388: Language and Computers Sandiway Fong Lecture 2: 8/24.
LING 388: Language and Computers Sandiway Fong Lecture 2: 8/25.
LING 388: Language and Computers Sandiway Fong Lecture 15.
LING 581: Advanced Computational Linguistics Lecture Notes April 23rd.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 3: 8/29.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/12.
LING 364: Introduction to Formal Semantics Lecture 10 February 14th.
LING 364: Introduction to Formal Semantics Lecture 12 February 21st.
LING 364: Introduction to Formal Semantics Lecture 14 February 28th.
LING 388 Language and Computers Lecture 2 9/04/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 9 February 9th.
LING 438/538 Computational Linguistics Sandiway Fong Lecture 9: 9/21.
LING 364: Introduction to Formal Semantics
LING 388: Language and Computers Sandiway Fong Lecture 12: 10/5.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 8: 9/18.
LING 364: Introduction to Formal Semantics Lecture 17 March 9th.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 7: 9/11.
LING 364: Introduction to Formal Semantics Lecture 27 April 27th.
LING 364: Introduction to Formal Semantics Lecture 4 January 24th.
LING/C SC/PSYC 438/538 Computational Linguistics Sandiway Fong Lecture 6: 9/6.
LING 364: Introduction to Formal Semantics Lecture 11 February 16th.
LING 388: Language and Computers Sandiway Fong Lecture 6: 9/7.
LING 364: Introduction to Formal Semantics Lecture 22 April 6th.
LING 364: Introduction to Formal Semantics Lecture 2 January 17th.
LING 388: Language and Computers Sandiway Fong Lecture 4: 8/31.
LING 388: Language and Computers Sandiway Fong Lecture 11: 10/3.
LING 388: Language and Computers Sandiway Fong Lecture 3: 8/29.
LING 388 Language and Computers Take-Home Final Examination 12/9/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 7 February 2nd.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
LING 364: Introduction to Formal Semantics Lecture 16 March 7th.
LING 364: Introduction to Formal Semantics Lecture 3 January 19th.
LING 388 Language and Computers Lecture 18 10/30/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 17: 10/25.
LING 364: Introduction to Formal Semantics Lecture 13 February 23rd.
LING 388 Language and Computers Lecture 7 9/23/03 Sandiway FONG.
LING 364: Introduction to Formal Semantics Lecture 5 January 26th.
LING 388 Language and Computers Lecture 17 10/28/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong Lecture 13: 10/10.
LING 388 Language and Computers Lecture 12 10/9/03 Sandiway FONG.
LING 388 Language and Computers Lecture 6 9/18/03 Sandiway FONG.
LING 388: Language and Computers Sandiway Fong 10/4 Lecture 12.
LING 388: Language and Computers Sandiway Fong Lecture 11.
October 2004csa4050: Semantics II1 CSA4050: Advanced Topics in NLP Semantics II The Lambda Calculus Semantic Representation Encoding in Prolog.
LING 388: Language and Computers Sandiway Fong Lecture 14 10/11.
LING 581: Advanced Computational Linguistics Lecture Notes April 16th.
LING 388: Language and Computers Sandiway Fong Lecture 4.
LING 388: Language and Computers Sandiway Fong Lecture 7.
LING 388: Language and Computers Sandiway Fong Lecture 6.
LING 581: Advanced Computational Linguistics Lecture Notes February 16th.
LING 388: Language and Computers Sandiway Fong Lecture 10.
LING 388: Language and Computers Sandiway Fong Lecture 13.
1 CMSC 250 Discrete Structures CMSC 250 Lecture 1.
Albert Gatt LIN3021 Formal Semantics Lecture 4. In this lecture Compositionality in Natural Langauge revisited: The role of types The typed lambda calculus.
1 CS161 Introduction to Computer Science Topic #17.
1 CS1502 Formal Methods in Computer Science Notes 15 Problem Sessions.
Chapter 1 Propositional Logic
LING 581: Advanced Computational Linguistics
Natural Language Processing
LING/C SC/PSYC 438/538 Lecture 21 Sandiway Fong.
LING 581: Advanced Computational Linguistics
·Answer in complete sentences ·Page 17 - # 2
Presentation transcript:

LING 364: Introduction to Formal Semantics Lecture 8 February 7th

Administrivia again this Thursday –(3:30pm – 4:40pm) lecture here in Comm 214 –(4:45pm – 5:45pm) (EXTRA) lab practice in Social Sciences Lab 224

Administrivia Homework 1 –all graded and returned by

Last Time Modify DCG into one that includes phrase structure Basic DCG: sentence --> np, vp. vp --> v, np. v --> [likes]. np --> [john]. np --> [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)) --> np(NP), vp(VP). vp(vp(V,NP)) --> v(V), np(NP). v(v(likes)) --> [likes]. np(np(john)) --> [john]. np(np(mary)) --> [mary]. Modified Query: (supply one more argument) ?- sentence(PS,[john,likes,mary],[]). PS = sentence(np(john),vp(v(likes),np(mary))) sentence np John np vp v Mary likes sentence(np(john),vp(v(likes),np(mary)))

Last Time modify basic DCG into one that includes meaning Basic DCG: sentence --> np, vp. vp --> v, np. v --> [likes]. np --> [john]. np --> [mary]. Query: (we supply two arguments: sentence as a list and an empty list) ?- sentence([john,likes,mary],[]). Yes (Answer) Meaning DCG: –sentence(P) --> np(NP1), vp(P), {saturate1(P,NP1)}. –vp(P) --> v(P), np(NP2), {saturate2(P,NP2)}. –v(likes(X,Y)) --> [likes]. –np(john) --> [john]. –np(mary) --> [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)0 argument saturation arg(Nth,Predicate,Argument) means make Nth argument of Predicate equal to Argument { } means call Prolog {arg(2,VBm,NPm)} means call arg(2,VBm,NPm) sentence np vp v John Mary likes marylikes(X,Y) likes(X,mary)john likes(john,mary)

Today’s Topics Review of Homework 1 –make sure we all understand what’s going on... Homework 2 –usual rules –due one week from today – submission (inbox by midnight)

For next time Handout –Chapter 3: More about Predicates Short Quiz #3 on Thursday –(Chapter 4: Modifiers) don’t need to read this for next time

Homework 1 Review

Exercise 1a (4pts) Enter Prolog facts corresponding to: –Mary is a student –Pete is a student –Mary is a baseball fan –Pete is a baseball fan –John is a baseball fan Construct the Prolog query corresponding to: –who is both a student and a baseball fan? Run the query Sample Answer: student(mary). student(pete). baseball_fan(mary). baseball_fan(pete). baseball_fan(john). ?- student(X), baseball_fan(X). X = mary ; X = pete ; No

Homework 1 Review Exercise 1b (2pts) Construct the Prolog query corresponding to: –who is a baseball fan and not a student? Run the query Sample Answer: ?- baseball_fan(X), \+ student(X). X = john ; No

Homework 1 Review Exercise 2 (4pts) –Two sentences are synonymous if they have the same meaning, i.e. they have the same truth conditions: –(5) The square is bigger than the circle –(6) The circle is smaller than the square –(chapter 1: page 18) –we know –(R2) If X is bigger than Y, then Y is smaller than X Write the Prolog fact and rule corresponding to (5) and (R2) Demonstrate you can conclude (6) Sample Answer: bigger_than(square,circle). smaller_than(Y,X) :- bigger_than(X,Y). ?- smaller_than(circle,square). Yes

Homework 1 Review Exercise 3a (2pts) –Two sentences are contrary if both can’t be true: –(7) The square is bigger than the circle –(8) The square is smaller than the circle –(chapter 1: page 19) Enter the Prolog fact corresponding to (7) and use (R2) from exercise 2 Construct the Prolog query corresponding to the conjunction of (7) and (8). Show the result of the query. Sample Answer: bigger_than(square,circle). smaller_than(Y,X) :- bigger_than(X,Y). ?- bigger_than(square,circle), smaller_than(square, circle). No

Homework 1 Review Exercise 3b (3pts) –Two sentences are contrary if both can’t be true: –(7) The square is bigger than the circle –(8) The square is smaller than the circle –(chapter 1: page 19) Enter the Prolog fact corresponding to (8) and (R3) –(R3) If X is smaller than Y, then Y is bigger than X Construct the Prolog query corresponding to the conjunction of (7) and (8). Show the result of the query. Sample Answer: smaller_than(square,circle). bigger_than(Y,X) :- smaller_than(X,Y). ?- bigger_than(square,circle), smaller_than(square, circle). No

Homework 1 Review Exercise 4 (4pts) Extra Credit From Quiz 1: –3. Given the statement “All crows are black”, give an example of a sentence expressing a tautology involving this statement? Possible answer: –All crows are black or not all crows are black Let Prolog predicate p/0 denote the proposition “All crows are black” –?- assert(p). “All crows are black is true in this world” Construct the Prolog version of the tautology Show that it is true no matter what the scenario Construct a contradictory statement involving p Show that it is false not matter what the scenario Sample Answer: Possible World #1 ?- assert(p). ?- p; \+ p. Yes ?- p, \+ p. No ?- retract(p). Possible World #2 ?- p; \+ p. Yes ?- p, \+ p. No

Homework 2

Exercise 1 (5pts) Give a basic DCG grammar that covers the following sentences –[ Sbar [ S [ NP John] [ VP [ V is][ NP [ DET a][ N student]]]]] –[ Sbar [ S [ NP Pete] [ VP [ V is][ NP [ DET a][ N student]]]]] –[ Sbar [ S [ NP Mary] [ VP [ V is][ NP [ DET a][ N baseball fan]]]]] –[ Sbar [ S [ NP Pete] [ VP [ V is][ NP [ DET a][ N baseball fan]]]]] –[ Sbar [ S [ NP John] [ VP [ V is][ NP [ DET a][ N baseball fan]]]]] Show your grammar accepts the sentences –e.g. the query ?- sbar([john,is,a,student],[]). should return Yes

Exercise 2 (4pts) Augment your grammar to include the following questions –[ Sbar [ NP Who] [ S [ VP [ V is][ NP [ DET a][ N student]]]]] –[ Sbar [ NP Who] [ S [ VP [ V is][ NP [ DET a][ N baseball fan]]]]] –[ Sbar [ NP Who] [ S [ VP [ V is][ NP [ NEG not] [ NP [ DET a][ N student]]]]]] –[ Sbar [ NP Who] [ S [ VP [ V is][ NP [ NEG not] [ NP [ DET a][ N baseball fan]]]]]] Show your grammar accepts the questions NOTE: –for simplicity, we’re not generating empty categories here

Exercise 3 (4pts) Augment your grammar to include the following conjoined questions –[ Sbar [ NP Who] [ S [ VP [ V is] [ NP [ NP [ DET a][ N student]]]]][ CONJ and][ NP [ DET a][ N baseball fan]]]]]] –[ Sbar [ NP Who] [ S [ VP [ V is] [ NP [ NP [ DET a][ N student]]]]][ CONJ and][ NP [ NEG not][ NP [ DET a][ N baseball fan]]]]]]] Show your grammar accepts the questions HINT: –you need to write a rule for NP conjunction –the order of this rule with respect to the other NP rules will matter for Prolog computation i.e. if your grammar loops, you may want to adjust the order of the rules for NP

Exercise 4 (12pts) Modify your grammar obtained so far, i.e. by Exercise 3, to include phrase structure Show your grammar produces phrase structure for the previously mentioned sentences and questions

Exercise 5 (12pts) Modify your grammar obtained so far, i.e. by Exercise 3, to generate meaning –e.g. student(mary). student(X), \+ baseball_fan(X). Show your grammar produces appropriate meanings for the previously mentioned sentences and questions

Summary Points –Exercise 1: 5pts –Exercise 2: 4pts –Exercise 3: 4pts –Exercise 4: 12pts –Exercise 5: 12pts –Total: 37 pts

Reminder Confused? –Help with homework –Lab session on Thursday...