130 likes | 246 Vues
In this lecture, we delve into the complexities of quantifiers within advanced computational linguistics. Topics include semantic annotation of organism morphological descriptions, homework on Montague and Barwise-Cooper style grammars, and Prolog implementations to evaluate logical queries. We explore examples of quantifications using the sentence structure "Every man likes John" and propose practical homework tasks to apply Prolog grammar in various scenarios. Join us for insights into syntax, semantics, and the power of Prolog for determining truth values in different contexts.
E N D
LING 581: Advanced Computational Linguistics Lecture Notes March 29th
Today’s Topics Part 1 • Homework (hopefully) demystified • + Presentations Part 2 • Semantic Annotation of Organism Morphological Descriptions • last week’s presentation from Prof. Hong Cui • propose projects • corpora and glossaries: • USB stick directory 581-12/ passed around ….
Quantifiers • Example: [S [NP [Q every][N man]][VP [V likes][NP John]]] • WordExpression • every λP1.[λP2.[∀X (P1(X) -> P2(X))]] • man man • likes λY.[λX.[ X likes Y]] • John John
Quantifiers: Homework • Example: [S [NP [Q every][N man]][VP [V likes][NP John]]] • WordExpression • every λP1.[λP2.[∀X (P1(X) -> P2(X))]] • man man • likes λY.[λX.[ X likes Y]] • John John • Semantics: ∀X (man(X) -> [ X likes John]) Part 1: Montague-style Implement a Prolog grammar that assembles the equivalent Prolog query for the above sentence • Semantics (Prolog): \+ (man(X), \+likes(X,john)) Present your grammar and working examples of situations for which the Prolog query evaluates to true/false \+ (baby(X), \+walks(X)) is Prolog for ∀X (baby(X) -> walks(X)) (from lecture 9)
Quantifiers: Homework • One possible grammar: want to call likes(_G318,John) Solution: make variables the same and then do the call
Quantifiers: Homework • Situation #1: Nice thing about the grammar is that the computed expression is a real program Thus truth values for the sentence can be determined for particular situations • Situation #2:
Quantifiers: Homework • Situation #3:
Quantifiers: Homework Part 2: Barwise-Cooper-style • Syntax: [S [NP [Q every][N man]][VP [V likes][NP John]]] • Semantics: {X: man(X)} ⊆ {X: likes(X,John)} • Prolog : setof(X,man(X),S1), setof(X,likes(X,john),S1), subset(S1,S2). Implement a Barwise-Cooper style grammar and test the Prolog query on relevant situations. • Prolog programming help • Prolog predicate names cannot be variables • P(X). is illegal, p(X). is okay • p(X), X = john. is okay • P(X), P = man. isn’t • P =man, PX =.. [P,X]. is okay. (PX=man(X))
Quantifiers: Homework • Grammar (first attempt):
Quantifiers: Homework • Recall: semantics of setof/3 vs. bagof/3. vs. findall/3. setof(X,call(man,X),Set) fails when the set is empty
Quantifiers: Homework • Modify setof/3 to return empty set instead of failing, call new predicate setof1/3:
Quantifiers: Homework Part 3: Coordination • Extend your two grammars to handle • Every man and every woman likes John Make up homework exercise! do Part 3 given what you now know about Parts 1 and 2