DCG Lecture 4.pps

Download Report

Transcript DCG Lecture 4.pps

CSA2050:
Definite Clause Grammars
IV
Handling Gaps II
Semantic Issues
22.05.2003
CSA2050: DCG IV
1
Resumé
• Relative clauses such as
the book that Bertrand wrote
are derived from a corresponding
sentence
Bertrand wrote the book
•
22.05.2003
[that] Bertrand wrote the book
CSA2050: DCG IV
2
Deriving the DCG
• We can write down the parts of speech
The book [that]
D
N RELPRON
Bertrand wrote np(gap)
N
V
np(gap)
• … and try to build the grammar rules. A naïve
approach is to derive DCG rule directly
NP --> D N RELPRON N V np(gap)
• A better approach is
NP --> D N optrel
22.05.2003
CSA2050: DCG IV
3
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)).
22.05.2003
CSA2050: DCG IV
4
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).
22.05.2003
CSA2050: DCG IV
5
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.
22.05.2003
CSA2050: DCG IV
6
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
22.05.2003
CSA2050: DCG IV
7
Grammar and Lexicon
% 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.
22.05.2003
% lexicon
n
--> [john].
n
--> [bertrand].
n
--> [program].
rel --> [that].
det --> [the].
v
--> [halts].
v
--> [wrote].
CSA2050: DCG IV
8
Call: (6)
Call: (7)
Call: (8)
Fail: (8)
Redo: (7)
Call: (8)
Exit: (8)
Exit: (7)
Call: (7)
Call: (8)
Exit: (8)
Call: (8)
Call: (9)
Fail: (9)
Redo: (8)
Call: (9)
Fail: (9)
Redo: (8)
Exit: (8)
Exit: (7)
Exit: (6)
X=gap(np)
22.05.2003
s(_G395, [john, wrote], []) ? creep
np(nogap, [john, wrote], _G459) ? creep
det([john, wrote], _G458) ? creep
det([john, wrote], _G458) ? creep
np(nogap, [john, wrote], _G459) ? creep
n([john, wrote], _G458) ? creep
n([john, wrote], [wrote]) ? creep
np(nogap, [john, wrote], [wrote]) ? creep
vp(_G395, [wrote], []) ? creep
v([wrote], _G458) ? creep
v([wrote], []) ? creep
np(_G395, [], []) ? creep
det([], _G458) ? creep
det([], _G458) ? creep
np(_G395, [], []) ? creep
n([], []) ? creep
n([], []) ? creep
np(_G395, [], []) ? creep
np(gap(np), [], []) ? creep
vp(gap(np), [wrote], []) ? creep
s(gap(np), [john, wrote], []) ? creep
CSA2050: DCG IV
9
Handling NLP Semantics
•
In order handle semantics of NL sentences
we have to do at least the following:
–
–
–
–
22.05.2003
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
10
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.huberlin.de/angl/ling_pages/semantics.html]
22.05.2003
CSA2050: DCG IV
11
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…)
22.05.2003
CSA2050: DCG IV
12
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.
22.05.2003
CSA2050: DCG IV
13
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)
22.05.2003
CSA2050: DCG IV
14
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)
22.05.2003
CSA2050: DCG IV
15
Logical Forms of Sentences
• John kicked Fido:
kick(john,fido)
• Every student wrote a program
all(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
22.05.2003
CSA2050: DCG IV
16
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
22.05.2003
CSA2050: DCG IV
17
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.
22.05.2003
CSA2050: DCG IV
18
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.
22.05.2003
CSA2050: DCG IV
19
Parse Tree with Logical Forms
S
write(bertrand,principia)
VP
y.write(y,principia)
NP
bertand
bertrand
V
x.y.write(y,x)
writes
22.05.2003
CSA2050: DCG IV
NP
principia
principia
20
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 formulate
you can fool most of the people most of
the time.
• Lambda calculus is too powerful.
22.05.2003
CSA2050: DCG IV
21