csa2050: definite clause grammars iv

22
22.05.2003 CSA2050: DCG IV 1 CSA2050: Definite Clause Grammars IV Handling Gaps II Semantic Issues

Upload: amela-simmons

Post on 01-Jan-2016

19 views

Category:

Documents


1 download

DESCRIPTION

CSA2050: Definite Clause Grammars IV. Handling Gaps II Semantic Issues. Resum é. Relative clauses such as the book that Bertrand wrote are derived from a corresponding sentence Bertrand wrote the book [that] Bertrand wrote the book. Deriving the DCG. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 1

CSA2050:Definite Clause Grammars

IVHandling Gaps IISemantic Issues

Page 2: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 2

Resumé

• Relative clauses such asthe book that Bertrand wrote are derived from a corresponding sentenceBertrand wrote the book

• [that] Bertrand wrote the book

Page 3: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 3

Deriving the DCG

• We can write down the parts of speechThe book [that] Bertrand wrote

D N RELPRON N V np(gap)

• … and try to build the grammar rules. A naïve approach is to derive DCG rule directlyNP --> D N RELPRON N V np(gap)

• A better approach isNP --> D N optrel

np(gap)

Page 4: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 4

Rules for optrel(optional relative clause)

• optrel --> [ ].An optrel is optional.

• optrel --> relpron, s(gap(np)).An optrel can be "that" followed by a sentence with a missing np object

• Next we look at rule for producing s with and without gaps, i.e. s(nogap) and s(gap(np)).

Page 5: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 5

Rules for S

• s --> s(nogap)A sentence can either have no gap

• s --> s(gap(np))or it can have a gap(np) feature. Where does S get the gap feature from?

• s(G) --> np(nogap), vp(G).It comes from the VP. Note that the subject NP cannot have a gap (i.e. be empty).

Page 6: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 6

Rules for VP

• vp(G) --> v, np(G).In the case of a transitive verb the gap feature is inherited from the object NP.

• vp(nogap) --> v.In the case of an intransitive verb, the VP has no gap.

Page 7: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 7

Rules for NP

• np(nogap) --> det, n, optrel.Normal NP case

• np(nogap) --> n.This covers case of plurals or proper nouns.

• np(gap(np)) --> [ ].The gap case – no lexical material appears on the surface

Page 8: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 8

Grammar and Lexicon

% grammars --> s(nogap).s --> s(gap(np)).s(G) --> np(nogap), vp(G).np(nogap) --> det,n,optrelnp(nogap) --> n.np(gap(np)) --> [ ].optrel --> [ ].optrel --> rel,

s(gap(np)).optrel --> rel, vp(nogap).vp(G) --> v, np(G).vp(nogap) --> v.

% lexicon

n --> [john].

n --> [bertrand].

n --> [program].

rel --> [that].

det --> [the].

v --> [halts].

v --> [wrote].

Page 9: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 9

Call: (6) s(_G395, [john, wrote], []) ? creep Call: (7) np(nogap, [john, wrote], _G459) ? creep Call: (8) det([john, wrote], _G458) ? creep Fail: (8) det([john, wrote], _G458) ? creep Redo: (7) np(nogap, [john, wrote], _G459) ? creep Call: (8) n([john, wrote], _G458) ? creep Exit: (8) n([john, wrote], [wrote]) ? creep Exit: (7) np(nogap, [john, wrote], [wrote]) ? creep Call: (7) vp(_G395, [wrote], []) ? creep Call: (8) v([wrote], _G458) ? creep Exit: (8) v([wrote], []) ? creep Call: (8) np(_G395, [], []) ? creep Call: (9) det([], _G458) ? creep Fail: (9) det([], _G458) ? creep Redo: (8) np(_G395, [], []) ? creep Call: (9) n([], []) ? creep Fail: (9) n([], []) ? creep Redo: (8) np(_G395, [], []) ? creep Exit: (8) np(gap(np), [], []) ? creep Exit: (7) vp(gap(np), [wrote], []) ? creep Exit: (6) s(gap(np), [john, wrote], []) ? creep X=gap(np)

Page 10: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 10

Handling NLP Semantics

• In order handle semantics of NL sentences we have to do at least the following:

– Decide what is meant by semantics.– Create a suitable representation to encode

the semantics.– Figure out how to compute the semantic

representation of sentences– Link this computation to the to the

grammar and lexicon.

Page 11: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 11

Remarks on DCGs

• Simple tool for encoding CFG• Arguments, variables and arbitrary

progams take it beyond CF power, but can get clumsy and yield unreadable grammars

• Reasonable for linguistic applications, but cannot handle left recursion.

• Compared to standard PLs, you get quite far quite fast.

Page 12: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 12

Semantics:

• Semantics is the study of the meaning of words, phrases, and sentences in language.

• Semantics explores the minimum of knowledge about a linguistic sign or combinations of signs such that the expression can convey a specific communicative content. [Olsen et. Al http://www2.rz.hu-berlin.de/angl/ling_pages/semantics.html]

Page 13: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 13

Semantic Theories

• Cognitive Semantics (Rosch 1973)– word/concept oriented– prototype theory: meanings are identified,

often pictorially, by characteristic instances of whatever class of objects, etc. a word denotes

• Truth Conditional Semantics (Hume, Russell, Carnap, Frege…)

Page 14: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 14

Truth Conditional Semantics

• Basic idea behind TCS is that to know the meaning of a sentence is know exactly the conditions under which it is true.

• So for example you know the meaning of "Gianni ate fish yesterday" if you know exactly how to apply it to the real world and decide whether it is true or false.

• On this view, the task of semantic theory is to define the truth conditions of sentences.

Page 15: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 15

Expressing Truth Conditions

• If semantics identifies truth conditions, how can they be expressed: i.e, how are they written down?

• Logical form (LF) is the notation we use formalism we use to write down the truth conditions.

• One example of logical form is first order logic (FOL)

Page 16: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 16

word POS Logic Representation

Mike proper noun individual constant

mike

cow common noun

1 place predicate

cow(x)

red adjective 1 place predicate

red(x)

big red car adj/noun 1 place predicate

big(x) & red(x) & car(x)

sleeps intrans verb 1 place predicate

sleep (x)

kicks trans. verb 2 place predicate

kick(x,,y)

gives ditrans verb 3 place pred give(x,y,z)

Page 17: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 17

Logical Forms of Sentences

• John kicked Fido:kick(john,fido)

• Every student wrote a programall(x,student(x) => exist(y, program(y)& write(x,y))).

exist(y, program(y) all(x,student(x) => write(x,y))).

• Ambiguity• Relation between semantics of sentence and

subphrases

Page 18: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 18

Compositional Semantics Frege's Principle of Compositionality

• The semantics of the whole sentence can be computed from the semantics of the subphrases, i.e.

• Given the syntactic rule X Y Z.• Suppose [Y], [Z] are the LFs of Y, and

Z respectively.• Then [X] = ([Y],[Z]) where is some

function for semantic combination

Page 19: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 19

Richard Montague:Rule to Rule Hypothesis

• Each context free syntax rules is associated with a semantic rule that describes how the LF of the LHS category is composed from the LF of its subconstituents

• 1:1 corrspondence between syntax and semantics. Can and does lead to difficulties.

• Functional composition proposed as the mechanism for descibing the composition.

• Lambda calculus.

Page 20: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 20

Sentence Rule

• Syntactic Rule:S NP VP

• Semantic Rule:[S] = [VP]([NP])i.e. the LF of S is obtained by "applying" the LF of VP to the LF of NP.

• For this to be possible [VP] must be a function, and [NP] the argument to the function.

Page 21: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 21

Swrite(bertrand,principia)

NPbertand

VPy.write(y,principia)

Vx.y.write(y,x)

NPprincipia

bertrand

writes principia

Parse Tree with Logical Forms

Page 22: CSA2050: Definite Clause Grammars IV

22.05.2003 CSA2050: DCG IV 22

Problems

• Truth Conditional Semantics problems: not all sentences have a truth value.questions; orders; speech acts.

• Determiners and Quantification: exact truth conditions are hard to formulateyou can fool most of the people most of the time.

• Lambda calculus is too powerful.