Document 7467866

Download Report

Transcript Document 7467866

CSA3050:
Natural Language Generation 2
Surface Realisation
Systemic Grammar
Functional Unification Grammar
see J&M Chapter 20.3
Jan 2004
CSA3050: NLG2
1
Surface Realisation within NLG
Jan 2004
CSA3050: NLG2
2
Revealing Quotations
• Language understanding is somewhat like
counting from one to infinity; language
generation is like counting from infinity
back to one. [Y. Wilks, 1988]
• Generation from what?! [C. LonguetHiggins]
• Moral: there is no consensus about the
level of representation we start from. This
applies in particular to surface realisation.
Jan 2004
CSA3050: NLG2
3
Surface Realisation
• There is, however, some agreement that output
should be specified in terms of function rather
than syntactic form
• Consider the case of voice (syntactic form)
The system will save the document
vs.
The document will be saved by the system
• Output of a discourse planner is not in terms of
voice, active v. passive.
• More likely in terms of notions like topic, focus
etc. whose surface realisation is left to a
subsequent processing stage.
Jan 2004
CSA3050: NLG2
4
Two Approaches to
Surface Realisation
• Systemic Grammar (Halliday 1985)
– Systemic Functional Linguistics
– Language as a resource for expressing meaning in
context.
– Sentences are regarded collections of functions that
are mapped to grammatical forms.
• Functional Unification Grammar (Kay 1979)
– Grammar is a "feature structure" (recursive
attribute/value pairs).
– Input specification is another feature structure
– Realisation viewed as further specification of input to
yield output sentence via fundamental operation of
functional unification.
Jan 2004
CSA3050: NLG2
5
Systemic Grammar:
Multi-Layered Sentence Analysis
Mood
the system
will
save
the document
subject
finite
predicator
object
Transitivity
actor
Theme
theme
process
goal
rheme
• Mood layer defines interaction between reader and writer:
telling v. asking v. ordering
• Transitivity layer expresses propositional content
• Theme layer deals with topic (highlighting function)
Jan 2004
CSA3050: NLG2
6
Systemic Grammar
• Grammar is represented as a graph called
a system network. This comprises
• and systems (curly braces)
– conjunctive features in boldface
• or systems (straight vertical lines)
– disjunctive features in normal face
• realisation statements (in italic).
– specify how disjunctive features are realised
Jan 2004
CSA3050: NLG2
7
Jan 2004
CSA3050: NLG2
8
Realisation Statements
• +X: insert the function X
+predicator
• X=Y: conflate the functions X and Y
goal = subject
• X>Y: order X somewhere before Y
subject > predicator
• X/A: function X has grammatical feature Y
subject/noun phrase
• X!L assign function X to lexical item L
passive!be
Jan 2004
CSA3050: NLG2
9
Generation Procedure
1. Traverse network from left to right, choosing
the appropriate features and collecting the
appropriate realisation statements.
2. Build an intermediate expression that obeys
the constraints set by the realisation
statements.
3. Recurse back through the grammar at a lower
level for functions not fully specified.
Jan 2004
CSA3050: NLG2
10
Example Input
(
:process
:actor
:goal
:speechact
:tense
save-1
system-1
document-1
assertion
future
)
• N.B. This specification resembles that used by
PENMAN system (Mann 1983) based on KLONE knowledge base.
Jan 2004
CSA3050: NLG2
11
Generation 1
• Start with clause feature
– insert predicator and classify as verb
• Proceed to mood subsystem
• after interrogating input specification
(assertion is specified) choose indicative
and declarative features.
• Insert subject and finite functions with
ordering subject > finite > predicator
Jan 2004
CSA3050: NLG2
12
Output of Mood System
Mood
Jan 2004
subject
CSA3050: NLG2
finite
predicator
13
Generation 2
• Proceed to Transitivity subsystem.
• Assuming save-1 is a material process
(from KB)
– Insert goal and process functions
– Conflate process with (finite, predicator) pair
– Proceed to Voice subsystem
– Choose Active feature and obey realisation
statements.
Jan 2004
CSA3050: NLG2
14
Output of Transitivity System
Mood
Transitivity
Jan 2004
subject
actor
finite
predicator
process
CSA3050: NLG2
object
goal
15
Generation 3
• Proceed to Theme subsystem
• Since there is no thematic specification in
the input, choose Unmarked Theme
– Insert theme and rheme functions
– Conflate theme with subject and rheme with
predicator,object
Jan 2004
CSA3050: NLG2
16
Output of Mood Subsystem
Mood
subject
Transitivity
actor
Theme
theme
Jan 2004
finite
predicator
process
object
goal
rheme
CSA3050: NLG2
17
Generation 4
• Generation now recursively enters the
grammar at lower levels to fully specify
– the phrases (noun phrase network, auxiliary
network – not shown here)
– lexical items (usually through entries in the
knowledge base)
– and possibly morphological choices
Jan 2004
CSA3050: NLG2
18
Result of Generation
Mood
the system
will
save
the document
subject
finite
predicator
object
Transitivity
actor
Theme
theme
Jan 2004
process
goal
rheme
CSA3050: NLG2
19
Functional Unification Grammar
• Build the generation grammar as a feature
structure (FS)
• Build input specification as an FS
• Unify the two together (functional
unification operation).
• Linearize result.
Jan 2004
CSA3050: NLG2
20
Feature Structures
• Feature structures are essentially sets of
attribute value pairs
attribute1
attribute2
:
attribute3
Jan 2004
CSA3050: NLG2
value1
value2
value3
21
Feature Structure 2
• These can be used to express facts of
different kinds
human facts
name
height
:
eyes
Jan 2004
agreement facts
mike
156
green
number
gender
:
case
CSA3050: NLG2
sing
masc
nom
22
Feature Structures 3
• Furthermore, values can themselves be
feature structures
cat
agreement
Jan 2004
NP
number
gender
case
CSA3050: NLG2
sing
masc
nom
23
Functional Unification
• The information in feature structures can
be combined together by means of the
functional unification () operation.
name
height
=
Jan 2004
mike
156

name
height
eyes
eyes
green
mike
156
green
CSA3050: NLG2
24
Grammar as a Feature Structure
25
Input Specification –
as a Feature Structure
cat
S
actor
head
process
head
lex save
tense future
goal
head
Jan 2004
lex system
lex document
CSA3050: NLG2
26
Partial Result
cat
actor
S
cat
head
NP
lex
process
cat
number
head
tense
VP
{actor number}
lex save
future
goal
cat
NP
head
lex document
(actor process goal)
pattern
system
27
Full Result
28