Download presentation

Presentation is loading. Please wait.

Published bySydni Winford Modified over 3 years ago

1
CSA4050: Advanced Topics in NLP Semantics IV Partial Execution Proper Noun Adjective

2
Partial Execution Partial execution involves the replacing of certain runtime computations with changes to the source of the Prolog program itself. For example, we can replace the rule: s(S) --> np(NP), vp(VP) { reduce(NP,VP,S) }. with s(S) --> np(VP^S), vp(VP). This is because the computation of reduce involves only the mutual binding of several variables.

3
How it works s(S) --> np(NP), vp(VP) {reduce(NP,VP,S)}. 1. match reduce(A^F,A,F) 2. rewrite s(F) --> np(A^F), vp(A). 3. rename s(S) --> np(VP^S), vp(VP).

4
Exercise 1 What is the result of eliminating the reduce clause by partial execution in the following rule? np(NP) --> d(D), n(N), {reduce(D,N,NP)}.

5
Answer np(NP) --> d(D), n(N) { reduce(D,N,NP)}. 1. match reduce(A^F,A,F) 2. rewrite np(F) --> d(A^F), n(A). 3. rename np(NP) --> d(N^NP), n(N).

6
DCG with Quantification Program 4 % grammar s(S) --> np(VP^S), vp(VP). np(NP) --> d(N^NP), n(N). vp(VP) --> v(VP). % lexicon v(X^walk(X)) --> [walks]. n(X^man(X)) --> [man]. n(suzie)--> [‘Suzie’]. det(RL^SL^all(X,R,S) --> [every], {reduce(RL,X,R), reduce(SL,X,S) }.

7
Handling Proper Nouns The grammar handles every man walks X = all(_G, man(_G), walk(_G)) Will this grammar parse Suzie walks? Let’s try it! ?- s(X,['Suzie',walks],[ ]).

8
October 20048 ?- s(X,['Suzie',walks],[ ]). Call: (8) s(_G492, ['Suzie', walks], []) ? Call: (9) np(_L183, ['Suzie', walks], _L184) ? Call: (10) pn(_L183, ['Suzie', walks], _L184) ? Exit: (10) pn(suzie, ['Suzie', walks], [walks]) ? Exit: (9) np(suzie, ['Suzie', walks], [walks]) ? Call: (9) vp(_L185, [walks], _L186) ? Call: (10) iv(_L185, [walks], _L186) ? Exit: (10) iv(_G556^walk(_G556), [walks], []) ? Exit: (9) vp(_G556^walk(_G556), [walks], []) ? Call: (9) reduce(suzie, _G556^walk(_G556), _G492) ? Fail: (9) reduce(suzie, _G556^walk(_G556), _G492)?........ suzie is not a function

9
Handling Proper Nouns Problem is with the “type” of LF of Suzie. We require that LF of Suzie has the same type as any other NP - such as every man, i.e. –As a lambda expression it would be λp.p(suzie). –In Prolog we can regard this as a function from [VP] to [S] such that reduce(VP,suzie,S) holds.

10
DCG with Quantification Program 4 % grammar s(S) --> np(VP^S), vp(VP). np(NP) --> n(NP). np(NP) --> d(N^NP), n(N). vp(VP) --> v(VP). % lexicon v(X^walk(X)) --> [walks]. n(X^man(X)) --> [man]. n(VP^S) --> [suzie],{reduce(VP,suzie,S)}. d(RL^SL^all(X,R => S)) --> [every], {reduce(RL,X,R), reduce(SL,X,S) }.

11
Exercise 2 Using partial execution, eliminate the reduce clause in pn(VP^S) --> [‘Suzie’],{reduce(VP,suzie,S)}.

12
s(X, ['Suzie', walks], [ ]) ? Call: (7) s(_G292, ['Suzie', walks], []) ? ↓ Exit: (9) pn((suzie^_G357)^_G357, ['Suzie', walks], [walks]) ? ↓ Exit: (9) iv(_G362^walk(_G362), [walks], []) ? Exit: (8) vp(_G362^walk(_G362), [walks], []) ? : Call: (8) reduce((suzie^_G357)^_G357, _G362^walk(_G362), _G292) ? : Exit: (8) reduce((suzie^walk(suzie))^walk(suzie), suzie^walk(suzie), walk(suzie)) ? Exit: (7) s(walk(suzie), ['Suzie', walks], []) ? creep X = walk(suzie)

13
Adjectives In english, adjectives combine with nouns, e.g. big dog. We will call the an adjective/noun combination (without the article) N1. Here is a syntactic rule for a simplified version of N1: N1 → A N N1 NA big dog

14
Semantics of N1 Adjectives and common nouns translate to one-place predicates. big = x.big(x) dog = x.dog(x) To get the semantics of the N1 we need to join the predicates together with & (and), i.e. big dog = x.big(x) & dog(x)

15
N1 in Prolog %grammar n1(X^(P&Q)) --> a(X^P), n(X^Q). %lexicon n(X^dog(X)) --> [dog]. a(X^big(X)) --> [big]. Behaviour is as follows: ?- n1(X, [big,dog],[]). X = _G343^ (big(_G343)&dog(_G343))

Similar presentations

OK

Combining Like Terms. Only combine terms that are exactly the same!! Whats the same mean? –If numbers have a variable, then you can combine only ones.

Combining Like Terms. Only combine terms that are exactly the same!! Whats the same mean? –If numbers have a variable, then you can combine only ones.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on conceptual artists Ppt on unity in diversity Ppt on indian sign language Ppt on pin photodiode Ppt on object-oriented programming concepts in java Ppt on advancement in science and technology Ppt on cross docking pictures Ppt on chapter 3 atoms and molecules lesson Ppt on steve jobs biography Ppt on network file system