Building more complex structures and semantic

06-02495 - Natural Language Processing I
Building more complex structures and
semantic interpretation
Quasi-logical forms can be converted into
Logical Forms by extracting quantifiers.
More complex syntactic structures such as
infinitival complements require more
complicated semantic processing.
Semantic structures can be interpreted in a
variety of ways – for instance by
establishing coreferences.
06-02495 - Natural Language Processing I
The λ-calculus revisited
The previous lecture:
• looked at the qualities of meaning representation
languages (MRLs)
• introduced logic as a MRL
• introduced the use of λ-calculus as a tool for
handling variables in logical expressions
• demonstrated how a semantic representation
could be built compositionally
• developed a Quasi-Logical Form and then
stopped …
Building more complex structures and semantic interpretation
1
1
06-02495 - Natural Language Processing I
The Quasi-Logical Form
If we parse every dog has a day, the QLF is:
exists(E,
E member has([forall(X,dog(X))],
[exists(Y,day(Y))],
now))
We have to make this into a quantified first-order
logic formula by extracting the quantifiers.
Building more complex structures and semantic interpretation
2
06-02495 - Natural Language Processing I
Extracting quantifiers
This is remarkably easy.
The process is simply one of recursively searching
the tree to find quantified terms, replacing the term
by its variable and then applying one of the
following rules:
∀x Term(x) in a QLF changes to:
∀x Term(x) ⇒ QLF
∃x Term(x) in a QLF changes to:
∃x Term(x) ∧ QLF
Building more complex structures and semantic interpretation
3
2
06-02495 - Natural Language Processing I
Finally, the logical form
The result of applying these rules recursively to the
sentence every dog has a day is:
∀d dog(d) ⇒ ∃a day(a) ∧ ∃e e ∈ has(d, a, now)
∃a day(a) ∧ ∀d dog(d) ⇒ ∃e e ∈ has(d, a, now)
Our semantic processor has built two structures
because there are two meanings for this sentence.
Building more complex structures and semantic interpretation
4
06-02495 - Natural Language Processing I
Extensions to the semantic theory - 1
The description given above is very simplified. For
instance, the λ-calculus is usually typed (as in the
examples given in Allen’s book).
Thus we may need an fuller version of λ-calculus to
give us a richer representation language.
Also, we have only shown how to build a structure
and resolve quantifier scoping.
Building more complex structures and semantic interpretation
5
3
06-02495 - Natural Language Processing I
Extensions to the semantic theory - 2
The theory can be extended or changed in several
ways:
– It can be substituted by an alternative model, eg
temporal logic, modal logic, …
– It can be used (with extra program code) to
model or understand other aspects of meaning eg reference, definite/indefinite noun phrases,
forward reference, ellipsis.
The extra program code can take a variety of forms.
Inference is one mechanism for adding to the ability
of a system to understand.
Building more complex structures and semantic interpretation
6
06-02495 - Natural Language Processing I
A selected problem: the infinitive - 1
A form of a verb that can’t function as the main verb
in a sentence
Typically expresses the meaning of the verb in the
abstract – without tense, person, etc.
English uses the bare verb stem – eg come, go, drop
Infinitives are often used as the complements of verb
– eg Brian told Bugsy to drop the gun.
Building more complex structures and semantic interpretation
7
4
06-02495 - Natural Language Processing I
Back to syntax: the infinitive - 2
S
NP
VP
prop_noun
verb
NP
Brian
told
prop_noun
Bugsy
VP_to
to
verb
drop
NP
det
noun
the
gun
Building more complex structures and semantic interpretation
8
06-02495 - Natural Language Processing I
Back to syntax: the infinitive - 3
Why should
Brian told Bugsy to drop the gun.
cause difficulties?
What should the semantic representation consist of?
told(brian,
bugsy,
drop(bugsy,
gun))
Building more complex structures and semantic interpretation
9
5
06-02495 - Natural Language Processing I
The computed structure
If we looked at the QLF semantic structure built at
the VP node of the structure tree, we would see:
λx ∃e e ∈ tell(x,
[∃b bugsy(b))],
∃f f ∈ drop([∃b bugsy(b))],
[ ∃c gun(c))],
inf)),
past))
Building more complex structures and semantic interpretation
10
06-02495 - Natural Language Processing I
Does this work?
It works because we have to arrange for the βreduction to take place explicitly.
This example works – but the technique is no longer
clean and elegant.
However, dealing with semantic relationships such
as those between verbs and infinitival complements
will be difficult, whatever the technique used.
Building more complex structures and semantic interpretation
11
6
06-02495 - Natural Language Processing I
Midpoint summary - 1
Thus far in this lecture, we’ve seen:
– representation of semantic knowledge (ie in a
logic-based formalism);
– processes used to build a semantic structure
(involving a λ-calculus model);
– these processes work well – but complicated
sentences need complicated solutions!
Building more complex structures and semantic interpretation
12
06-02495 - Natural Language Processing I
Midpoint summary - 2
Once we’ve built a representation of the semantic
structure, then we can interpret the structure
Semantic interpretation
This can include a variety of processes, eg:
– quantifier scoping
– interpreting the referents of pronouns
Pragmatic interpretation
Best illustrated with an example: eg “I wonder who
the men expected to see them.” (But note this is also
an example of pronoun resolution!)
Building more complex structures and semantic interpretation
13
7
06-02495 - Natural Language Processing I
Semantic interpretation
We will consider reference resolution as an example
of semantic interpretation.
Consider the sentences:
Ted gave Jack the whiskey.
He drained it.
It is obvious that
Jack = he
it = whiskey
Building more complex structures and semantic interpretation
14
06-02495 - Natural Language Processing I
Reference
The following are referents:
Ted
Jack
he
whiskey
it
Jack and he, and whiskey and it corefer.
– Jack and whiskey are antecedents
– he and it are anaphoric references
Building more complex structures and semantic interpretation
15
8
06-02495 - Natural Language Processing I
Intrasentential and intersentential
anaphors
The previous examples where of intersentential
anaphors – relationships between two or more
sentences.
It is possible to have anaphoric relationships that
seem to be within a sentence:
Mrs Doyle saw herself in a mirror.
Jack saw him in a mirror.
Monica told Dougal about her.
Mary told Anna about it.
Building more complex structures and semantic interpretation
16
06-02495 - Natural Language Processing I
A simple algorithm for anaphoric
reference - 1
It is very easy to write an algorithm that will find the
correct referent for many pronouns:
Method:
– Add each non-pronoun referent to a stack
– For each pronoun, remove the most recent
referent from the stack
Building more complex structures and semantic interpretation
17
9
06-02495 - Natural Language Processing I
A simple algorithm for anaphoric
reference - 2
How would this resolve the example sentences?
Mrs Doyle saw herself in a mirror.
herself = Mrs Doyle
Jack saw him in a mirror.
*him = Jack
Monica told Dougal about her. *her = Dougal
Mary told Anna about it.
*it = Anna
Building more complex structures and semantic interpretation
18
06-02495 - Natural Language Processing I
A simple algorithm for anaphoric
reference - 3
What is going wrong?
A simple chronological stack isn’t sufficient.
We could include:
grammatical information – eg number, person
semantic features – eg human, male/female …
Building more complex structures and semantic interpretation
19
10
06-02495 - Natural Language Processing I
A less-simple algorithm for anaphoric
reference - 1
How would a less-simple algorithm resolve the
example sentences?
Mrs Doyle saw herself in a mirror.
herself = Mrs Doyle
Jack saw him in a mirror.
*him = Jack
Monica told Dougal about her. *her = Monica
Mary told Anna about it.
it = unresolved
Building more complex structures and semantic interpretation
20
06-02495 - Natural Language Processing I
A less-simple algorithm for anaphoric
reference - 2
The less-simple algorithm would work well much of
the time.
Depending on the examples used in the test, it could
be effective in more than 80% of cases.
It still has problems:
Jack saw him in the mirror.
Jill read Mary’s book about her.
Building more complex structures and semantic interpretation
21
11
06-02495 - Natural Language Processing I
Alternatives to
simple-minded approaches
Both the problem sentences can be resolved using a
more sophisticated algorithm that uses grammatical
information.
Jack saw him in the mirror.
him cannot refer to the male subject of a sentence –
himself should be used.
Jill read Mary’s book about her.
This requires an algorithm that knows about the
domain of pronouns within the syntactic structure
of a sentence.
Building more complex structures and semantic interpretation
22
06-02495 - Natural Language Processing I
Intersentential reference revisited
Two of the example sentences clearly refer to
intersentential referents:
Jack saw him in a mirror. *him = Jack
Mary told Anna about it. it = unresolved
It is possible to use the simple-minded approaches to
these sentences and obtain reasonable results.
However, really good results need a theory which
explains how discourse is put together and follows
rules.
Building more complex structures and semantic interpretation
23
12
06-02495 - Natural Language Processing I
Beyond sentences – to understanding?
The problem of coreference is a substantial problem
in semantic and pragmatic interpretation.
It remains unsolved although much worked upon.
There are also many other problems to be solved
– how to incorporate adjectives into semantic
descriptions
– how definite and indefinite noun phrases relate to
quantifier scoping
Building more complex structures and semantic interpretation
24
06-02495 - Natural Language Processing I
Beyond sentences – to understanding?
Once we look beyond sentences, we have to consider
problems such as:
– how people structure dialogues
– why texts/dialogues seem coherent
– how new information can be inferred from
texts/dialogue although it might not be explicitly
stated
If we can make a system with some of these features,
can it be said to understand natural language?
Building more complex structures and semantic interpretation
25
13
06-02495 - Natural Language Processing I
The End
14