Eliza

ELIZA is based on a "script" consisting of patterns and corresponding responses: in essence all the program does is to look for patterns in your side of the conversation and echos back a corresponding response. A portion of the script file is:

  decomp: * i remember *
    reasmb: Do you often think of (2) ?
    reasmb: Does thinking of (2) bring anything else to mind ?
    reasmb: What else do you recollect ?
    reasmb: Why do you remember (2) just now ?
    reasmb: What in the present situation reminds you of (2) ?
    reasmb: What is the connection between me and (2) ?
    reasmb: What else does (2) remind you of ?
This is a set of instructions for what to do if the pattern "i remember" is encountered in what you say;
>> Hello.
How do you do. Please state your problem.
>> I remember big cars
The first time it is found the first "reasmb" line dictates ELIZA's response will be Do you often think of big cars ?
Try it!

As you can see, the (2) in the script is replaced with what follows the "i remember" pattern. Next time an "i remember" is found the second "reasmb" line is used; for example:
>> Hello.
How do you do. Please state your problem.
>> I remember big cars
Do you often think of big cars ?
>> When I'm climbing cherry trees I remember blue toed sloths
Does thinking of blue toed sloths bring anything else to mind ?
And so on through the list of possible responses. Of course the entire set of rules is more complicated; here they are. Have a look at one of the other rules and see if you can predict ELIZA's response to a set of questions; try it.

Do you think you could modify the script to be:

  • Your headteacher?
  • A prime minister?
  • Your parents?
  • Your friend?

This rendition of ELIZA is a complete and faithful implementation by Charles Hayden of the program described by Weizenbaum. The full paper has a much more thorough description of ELIZA's operation.