Natural Language Generation Martin Hassel KTH NADA Royal Institute of Technology 100 44 Stockholm...

Post on 19-Jan-2016

212 views 0 download

Tags:

Transcript of Natural Language Generation Martin Hassel KTH NADA Royal Institute of Technology 100 44 Stockholm...

Natural Language Generation

Martin HasselKTH NADA

Royal Institute of Technology100 44 Stockholm+46-8-790 66 34

xmartin@nada.kth.se

2Martin Hassel

What Is Natural Language Generation?

A process of constructing a natural language output from non linguistic inputs that maps meaning to text.

3Martin Hassel

Related Simple Text Generation

• Canned text• Ouputs predefined text

• Template filling• Outputs predefined text with predefined

variable words/phrases

4Martin Hassel

Areas of UseNLG techniques can be used to:• generate textual weather forecasts from

representations of graphical weather maps• summarize statistical data extracted from a

database or spreadsheet • explain medical info in a patient-friendly way • describe a chain of reasoning carried out by an

expert system• paraphrase information in a diagram for

inexperienced users

5Martin Hassel

Goals of a NLG System

To supply text that is:• correct and relevant information

• non redundant

• suiting the needs of the user• in an understandable form• in a correct form

6Martin Hassel

Choices for NLG

• Content selection• Lexical selection• Sentence structure

• Aggregation• Referring expressions• Orthographic realisation

• Discourse structure

7Martin Hassel

Example Architecture

Discourse SpecificationDiscourse Specification

Knowledge BaseKnowledge BaseCommunicative GoalCommunicative Goal

Natural Language OutputNatural Language Output

Discourse PlannerDiscourse Planner

Surface RealizerSurface Realizer

8Martin Hassel

Discourse Planner

1. Text shemata• Use consistent patterns of discourse structure

2. Rhetorical Relations• Uses the Rhetorical Structure Theory• Used for varied generation tasks

9Martin Hassel

Discourse Planner –Text Schemata

• Augmented Transition Network (ATN)• Uses a set of internal states and transitions• Produces texts with a rigid structure

• i.e. recipes, directions, technical instructions

10Martin Hassel

Discourse Planner – Augmented Transition Network

11Martin Hassel

Discourse Planner – Augmented Transition Network Example output:Save the document: First, choose the save option from the file menu. This causes the system to display the Save-As dialog box. Next, choose the destination folder and type the filename. Finally, press the save button. This causes the system to save the document.

12Martin Hassel

Discourse Planner –Rhetorical Relations

Rhetorical Structure Theory(Mann & Thompson 1988)

• Nucleus• Multi-nuclear

• Satellite

13Martin Hassel

Discourse Planner –Rhetorical Relations

23 rhetorical relations, among these:• Elaboration• Contrast• Condition• Purpose• Sequence• Result

14Martin Hassel

Discourse Planner –Rhetorical Relations

Rethorical annotation:

15Martin Hassel

Discourse Planner –Rhetorical Relations

The resulting RST tree corpus:(SATELLITE(SPAN|4||19|)(REL2PAR ELABORATION-ADDITIONAL)

(SATELLITE(SPAN|4||7|)(REL2PAR CIRCUMSTANCE)

(NUCLEUS(LEAF|4|)(REL2PAR CONTRAST)

(TEXT _!THE PACKAGE WAS TERMED EXCESSIVE BY THE BUSH |ADMINISTRATION,_!|))

(NUCLEUS(SPAN|5||7|)(REL2PAR CONTRAST)

(NUCLEUS(LEAF|5|)(REL2PAR SPAN)

(TEXT _!BUT IT ALSO PROVOKED A STRUGGLE WITH INFLUENTIAL CALIFORNIA LAWMAKERS_!))

16Martin Hassel

Surface Realisation

1. Systemic Grammar• Represents sentences as collections of functions• Using functional categorization

2. Functional Unification Grammar• Builds generation grammar as a feature structure• Using functional categorization

17Martin Hassel

Surface Realisation – Systemic Grammar

• Emphasises the functional organisation of language

• Surface forms are viewed as the consequences of selecting a set of abstract functional features

• Choices correspond to minimal grammatical alternatives

• The interpolation of an intermediate abstract representation allows the specification of the text to accumulate gradually

18Martin Hassel

Surface Realisation – Systemic Grammar

• Uses multiple layers• Mood, Transivity, Theme

• Meta-functions• Interpersonal meta-function (mood)• Ideational meta-function (transivity)• Textual meta-function (theme)

• Grammar represented as a system network• Directed, acyclic and/or graph

19Martin Hassel

Surface Realisation – Systemic Grammar

Present-ParticiplePast-Participle

Infinitive

Polar

Wh-Imperative

Indicative

Declarative

InterrogativeMajor

Minor

Mood

Bound Relative

20Martin Hassel

Surface Realisation – Systemic Grammar

Clause Choices• Major indicative declarative:

The cat is on the mat.• Major indicative declarative relative:

[He didn’t see the cat] that chased the rat.• Major indicative declarative bound:

[It only hurts] when I laugh.• Major indicative interrogative polar:

Has anybody seen my seagull?• Major imperative:

Don’t be ridiculous.• Minor present-participle:

[You’ll enjoy] having more free time.

21Martin Hassel

Surface Realisation –Functional Unification Grammar

Basic idea: • Input specification in the form of a

FUNCTIONAL DESCRIPTION, a recursive <attribute,value> matrix

• The grammar is a large functional description with alternations representing choice points

• Realisation is achieved by unifying the input FD with the grammar FD

22Martin Hassel

Surface Realisation –Functional Unification Grammar((cat clause) (process ((type composite) (relation possessive) (lex ‘hand’))) (participants ((agent ((cat pers_pro) (gender feminine))) ((affected Œ((cat np) (lex ‘editor’))) ((possessor Œ)) ((possessed ((cat np) (lex ‘draft’)))))

She hands the draft to the editor.

23Martin Hassel

Microplanners 1

• Lexical selection• Syntactic realization• Morphological realization• Orthographic realization

24Martin Hassel

Microplanners 2Referring Expression Generation

• Referring expression generation is concerned with how we describe domain entities in such a way that the hearer will know what we are talking about

• Major issue is avoiding ambiguity• Fluency pulls in the opposite direction

25Martin Hassel

Kinds of Referring Expressions

• Proper names• Aberdeen, Scotland• Aberdeen

• Definite Descriptions• the train that leaves at 10am• the next train

• Pronouns• she• it

26Martin Hassel

Microplanners 3Aggregation

Some possibilities:• Simple conjunction• Ellipsis• Set introduction

27Martin Hassel

Aggregation

Without aggregation:• The next train is the Caledonian Express.• It leaves at 10AM.

With Simple Conjunction :• The next train is the Caledonian Express, and it

leaves at 10AM.

Without aggregation:• It leaves at 10AM.• It arrives at 12.30PM.

With ellipsis:• It leaves at 10AM, and Ø arrives at 12.30PM.

28Martin Hassel

Aggregation

Without aggregation:• It has a snack bar.• It has a restaurant car.

With set introduction :• It has {a snack bar, a restaurant car}.• It has a snack bar and a restaurant car.

Caution! Need to avoid changing the meaning:• John bought a TV and Bill bought a TV.• John and Bill bought a TV.

29Martin Hassel

Further Reading

• Siggen• http://www.dynamicmultimedia.com.au/siggen/

• Allen 1995: Natural Language Understanding • http://www.uni-giessen.de/~g91062/Seminare/gk-cl/

Allen95/al1995co.htm