Natural Language Generation: Discourse Planning Paul Gallagher 28 April 2005 (Material adapted from...

18
Natural Language Natural Language Generation: Discourse Generation: Discourse Planning Planning Paul Gallagher Paul Gallagher 28 April 2005 28 April 2005 (Material adapted from Ch. 20 of Jurafsky and Martin (Material adapted from Ch. 20 of Jurafsky and Martin unless otherwise noted) unless otherwise noted)

Transcript of Natural Language Generation: Discourse Planning Paul Gallagher 28 April 2005 (Material adapted from...

Natural Language Generation: Natural Language Generation: Discourse PlanningDiscourse Planning

Paul GallagherPaul Gallagher

28 April 200528 April 2005

(Material adapted from Ch. 20 of Jurafsky and Martin unless otherwise noted)(Material adapted from Ch. 20 of Jurafsky and Martin unless otherwise noted)

IntroductionIntroduction

Programs that generate natural language Programs that generate natural language are very commonare very common ““Hello, world” (Kernighan and Ritchie)Hello, world” (Kernighan and Ritchie) Template filling and mail mergeTemplate filling and mail merge

Simple, but inflexible!Simple, but inflexible!

IntroductionIntroduction

What do we What do we reallyreally mean when we say mean when we say “Natural Language Generation”?“Natural Language Generation”? ““the process of constructing natural language the process of constructing natural language

outputs from non-linguistic inputs” (Jurafsky outputs from non-linguistic inputs” (Jurafsky and Martin, p. 765)and Martin, p. 765)

Map from meaning to text (the inverse of Map from meaning to text (the inverse of natural language natural language understandingunderstanding))

IntroductionIntroduction

Contrast with NLUContrast with NLU In NLU, focus is hypothesis managementIn NLU, focus is hypothesis management In NLG, focus is choiceIn NLG, focus is choice

Characteristics of an NLG systemCharacteristics of an NLG system Produce an appropriate range of formsProduce an appropriate range of forms Choose among forms based on internal Choose among forms based on internal

meaning and contextmeaning and context

IntroductionIntroduction

What kinds of choices?What kinds of choices? Content selectionContent selection Lexical selectionLexical selection Sentence structureSentence structure

AggregationAggregation

Referring expressionsReferring expressions Discourse structureDiscourse structure

IntroductionIntroduction

NLG ExamplesNLG Examples Generate textual weather forecasts from Generate textual weather forecasts from

weather mapsweather maps Summarize statistical data from database or Summarize statistical data from database or

spreadsheetspreadsheet Explain medical informationExplain medical information Authoring aidsAuthoring aids

(Reiter and Dale)(Reiter and Dale)

Discourse Planner

Sentence Planning

Linguistic Realizatio

n

Text Plan

Sentence Plans

Natural Language Text

Adapted from Dale & Reiter. “Building Applied Natural Language Generation Systems”

Text

MeaningKnowledge Base + Communicative Goal

Ma

p

An NLG Reference Architecture

Discourse PlannerDiscourse Planner

““Discourse planning…[imposes] ordering Discourse planning…[imposes] ordering and structure over the set of messages to and structure over the set of messages to be conveyed.” (Reiter and Dale)be conveyed.” (Reiter and Dale)

Push or Pull? The planner selects or Push or Pull? The planner selects or receives its content from the knowledge receives its content from the knowledge base. (McDonald)base. (McDonald)

Outputs a tree structure defining order and Outputs a tree structure defining order and rhetorical structure. (Reiter and Dale)rhetorical structure. (Reiter and Dale)

Text SchemataText Schemata

Observation: Many texts follows consistent Observation: Many texts follows consistent structural patternsstructural patterns

Example: InstructionsExample: Instructions For each step:For each step:

Mention preconditionsMention preconditions

Describe the stepDescribe the step Describe sub-stepsDescribe sub-steps

Mention side-effectsMention side-effects

Text SchemataText Schemata

Knowledge base representation of a saving procedure(Jurafsky and Martin. Fig. 20.5)

Text SchemataText Schemata

A schema from representing procedures. Implemented as an augmented transition network (ATN).Jurafsky and Martin. Fig 20.6

Text SchemataText Schemata

Sample output of the example:Sample output of the example:Save the document: First, choose the save Save the document: First, choose the save option from the file menu. This causes the option from the file menu. This causes the system to display the Save-As dialog box. system to display the Save-As dialog box. Next choose the destination folder and Next choose the destination folder and type the filename. Finally, press the save type the filename. Finally, press the save button. This causes the system to save button. This causes the system to save the document.the document.

Rhetorical RelationsRhetorical Relations

Text schemata still not very flexibleText schemata still not very flexible

Schema is essentially a hard-coded text Schema is essentially a hard-coded text plan.plan.

There is an underlying structure to There is an underlying structure to language which we can take advantage of language which we can take advantage of to develop richer expressions: Rhetorical to develop richer expressions: Rhetorical Structure TheoryStructure Theory

Rhetorical RelationsRhetorical Relations

I love to collect classic I love to collect classic automobiles.automobiles.

My favorite car is my 1899 My favorite car is my 1899 Duryea.Duryea.

However, I prefer to drive However, I prefer to drive my 1999 Toyota.my 1999 Toyota.

nucleus

satellite

satellite

Elaboration

Contrast

Rhetorical RelationsRhetorical Relations

How do we apply RST to a discourse How do we apply RST to a discourse planner?planner? Post a high-level goal to the planner (e.g., Post a high-level goal to the planner (e.g.,

“Make the hearer competent to save a “Make the hearer competent to save a document”)document”)

Create plan operators which expand goals Create plan operators which expand goals into sub-goals, creating a rhetorical structure into sub-goals, creating a rhetorical structure tree.tree.

Rhetorical RelationsRhetorical RelationsName:Name: Expand Purpose Expand PurposeEffect:Effect:

(COMPETENT hearer (DO-(COMPETENT hearer (DO-ACTION ?action))ACTION ?action))

Constraints:Constraints:(AND(AND

(c-get-all-substeps ?(c-get-all-substeps ?action ?sub-actions)action ?sub-actions)

(NOT singular-list? ?sub-(NOT singular-list? ?sub-actions))actions))

Nucleus:Nucleus:(COMPETENT hearer (DO-(COMPETENT hearer (DO-SEQUENCE ?sub-actions))SEQUENCE ?sub-actions))

Satellites:Satellites:(((RST-PURPOSE (INFORM s (((RST-PURPOSE (INFORM s hearer (DO ?action))) *required*))hearer (DO ?action))) *required*))

Name:Name: Expand Sub-Actions Expand Sub-ActionsEffect:Effect:

(COMPETENT hearer (DO-(COMPETENT hearer (DO-SEQUENCE ?actions))SEQUENCE ?actions))

Constraints:Constraints:NILNIL

Nucleus:Nucleus:(foreach ?actions (RST-(foreach ?actions (RST-SEQUENCE (COMPETENT SEQUENCE (COMPETENT hearer (DO-ACTION ?actions))))hearer (DO-ACTION ?actions))))

Satellites:Satellites:NILNIL

Jurafsky and Martin, pp. 786 and 788

Rhetorical RelationsRhetorical Relations

The full rhetorical structure for the example text.Jurafsky and Martin. Fig. 20.7.

ReferencesReferences

Jurafsky, D. & Martin, J. H. (2000). Jurafsky, D. & Martin, J. H. (2000). Speech and and Speech and and Language ProcessingLanguage Processing..

Reiter, E. and Dale, R. (1997). “Building Applied Natural Reiter, E. and Dale, R. (1997). “Building Applied Natural Language Systems.Language Systems.

McDonald, D. D. “Natural Language Generation”. McDonald, D. D. “Natural Language Generation”. (Appeared in (Appeared in Handbook of Natural Language Handbook of Natural Language GenerationGeneration, edited by Dale, R., Moisl, H., and Somers, , edited by Dale, R., Moisl, H., and Somers, H.)H.)