Download presentation
Presentation is loading. Please wait.
1
LING 581: Advanced Computational Linguistics
Lecture Notes April 24th
2
Administrivia Thanks for submitting homework 9 – I've commented on a few of your submissions
3
From last time psg2.pl
4
From last time psg2.pl
5
Evaluation Check our computer implementation on… fjpSlides4.pdf
6
Evaluation Load psg2.pl into SWI Prolog; Syntax: (S) Proposition (P):
?- s(P,S,[jack,is,hungry],[]). P = (findall(_1820, is_hungry(_1820), _1796), member(jack, _1796)), S = s(n(jack), vp(v(v(is), ap(hungry)))) ; false. Syntax: (S) Proposition (P): find all X s.t. is_hungry(X) is true. Name that list S Jack must be a member of S
7
Evaluation James likes Jack: Syntax: (S) Proposition (P):
?- s(P,S,[james,likes,jack],[]). P = (findall(_90, likes(_90, jack), _62), member(james, _62)), S = s(n(james), vp(vt(likes), n(jack))) ; false. Syntax: (S) Proposition (P): find all X s.t. likes(X,jack) is true. Name that list S James must be a member of S
8
Evaluation Proposition (P): Syntax:
It s not the case that James likes Jack: ?- s(P,S,[it,is,not,the,case,that,james,likes,jack],[]). P = (\+ (findall(_102, likes(_102, jack), _74), member(james, _74))), S = s(neg, s(n(james), vp(vt(likes), n(jack)))) ; false. Proposition (P): find all X s.t. likes(X,jack) is true. Name that list S James must NOT be a member of S Syntax: (S)
9
Evaluation Syntax (S):
Jack is hungry, and it s not the case that James likes Jack: ?- s(P,S,[jack,is,hungry,and,it,is,not,the,case,that,james,likes,jack],[]). P = ((findall(_178, is_hungry(_178), _154), member(jack, _154)), \+ (findall(_288, likes(_288, jack), _250), member(james, _250))), S = s(s(n(jack), vp(v(v(is), ap(hungry)))), conj(and), s(neg, s(n(james), vp(vt(likes), n(jack))))) ; false. Syntax (S):
10
Evaluation Proposition (P1): find all X s.t. is_hungry(X) is true.
Jack is hungry, and it s not the case that James likes Jack: ?- s(P,S,[jack,is,hungry,and,it,is,not,the,case,that,james,likes,jack],[]). P = ((findall(_178, is_hungry(_178), _154), member(jack, _154)), \+ (findall(_288, likes(_288, jack), _250), member(james, _250))), S = s(s(n(jack), vp(v(v(is), ap(hungry)))), conj(and), s(neg, s(n(james), vp(vt(likes), n(jack))))) ; false. Proposition (P1): find all X s.t. is_hungry(X) is true. Name that list S Jack must be a member of S Proposition (P2): find all X s.t. likes(X,jack) is true. Name that list S James must NOT be a member of S P1 and P2 true
11
Evaluation Situations:
Assert facts into database Closed world assumption: is fact is not in database, false. Prolog requires use to declare predicates (to guard against programming errors) using dynamic predicate/arity (= # of arguments)
12
Evaluation Situation V': Jack is hungry, and it is not the case that James likes Jack Assume: ?- assert(is_hungry(jack)). true. ?- dynamic likes/2. i.e.: ?- likes(jack, james). false. ?- s(P,_,[jack,is,hungry,and,it,is,not,the,case,that,james,likes,jack],[]), call(P). P = ((findall(_2668, is_hungry(_2668), [james, jack]), member(jack, [james, jack])), \+ (findall(_2778, likes(_2778, jack), _2740), member(james, _2740))) ; false. True!
13
Evaluation Situation V'': Jack is hungry, and it is not the case that James likes Jack Assume: ?- assert(is_hungry(jack)). true. ?- assert(likes(jack, james)). ?- s(P,_,[jack,is,hungry,and,it,is,not,the,case,that,james,likes,jack],[]), call(P). false. False!
14
Evaluation Consider now (16) below (note the bracketing!):
15
Evaluation Situation V''': It is not the case that Jack is hungry or Sophia is boring ?- s(P,S,[it,is,not,the,case,that,jack,is,hungry,or,sophia,is,boring],[]). P = (\+ (findall(_18234, is_hungry(_18234), _18210), member(jack, _18210));findall(_18314, is_boring(_18314), _18290), member(sophia, _18290)), S = s(s(neg, s(n(jack), vp(v(v(is), ap(hungry))))), conj(or), s(n(sophia), vp(v(v(is), ap(boring))))) ; P = (\+ (findall(_18162, is_hungry(_18162), _18138), member(jack, _18138);findall(_18242, is_boring(_18242), _18218), member(sophia, _18218))), S = s(neg, s(s(n(jack), vp(v(v(is), ap(hungry)))), conj(or), s(n(sophia), vp(v(v(is), ap(boring)))))) ; false. 1st parse: Narrow scope for negation 2nd parse: Wide scope for negation
16
Evaluation Situation V''': It is not the case that Jack is hungry or Sophia is boring ?- assert(is_hungry(jack)). true. ?- assert(is_boring(sophia)). Cut (!) preserves only the first reading (narrow scope for neg): ?- s(P,_,[it,is,not,the,case,that,jack,is,hungry,or,sophia,is,boring], []), !, call(P). P = (\+ (findall(_2828, is_hungry(_2828), _2804), member(jack, _2804));findall(_2908, is_boring(_2908), [sophia]), member(sophia, [sophia])). True!
17
Evaluation Suppose Jack is not hungry, does this change the proposition's truth value? ?- retract(is_hungry(jack)). true. ?- is_hungry(jack). false. Still true! ?- s(P,_,[it,is,not,the,case,that,jack,is,hungry,or,sophia,is,boring],[]), !, call(P). P = (\+ (findall(_2838, is_hungry(_2838), _2814), member(jack, _2814));findall(_2918, is_boring(_2918), _2894), member(sophia, _2894)) .
18
Evaluation Almost situation V'''': It is not the case that Jack is hungry or Sophia is boring ?- retract(is_boring(sophia)). true. ?- is_boring(sophia). false. Since Jack is not hungry, proposition remains true! ?- s(P,_,[it,is,not,the,case,that,jack,is,hungry,or,sophia,is,boring],[]) , !, call(P). P = (\+ (findall(_2844, is_hungry(_2844), _2820), member(jack, _2820));findall(_2924, is_boring(_2924), _2900), member(sophia, _2900)) .
19
Evaluation Proposition now false!
Now situation V'''': It is not the case that Jack is hungry or Sophia is boring ?- assert(is_hungry(jack)). true. Proposition now false! ?- s(P,_,[it,is,not,the,case,that,jack,is,hungry,or,sophia,i s,boring],[]), !, call(P). false.
20
Quantifiers nobody has seen a unicorn means roughly (Prolog-style):
Not all noun phrases (NPs) are (by nature) directly referential like names Quantifiers: “something to do with indicating the quantity of something” Examples: every child nobody two dogs several animals most people nobody has seen a unicorn means roughly (Prolog-style): ?- setof(X,(person(X), seen(X,Y), unicorn(Y)),Set),cardinality(Set,0).
21
Quantifiers Database setof vs. findall (recall last lecture) Fix:
nobody has seen a unicorn means roughly (Prolog-style): ?- setof(X,(person(X), seen(X,Y), unicorn(Y)),Set),cardinality(Set,0). Database setof vs. findall (recall last lecture) Fix:
22
Quantifiers Semantic compositionality: Example:
elements of a sentence combine in piecewise fashion to form an overall (propositional) meaning for the sentence Example: (4) Every baby cried Word Meaning cried cried(X). baby baby(X). every ? every baby cried proposition (True/False) that can be evaluated for a given situation
23
Quantifiers Scenario (Possible World):
suppose there are three babies... baby(noah). baby(merrill). baby(dani). all three cried cried(noah). cried(merrill). cried(dani). only Dani jumped jumped(dani). Noah and Dani swam swam(noah). swam(dani). (6) every baby exactly one baby most babies cried ✓ jumped swam think of quantifiers as “properties-of-properties” every_baby(P) is a proposition P: property every_baby(P) true for P=cried every_baby(P) false for P=jumped and P=swam
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.