1
4/24/07 CSCI 5832 Spring 2007 1
CSCI 5832 Natural Language Processing
Lecture 21 Jim Martin
4/24/07 CSCI 5832 Spring 2007 2
Today: 4/10
- Compositional Semantics
– Syntax-driven methods of assigning semantics to sentences
CSCI 5832 Natural Language Processing Lecture 21 Jim Martin - - PDF document
CSCI 5832 Natural Language Processing Lecture 21 Jim Martin 4/24/07 CSCI 5832 Spring 2007 1 Today: 4/10 Compositional Semantics Syntax-driven methods of assigning semantics to sentences 4/24/07 CSCI 5832 Spring 2007 2 1 Meaning
1
4/24/07 CSCI 5832 Spring 2007 1
Lecture 21 Jim Martin
4/24/07 CSCI 5832 Spring 2007 2
– Syntax-driven methods of assigning semantics to sentences
2
4/24/07 CSCI 5832 Spring 2007 3
to meaning that we took to syntax and morphology
linguistic inputs that capture the meanings of those inputs.
representations aren’t primarily descriptions
4/24/07 CSCI 5832 Spring 2007 4
this problem (just as we did with parsing)
– There’s the theoretically motivated correct and complete approach…
– And there are practical approaches that have some hope of being useful and successful.
3
4/24/07 CSCI 5832 Spring 2007 5
– Create a FOL representation that accounts for all the entities, roles and relations present in a sentence.
– Do a superficial analysis that pulls out only the entities, relations and roles that are of interest to the consuming application.
4/24/07 CSCI 5832 Spring 2007 6
Predicate Calculus (FOPC) as our representational framework
– Not because we think it’s perfect – All the alternatives turn out to be either too limiting or – They turn out to be notational variants
4
4/24/07 CSCI 5832 Spring 2007 7
– The analysis of truth conditions
– Supports the use of variables
variable binding
– Supports inference
we know explicitly
4/24/07 CSCI 5832 Spring 2007 8
driven by the needs of practical applications
languages because it was designed that way by human beings
5
4/24/07 CSCI 5832 Spring 2007 9
– Display a basic predicate-argument structure – Make use of variables – Make use of quantifiers – Use a partially compositional semantics
4/24/07 CSCI 5832 Spring 2007 10
captured with representations that consist of predicates and arguments to those predicates.
where some words and constituents function as predicates and some as arguments.
6
4/24/07 CSCI 5832 Spring 2007 11
– Primarily Verbs, VPs, PPs, Sentences – Sometimes Nouns and NPs
– Primarily Nouns, Nominals, NPs, PPs – But also everything else; as we’ll see it depends on the context
4/24/07 CSCI 5832 Spring 2007 12
– Gave conveys a three-argument predicate – The first arg is the subject – The second is the recipient, which is conveyed by the NP in the PP – The third argument is the thing given, conveyed by the direct object
7
4/24/07 CSCI 5832 Spring 2007 13
– The first arg is the subject
underlying the subject phrase plays the role of the giver.
4/24/07 CSCI 5832 Spring 2007 14
useful as it could be.
– Giving(Mary, John, List)
8
4/24/07 CSCI 5832 Spring 2007 15
complicated…
a template like the following
sentence plug into the slots provided in the template
) , ( )^ , ( )^ , ( )^ ( , , , x z Givee x y Given x w Giver x zGiving y x w
CSCI 5832 Spring 2007 16
taking in some linguistic input and assigning a meaning representation to it.
– There a lot of different ways to do this that make more or less (or zero) use of syntax – We’re going to start with the idea that syntax does matter
9
4/24/07 CSCI 5832 Spring 2007 17
– The meaning of a whole is derived from the meanings of the parts
– The constituents of the syntactic parse of the input
meaning?
4/24/07 CSCI 5832 Spring 2007 18
) , ( )^ , ( )^ ( Meat e Served AyCaramba e Server e Serving e
10
4/24/07 CSCI 5832 Spring 2007 19
4/24/07 CSCI 5832 Spring 2007 20
formation rules to our syntactic CFG rules
attach to A can be computed from some function applied to the semantics of A’s parts.
1 1
n n
11
4/24/07 CSCI 5832 Spring 2007 21
– NP -> PropNoun – NP -> MassNoun – PropNoun -> AyCaramba – MassMoun -> meat
{PropNoun.sem} {MassNoun.sem} {AyCaramba} {MEAT}
4/24/07 CSCI 5832 Spring 2007 22
12
4/24/07 CSCI 5832 Spring 2007 23
FOPC
– Take a FOPC sentence with variables in it that are to be bound. – Allow those variables to be bound by treating the lambda form as a function with formal arguments
CSCI 5832 Spring 2007 24
13
4/24/07 CSCI 5832 Spring 2007 25
4/24/07 CSCI 5832 Spring 2007 26
14
4/24/07 CSCI 5832 Spring 2007 27
4/24/07 CSCI 5832 Spring 2007 28
real soon now).
– Next time lexical semantics – Then we’ll cover information extraction, discourse, IR/QA and then MT.
15
4/24/07 CSCI 5832 Spring 2007 29
don’t expect it to know much about meaning
– In this approach, the lexical entry’s semantic attachments do all the work
meaning
simpler (constructional approach)
4/24/07 CSCI 5832 Spring 2007 30
16
4/24/07 CSCI 5832 Spring 2007 31
VP -> Verb NP NP rule (gave Mary a book) VP -> Verb NP PP (gave a book to Mary) Assume the meaning representations should be the same for both. Under the lexicon-heavy scheme, the VP attachments are: VP.Sem(NP.Sem, NP.Sem) VP.Sem(NP.Sem, PP.Sem)
4/24/07 CSCI 5832 Spring 2007 32
want to do something like
V.sem ^ Recip(NP1.sem) ^ Object(NP2.sem)
V.Sem ^ Recip(PP.Sem) ^ Object(NP1.sem)
predicate, the grammar “knows” the roles.
17
4/24/07 CSCI 5832 Spring 2007 33
– Integrate semantic analysis into the parser (assign meaning representations as constituents are completed) – Pipeline… assign meaning representations to complete trees only after they’re completed
4/24/07 CSCI 5832 Spring 2007 34
– I want to eat someplace near campus
18
4/24/07 CSCI 5832 Spring 2007 35
the parser as it is running…
– You can use semantic constraints to cut off parses that make no sense – But you assign meaning representations to constituents that don’t take part in the correct (most probable) parse
4/24/07 CSCI 5832 Spring 2007 36
mismatches between the syntax of FOPC and the syntax provided by our grammars…
directly create valid logical forms in a strictly compositional way
– We’ll get as close as we can and patch things up after the fact.
19
4/24/07 CSCI 5832 Spring 2007 37
A restaurant serves meat.
) Restaurant x Isa x , (
, ( , ( ) ( Meat Served(e, )) Restaurant x xIsa e Server e eServing
CSCI 5832 Spring 2007 38
representations like the following as objects with parts:
Complex-Term → <Quantifier var body>
>
) Restaurant , (x Isa x
20
4/24/07 CSCI 5832 Spring 2007 39
Meat) Served(e, ) ) Restaurant x xIsa e Server e eServing
( , ( ) (
4/24/07 CSCI 5832 Spring 2007 40
embedded inside predicates. So pull them
right way…
P(<quantifier, var, body>) turns into Quantifier var body connective P(var)
21
4/24/07 CSCI 5832 Spring 2007 41
) , ( ) Restaurant ( ) ) Restaurant , ( , ( x e Server x, Isa x x Isa x e Server
4/24/07 CSCI 5832 Spring 2007 42
the connective is an ^ (and)
connective is an -> (implies)
22
4/24/07 CSCI 5832 Spring 2007 43
the quantifiers out to the front of the logical form…
than one complex term in a sentence.
4/24/07 CSCI 5832 Spring 2007 44
– Every restaurant has a menu – That could mean that every restaurant has a menu – Or that
There’s some uber-menu out there and all restaurants have that menu
23
4/24/07 CSCI 5832 Spring 2007 45
) , ( ) , ( ) , ( ) ( , ) ( Menu y Isa y e Had x e Haver e yHaving e x t xRestauran
CSCI 5832 Spring 2007 46
prepositional phrase attachment problem
goes up exponentially with the number of complex terms in the sentence
weak methods to prefer one interpretation over another
24
4/24/07 CSCI 5832 Spring 2007 47
where the meaning (loosely defined) can’t be derived from the meanings of the parts
– Idioms, jokes, irony, sarcasm, metaphor, metonymy, indirect requests, etc
4/24/07 CSCI 5832 Spring 2007 48
bullet, run the show, bury the hatchet, etc…
meaning of the whole is either
– Totally unrelated to the meanings of the parts (kick the bucket) – Related in some opaque way (run the show)
25
4/24/07 CSCI 5832 Spring 2007 49
with a particular meaning
with a partially compositional meaning
4/24/07 CSCI 5832 Spring 2007 50
NP -> “the tip of the iceberg”
– the tip of Mrs. Ford’s iceberg – the tip of a 1000-page iceberg – the merest tip of the iceberg
– That’s just the iceberg’s tip.
26
4/24/07 CSCI 5832 Spring 2007 51
An initial NP with tip as its head followed by a subsequent PP with of as its head and that has iceberg as the head of its NP And that allows modifiers like merest, Mrs. Ford, and 1000-page to modify the relevant semantic forms