CSE 4308/ CSE 5360 Artificial Intelligence

Lab Assignment #1  -  Do a Little Eliza

Due date:  Thursday, 2 October 2003, 2:00pm

 

In this project you will be creating a personalized version of an Eliza (or Mgonz) type chatterbot system using LISP.  You will be given source code to use as the basis of your project and then you must add components and extend the given components as discussed below.  Note that there are many Eliza versions on the web and your code will be compared against them to insure against plagiarism. 

The original ELIZA program was published by Joseph Weizenbaum in 1966. It simulated a Rogerian therapist; that is, most of what it said was merely repeating (with appropriate substitutions) what it was told. Here is a bit of sample dialogue (from Rich & Knight, Artificial Intelligence, 1983):

Person: Men are all alike.
ELIZA: In what way?
Person: They're always bugging us about something or other.
ELIZA: Can you think of a specific example?
Person: Well, my boyfriend made me come here.
ELIZA: Your boyfriend made you come here.
Person: He says I'm depressed much of the time.
ELIZA: I am sorry to hear you are depressed.
Person: It's true. I am unhappy.
ELIZA: Do you think that coming here will help you not to be unhappy?
Person: I need some help, that much seems certain.
ELIZA: What would it mean to you if you got some help?
Person: Perhaps I could learn to get along with my mother.
ELIZA: Tell me more about your family.

ELIZA worked by applying pattern-matching rules. It looked for a rule whose left side matched the last sentence entered by the user, then used the right side of that rule to generate a response. A sample rule might be something like (I REMEMBER X) => (WHY DO YOU REMEMBER X JUST NOW).

For your project, you are given a starter LISP file that implements Eliza on a sentence-by-sentence basis.  If you load this file into a LISP process, you can run it like this:

 

> (eliza '(hello))

(HELLO - HAVE A SEAT AND TELL ME HOW YOU FEEL TODAY.)

 

Eliza responds with a response from the meager database provided.  Your task is to write rules that make Eliza seem human, at least for a minute or two.  In particular, you must make Eliza sound like YOU in conversation.  To do this you must first, expand the database to include more responses than those provided for you.  Interactions that work best are the heavily scripted ones.  Write the rules carefully. In general, it is quality and not quantity that counts.  Secondly, expand the function ‘change-pros’ in order to fit with the kinds of responses you are trying to evoke. 

 

For your assignment:

 

To understand the database, look at one of the entries provided:

         ( (0 you think 0)

      (And just why do you think 4 ?) )

The number ‘0’ matches against any number of words and partitions a sentence in the following way:

...

you

think

...

1

2

3

4

 

The phrases matched to the number ‘0’ are in positions 1 and 4.  This is why the response uses the number 4; it is a signal to take whatever the user said that matched that partition and repeat it back at the end of the response.  When you partition your sentence similarly, use ‘0’ for phrases of zero or more words, and consider each of those phrases matched against one slot in the partition for use in the response.

 

Note that the ‘change-pros’ function is run on the sentence BEFORE the pattern-matching.  This is so that the sentence ‘I think I am an idiot’ does not result in the response, ‘Why do you think I am an idiot?’  You need the pronouns changed first. Therefore, your database entries should always assume the pronouns have already been switched.

 

Do not worry about (1) capitalization, (2) punctuation, or (3) parentheses. It's traditional in Lisp programs to see input and output such as (TELL ME MORE ABOUT THAT).

Hand in:

I.       Code requirements:

1.      The code that you wrote, NOT the code that you are given.
(Sorry, this happens more often than one would think)

2.      Your rules.

3.      A short (1 page or less) documentation file named README describing how to use your program

II.     Output requirements:  Three different transcripts of your Eliza running, with annotations if necessary. In these transcripts you must log three conversations with your version of Eliza as described below:

1.      one in which she comes up with at least 10 unique responses other than the ones provided – and she makes sense, –

2.      one in which there are at least 10 responses which illustrate Eliza’s shortcomings as a pattern-matching conversation agent, and

3.      a third conversation of any type. 

III.   Analysis requirements:

1.      A paragraph on what you think you did well in the design of the rules. What was interesting?

2.      A paragraph on what aspects of your implementation result in the shortcomings demonstrated in the “poor” conversation transcript.

3.      A paragraph on how Eliza should be extended.

All files should be plain text (unformatted) files.

If you are not having fun designing Eliza rules, you are doing something wrong.

Eliza information links:

http://i5.nyu.edu/~mm64/x52.9265/january1966.html

http://hps.elte.hu/~gk/Eliza/

Eliza: Dialog With the Machine, in Paradigms of Artificial Intelligence Programming, by Peter Norvig (a textbook)