Microplanning (Sentence planning) Part 1 Kees van Deemter.

39
Microplanning (Sentence planning) Part 1 Kees van Deemter

Transcript of Microplanning (Sentence planning) Part 1 Kees van Deemter.

Page 1: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Microplanning(Sentence planning)

Part 1

Kees van Deemter

Page 2: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Natural Language Generation

• Taking some computer-readable gibberish

• “Translating” it into proper English

• Applications include– dialogue/chat systems– on-line help– summarisation, – document authoring

Page 3: Microplanning (Sentence planning) Part 1 Kees van Deemter.

NLG Tasks (as explained by Anja):

1. Content determination: decide what to say; construct set of messages

2. Discourse planning: ordering, structuring concepts; rhetorical relationships

3. Sentence aggregation: divide content into sentences; construct sentence plans

4. Lexicalisation: map concepts and relations to lexemes (= words)

5. Referring expression generation: decide how to refer to objects

6. Linguistic realisation: put it all together in acceptable words and sentences

Page 4: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Modular structure of NLG systems (in theory!):

Content determination

Discourse planning

Sentence aggregation

Realisation

Lexicalisation

Referring expressions

TEXT PLANNER

REALISER

SENTENCE PLANNER/MICROPLANNER

Page 5: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Last week: Input to realisation

message-id: msg02

relation: C_DEPARTURE

departing-entity: C_CALEDON-EXPRESS

args: departure-location: C_ABERDEEN

departure-time: C_1000

departure-platform: C_7

Page 6: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Microplanning 1:Aggregation

• Distributing information over different sentences. Example:

a. The Caledonian express departs Aberdeen at 10:00, from platform 7

b. The Caledonian express departs Aberdeen at 10:00. The Caledonia express departs from platform 7

Page 7: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Microplanning 2: GRE

GRE = Generation of Referring Expressions

Explaining which objects you’re talking about

a. The Caledonian express departs Aberdeen at 10:00, from platform 7

b. The Caledonian express departs -- at 10:00. The train departs from this platform

Page 8: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Microplanning 3: lexical choice

Using different words for the same concept

a. The Caledonian express departs Aberdeen at ten o’clock, from platform 7

b. The Caledonian express departs Aberdeen at ten. The Caledonia express leaves from platform 7

Page 9: Microplanning (Sentence planning) Part 1 Kees van Deemter.

In practice: tasks can be performed in different order

• Example: aggregation can be performedon messages:

Page 10: Microplanning (Sentence planning) Part 1 Kees van Deemter.

message-id: msg02

relation: C_DEPARTURE_1

departing-entity: C_CALEDON-EXPRESS

args: departure-location: C_ABERDEEN

departure-time: C_1000

message-id: msg03

relation: C_DEPARTURE_2

args: departure-entity: C_CALEDON-EXPRESS

departure-platform: C_7

Page 11: Microplanning (Sentence planning) Part 1 Kees van Deemter.

• Aggregation can also be performed later:

[The Caledonian express] departs Aberdeen [at 10:00] [from platform 7]

===> [The Caledonian express] departs Aberdeen

[at 10:00]. [The Caledonia express] departs [from platform 7]

Page 12: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Let’s focus on GRE, but ...

• A little detour: NLG systems do not always work as you’ve been told

• Some practically deployed systems combine “canned text” with NLG

• One possibility: system has a library of language “templates”, with gaps that need to be filled. E.g.,

Page 13: Microplanning (Sentence planning) Part 1 Kees van Deemter.

[TRAIN] departs [TOWN] at [TIME]

[TRAIN] departs [TOWN] from [PLATFORM]

We apologise for the fact that [TRAIN] is delayed by [AMOUNT]

Gap filling: using canned text or GRE.

Question: which of the other tasks are still relevant?

Page 14: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Let’s move on to GRE

• Why/when is GRE useful?

Page 15: Microplanning (Sentence planning) Part 1 Kees van Deemter.

1. The referent has a familiar name, but it’s not unique, e.g., ‘John Smith’

2. The referent has no familiar name: trains, furniture, trees, atomic particles, …

( Databases use keys, e.g.,

‘Smith$73527$’, ‘TRAIN-3821’ )

3. Similar: sets of objects

4. NL is too economical to have namesfor everything

Page 16: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Last week: Input to realisation

message-id: msg02

relation: C_DEPARTURE

departing-entity: C_CALEDON-EXPRESS

args: departure-location: C_ABERDEEN

departure-time: C_1000

Page 17: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Last week: Input to realisation

message-id: msg02

relation: C_DEPARTURE

departing-entity: C_CALEDON-EXPRESS

args: departure-location: C_ABERDEEN

departure-time: C_1000

Page 18: Microplanning (Sentence planning) Part 1 Kees van Deemter.

This week: more realistic input

message-id: msg02

relation: C_DEPARTURE

departing-entity: C_34435

args: departure-location: .....

departure-time: .....

“the caledonian (express)”,

“the Aberdeen-Glasgow express’’

“the blue train on your left” , “the train”

Page 19: Microplanning (Sentence planning) Part 1 Kees van Deemter.

• Communication is about saying the truth ...

• but that’s not all there is to it

• Paul Grice (around 1970): principles of rational, cooperative communication

• GRE, it a good case study. (R.Dale and E.Reiter, Cognitive Science, 1995)

Page 20: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Grice: maxims of conversation

• Quality: only say what you know to be true

• Quantity: give enough but not too much information

• Relevance: be relevant

• Manner: be clear and brief

(There is overlap between these four)

Page 21: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Maxims are two-edged sword:

1. They say how one should normally speak/write. Example:

“Yes, there’s a gasoline station around the corner” (when it’s no longer operational)

quality: yes, it’s truequantity: probably yesrelevance: no, not relevant to hearer’s intentionsmanner: it’s brief, clear, etc.

Page 22: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Maxims are two-edged sword:

2. They can also be exploited. Example:

Asked to write academic reference: “Kees always came to my lectures and he’s a nice guy”

quality: yes, it’s true (let’s assume)

quantity: No -- How about academic achievements?

relevance: yes

manner: yes

Page 23: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Application to GRE

Dale & Reiter: best description of an object fulfils the Gricean maxims. E.g.,

• (Quality:) list properties truthfully• (Quantity:) use properties that allow identification –

without containing more info• (Relevance:) use properties that are of interest in the

situation• (Manner:) be brief

Page 24: Microplanning (Sentence planning) Part 1 Kees van Deemter.

D&R’s expectation:

• Violation of a maxim leads to implicatures.

• For example,– [Quantity] ‘the pitbull’ (when there is

only one dog).– [Manner] ‘Get the cordless drill that’s

in the toolbox’ (Appelt).

• There’s just one problem: …

Page 25: Microplanning (Sentence planning) Part 1 Kees van Deemter.

people don’t always speak this way

For example,– [Manner] ‘the red chair’ (when there is

only one red object in the domain).

– [Manner/Quantity] ‘I broke my arm’ (when I have two).

General: empirical work shows much redundancy

Similar for other maxims, e.g.,– [Quality] ‘the man with the martini’ (Donellan)

Page 26: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Example Situation

a, £100 b, £150

c, £100 d, £150 e, £?Swedish Italian

Page 27: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Formalized in a KB

• Type: furniture (abcde), desk (ab), chair (cde)

• Origin: Sweden (ac), Italy (bde)

• Colours: dark (ade), light (bc), grey (a)

• Price: 100 (ac), 150 (bd) , 250 ({})

• Contains: wood ({}), metal (abcde), cotton(d)

Assumption: all this is shared knowledge.

Page 28: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Game

1. Describe object a.

2. Describe object e.

3. Describe object d.

Page 29: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Game

1. Describe object a: {desk,sweden}, {grey}

2. Describe object e: no solution

3. Describe object d: {Italy, 150}

Page 30: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Violations of …• Manner:

* ‘The £100 grey Swedish desk which is made of metal’

(Description of a)

• Relevance: ‘The cotton chair is a fire hazard?

?Then why not buy the Swedish chair?’ (Descriptions of d and c respectively)

Page 31: Microplanning (Sentence planning) Part 1 Kees van Deemter.

• In fact, there is a second problem with Quantity/Manner. Consider the following formalization:

Full Brevity: Never use more than the minimal number of properties required for identification (Dale 1989)

An algorithm:

Page 32: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Dale 1989:

1. Check whether 1 property is enough

2. Check whether 2 properties is enough

….

Etc., until

success {minimal description is generated} or

failure {no description is possible}

Page 33: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Problem: exponential complexity

• Worst-case, this algorithm would have to inspect all combinations of properties. n properties combinations.

• Recall: one grain of rice on square one; twice as many on any subsequent square.

• Some algorithms may be faster, but …

• Theoretical result: algorithm must be exponential in the number of properties.

n2

Page 34: Microplanning (Sentence planning) Part 1 Kees van Deemter.

• D&R conclude that Full Brevity cannot be achieved in practice.

• They designed an algorithm that only approximates Full Brevity:

the Incremental Algorithm.

Page 35: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Incremental Algorithm (informal):

• Properties are considered in a fixed order:

P =

• A property is included if it is ‘useful’:

true of target; false of some distractors

• Stop when done; so earlier properties have a greater chance of being included. (E.g., a perceptually salient property)

• Therefore called preference order.

nPPPP ,...,,, 321

Page 36: Microplanning (Sentence planning) Part 1 Kees van Deemter.

• r = individual to be described

• P = list of properties, in preference order

• P is a property

• L= properties in generated description

(Recall: we’re not worried about realization today)

Page 37: Microplanning (Sentence planning) Part 1 Kees van Deemter.

FailureReturn

LReturn then {r}C If

]][[C:C

}{L:L

do then ]][[ C &]][[r If

:do P allFor

Domain:C

Φ:L

P

P

PP

P

Page 38: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Back to the KB

• Type: furniture (abcde), desk (ab), chair (cde)

• Origin: Sweden (ac), Italy (bde)

• Colours: dark (ade), light (bc), grey (a)

• Price: 100 (ac), 150 (bd) , 250 ({})

• Contains: wood ({}), metal (abcde), cotton(d)

Assumption: all this is shared knowledge.

Page 39: Microplanning (Sentence planning) Part 1 Kees van Deemter.

Back to our game

1. Describe object a.

2. Describe object e.

3. Describe object d.

Can you see room for improvement?