ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed...

27
ELIZA - Background In the beginning there was ELIZA ... Joseph Weizenbaum coded ELIZA at MIT during the years 1964-1966. The aim was to produce a very simple program, based on the presence of keywords in the input, capable of typed NL conversation. He developed a script for ELIZA which simulated a psychotherapist. Eliza encourages the patient to talk by reflecting the patient’s statements back to him. The role played by the computer was very carefully chosen to disguise the program’s lack of knowledge about language or about the world.

Transcript of ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed...

Page 1: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

ELIZA - Background

I In the beginning there was ELIZA ...I Joseph Weizenbaum coded ELIZA at MIT during the years

1964-1966.I The aim was to produce a very simple program, based on the

presence of keywords in the input, capable of typed NLconversation.

I He developed a script for ELIZA which simulated apsychotherapist.

I Eliza encourages the patient to talk by reflecting the patient’sstatements back to him.

I The role played by the computer was very carefully chosen todisguise the program’s lack of knowledge about language orabout the world.

Page 2: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

ELIZA - Example Interaction

Men are all alike.IN WHAT WAY?They’re always bugging us about something or otherCAN YOU THINK OF A SPECIFIC EXAMPLE?Well, my boyfriend made me come hereYOUR BOYFRIEND MADE YOU COME HERE?He says I’m depressed much of the timeI’M SORRY TO HEAR YOU ARE DEPRESSEDPerhaps I could learn to get along with my mother.TELL ME MORE ABOUT YOUR FAMILY

Page 3: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

ELIZA - Problems Addressed

1. The identification of the most important keyword occurring inthe input text.

2. The identification of some minimal context within which thechosen keyword appears.

3. The choice of an appropriate transformation rule and themaking of the transformation itself.

4. The provision of a mechanism that permits ELIZA to respondintelligently when the input contains no keywords.

5. The provision of machinery to facilitate editing, particularlyextension of the of the script.

Page 4: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

ELIZA - How it Works

There is a database of keywords. each is associated with

I an integer indicating the keyword’s priorityI a decomposition rule to match against the input

rule: (0 you 0 me)input: (do you hate me)segments: 1 2 3 4

where 0 indicates a subphrase of arbitrary length.I a reassembly rule n that constitutes an output specification,

e.g(what makes you think that I 3 you?)where the number 3 indicates the third segment matched bythe decomposition rule – in this case the word “hate”

Page 5: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Main Algorithm

Given a sentence S,

I find a keyword in S whose input pattern matches.

I If there is more than one, choose the one with the highestpriority.

I Use the reassembly rule to generate the next sentence.

I If there are no matching keywords, generate an innocuoussentence.

Page 6: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

ELIZA - Tricks

I Routine substitution of certain input words during scanninge.g.MY → YOUR; I→ YOU

I love my bicycle(you love 0) => (WOULD YOU LIKE TO MARRY 3)

I On-the-fly composition of pre-canned responses

(MEMORY MY(0 YOUR 0 = LET’S DISCUSS FURTHER WHY YOUR 3)(0 YOUR 0 = EARLIER YOU SAID YOUR 3)etc

I Tagging of keywords according to class, e.g.((MOTHER DLIST (/NOUN FAMILY))to be referred to in decomposition rules((0 YOUR 0 (/FAMILY) 0))

Page 7: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Eliza - Discussion

1. It is in no sense a general solution to the problem of NLcommunication.

2. ELIZA is a remarkable example of robust NLP. It alwaysproduces an answer, no matter how ungrammatical ormeaningless the input.

3. The program was written to demonstrate that given the rightsetting, people are inclined to ascribe intentions and thus,intelligence, to producers of utterances. The illusion is furtherfostered by a setting for which the program is not required toknow anything.

J. Weizenbaum, ELIZA - A computer Program for the Study of Natural Language Communi-cation between Man and Machine, CACM vol 9.1,pp36-43, 1966

Page 8: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

SHRDLU (T. Winograd 1971)

Basic Principles

1. A computer cannot deal reasonably with language unless itcan understand the subject it is discussing.

2. In modeling language understanding, all aspects of languagemust be integrated.

3. Humans do not understand isolated sentences. Sentencesalways occur in a context which includes

I Physical situation.I Discourse context.I Shared social knowledge.I Shared world knowledge.

Page 9: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Serious Problems

I Linguistic versus world knowledge. World knowledge isintractable in the general case.

I It is difficult or impossible to isolate one aspect of languageuse (syntax, mophology, semantics, pragmatics) from another:e.g.He gave the house plants to charity vs.He gave the boy plants to waterAssigning the correct syntactic structure depends on complexinteractions between syntax and semantics.

I How can these problems be addressed?

Page 10: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Key Idea #1: Limited Domain Microworld

I Strictly limit the subject area in order to address generalissues of how language is used in a framework of physicalobjects, events, and continuing discourse.

I Winograd’s strategy was to pick a microworld to talk about.A microworld in Winograd’s sense is essentially a finitecollection of entities and relations, together with rulesallowing them to be manipulated.

I Provide complete knowledge of the microworld.

Page 11: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Winograd’s Microworld

The subject chosen was the “blocks world” of a toy robot. In thecourse of a dialogue:

I Manipulate objects (of different sizes, shapes and colours) inblocks world

I Answer questions about current configuration of blocksI Discuss events that have taken place during the interactionI Limited discussion of its own reasoningI Accept new facts that it is told

Page 12: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Blocks Microworld

Page 13: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

World Model

The program makes use of a detailed world model, describing boththe current state of the blocks world and procedures for changingthat state.

(IS B1 BLOCK)(IS B2 PYRAMID)(AT B1 (LOCATION 100 100 0))(SUPPORT B1 B2)(CLEARTOP B2)(MANIPULABLE B1)(CONTAIN BOX1 B4)(COLOR-OF B1 RED)(SHAPE-OF B2 POINTED)(IS BLUE COLOUR)(CAUSE EVENT27 EVENT29)

Page 14: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

First Order World Model

I ObjectsI BlockI ColourI Event

I RelationsI SpatialI TemporalI Causal

I ActionsI Physical ActionsI Dialogue Actions

Page 15: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Key Idea #2: Procedural Semantics:The Meaning of a Phrase is a Program

FIND A PYRAMID X2

FIND A BLOCK X1

IS X1

EQUIDIMENSIONAL

IS X1RED?

succeed

start

SUPPORTDOES X1

X2?

no more

yes

yes

no

no

no

yes

FAIL

no more

?

“A Red Cube That Supports a Pyramid”

Page 16: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

A Red Cube That Supports a Pyramid

(GOAL (Is ?X1 BLOCK))(GOAL (COLOR-OF ?X1 RED))(GOAL (EQUIDIMENSIONAL ?X1))(GOAL (IS ?X2 PYRAMID))(GOAL (SUPPORT ?X1 ?X2))

I The same procedure expressed in the programming languageMICROPLANNER

I This language was specially developed for describing plansbased on finding goals.

I Expressions in the language constitute an executable meaningrepresentation for sentences of English.

I Issue: what is easy/difficult to express in this way?

Page 17: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Key Idea #3: Encode English Grammar

The program includes a large-scale procedurally expressed grammarof English.

PARSE

NP

PARSEVP

ANYWORDSLEFT?

NO

NO

YES

YES

YES

NORETURN FAILURE

RETURN SUCCESS

DEFINE PROGRAM SENTENCE

Page 18: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Main Components

I Syntactic Parser - works with a large-scale grammar of EnglishI Collection of semantic routines that embody the kind of

knowledge needed to interpret English words and phrasesI World ModelI Cognitive/deductive system for exploring the consequences of

facts, making plans to carry out commands, finding theanswers to questions.

I Simple set of programs for generating appropriate Englishresponses.

Page 19: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

SHRDLU - Example Interaction

Pick up a red blockOK.Grasp the pyramidI DON’T UNDERSTAND WHICH PYRAMID YOU MEAN.(There are 3 pyramids in the scene.)Find a block which is taller than the one you are holding and put it in thebox(System has to figure out what is meant by “one” and “it”, as well as dodeduction to figure out which block it is holding)BY “IT” I ASSUME YOU MEAN THE BLOCK WHICH IS TALLERTHAN THE ONE I AM HOLDING.What does the box contain?The blue pyramid and the blue block.What is the pyramid supported by?(Now the system understands the phrase “the pyramid”).The box.How many blocks are not in the box?(negatives must be handled properly)Four of them.

Page 20: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

.SHRDLU Example Interaction

Is at least one of them narrower than the one which I told you to pick up?(the phases “at least one of them” must be analysed to refer back to theprevious question. Complex quantifier expressions must be handled)YES, THE RED CUBE.Is it supported?YES, BY THE TABLE.(heuristics about what people expect to hear in addition to yes or no)The blue pyramid is mine.I own all blocks which are not red, but I don’t own anything whichsupports a pyramid.I UNDERSTAND(The result of understanding these sentences is is the creation of newprocedures for deducing whether I own something.Do I own anything in the box?YES. TWO THINGS: THE BLUE BOX AND THE BLUE PYRAMID

(Extra information supplied. Form of a list)

Page 21: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

SHRDLU Example Interaction

Had you touched any pyramid before you put the little green one on thelittle cube?YES, THE GREEN ONE(The system deduces from its memory what event is being referred to,and can relate other events to it in time. The analysis includes complextenses of verb groups).When did you pick it up?WHILE I WAS STACKING UP THE RED CUBE, A LARGE REDBLOCK AND A LARGE GREEN CUBE.(A time is described by naming the main goal that was being worked on)Why?TO GET RID OF IT.(By keeping track of selected parts of the subgoal tree, the system hassome understanding of its own motives.)Why did you do that?TO CLEAN OFF THE RED CUBE.Why did you clear off that cubeTO PUT IT ON A LARGE GREEN CUBEWhy did you do that?

BECAUSE YOU ASKED ME TO

Page 22: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Dictionary Information

We have seen how meanings will be represented. To constructsuch interpretations we must interpret individual words withrespect to the syntactic structures in which they occur.Here is an example of the system’s dictionary entry for the word“cube”.

(CUBE((NOUN (OBJECT

((MANIPULABLE RECTANGULAR)((IS ? BLOCK)(EQUIDIMENSIONAL ?)))))))

I The entry specifies both syntactic and semantic information.I A cube is an object that is rectangular and manipulable, and

can be recognised by the fact that it is a block andequidimensional.

Page 23: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

The word “contain”

(CONTAIN((VERB

((TRANSITIVE(RELATION

A---> (((CONTAINER)) ((PHYSICAL-OBJECT))(CONTAIN #1 #2))

B---> (((CONSTRUCT)) ((PHYSICAL-OBJECT))(PART-OF #2 #1))))))))

This entry provides two meanings for the word “contain”. Theseare distinguished by considering the “types” of the two things inthe containment relationship (cf. A and B)

I If applied to a container and a physical object, (e.g. “the boxcontains 3 pyramids”) the container contains the objects).

I If applied to a construct and an object, (e.g. “the stackcontains 3 objects”), the sense is that the object is a part ofthe construct.

Page 24: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Remarks on Dictionary Entries

The possibility of associating arbitrary programs with dictionaryentries makes it easy to incorporate complex procedures into theinterpretation process.For example, the word “the” is associated with a procedure thatchecks the current context for a unique object that fits a certaindescription. If more than one such object is found, a specialmessage is generated.

Page 25: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Key Idea #4: InterleavingSyntactic and Semantic Processing

I Program does not operate by first parsing a sentence, thendoing semantic analysis, then using deduction to produce aresponse. These activities go on concurrently.

I As soon as a piece of syntactic structure takes shape, asemantic program is called to see if it makes sense. This inturn might involve deductive reasoning. Example:Put the blue pyramid on the block in the boxPut [the blue pyramid on the block] in the boxPut the blue pyramid [on the block in the box]

Page 26: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Limitations

I Limited range of declarative utterance types.I Brittle: model is overdependent upon syntax.I Closed world assumption of semantics.I Impoverished level of world knowledge compared to a human.I Program cannot produce sentences of a syntactic complexity

that matches input.

Page 27: ELIZA - Backgroundstaff.um.edu.mt/mros1/csa5005/pdf/elizashrdlu.pdf · ELIZA - Problems Addressed 1. The identification of the most important keyword occurring in the input text.

Other Remarks

Yorick Wilks has argued that SHRDLU’S power does not comefrom linguistic analysis but from the use of problem-solvingmethods in a simple, logical, and closed domain (”table-top”world), thus eliminating the need to face some of the more difflcultlanguage issues.It seems doubtful that if SHRDLU were extended to a largerdomain, it would be able to deal with these problems. Further, thelevel at which SHRDLU seeks to simulate the intermixing ofknowledge sources typical of human rea soning is embedded in itsprocesses rather than made explicit in its control structure, whereit would be most powerful.Lastly, its problem solving is still highly oriented toward predicatecalculus and limited in its use of inferential and heuristic data.