210 likes | 360 Views
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.
E N D
CSA2050:Definite Clause GrammarsIV Handling Gaps II Semantic Issues CSA2050: DCG IV
Resumé • Relative clauses such asthe book that Bertrand wroteare derived from a corresponding sentenceBertrand wrote the book • [that] Bertrand wrote the book CSA2050: DCG IV
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) CSA2050: DCG IV
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)). CSA2050: DCG IV
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). CSA2050: DCG IV
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. CSA2050: DCG IV
Rules for NP • np(Gap) --> 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 CSA2050: DCG IV
% grammar s --> s(nogap). s --> s(gap(np)). s(G) --> np(nogap), vp(G). np(G) --> det,n,optrel np(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]. Grammar and Lexicon CSA2050: DCG IV
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) CSA2050: DCG IV
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. CSA2050: DCG IV
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] CSA2050: DCG IV
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…) CSA2050: DCG IV
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. CSA2050: DCG IV
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) CSA2050: DCG IV
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 CSA2050: DCG IV
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 CSA2050: DCG IV
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. CSA2050: DCG IV
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. CSA2050: DCG IV
S write(bertrand,principia) VP y.write(y,principia) NP bertand bertrand V x.y.write(y,x) NP principia writes principia Parse Tree with Logical Forms CSA2050: DCG IV
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. CSA2050: DCG IV