In 1965 a professor at MIT, Joseph Weizenbaum, introduced a computerized conversation simulator he called ELIZA. The most famous ELIZA transcript was published soon after in an article Weizenbaum wrote for the January, 1966, volume of Communications of the ACM. It is a record of a conversation between the program and a young woman; the program’s responses in the text below are in all caps.
Men are all alike.
IN WHAT WAY
They’re always bugging us about something or other.
CAN YOU THINK OF A SPECIFIC EXAMPLE
Well, my boyfriend made me come here.
YOU BOYFRIEND MADE YOU COME HERE
He says I’m depressed much of the time.
I AM SORRY TO HEAR YOU ARE DEPRESSED
It’s true. I am unhappy.
DO YOU THINK COMING HERE WILL HELP YOU NOT TO BE UNHAPPY
I need some help, that much seems certain.
WHAT WOULD IT MEAN TO YOU IF YOU GOT SOME HELP
Perhaps I could learn to get along with my mother.
TELL ME MORE ABOUT YOUR FAMILY
My mother takes care of me.
WHO ELSE IN YOU FAMILY TAKES CARE OF YOU
You are like my father in some ways.
WHAT RESEMBLANCE DO YOU SEE
You are not very aggressive but I think you don’t want me to notice that.
WHAT MAKES YOU THINK I AM NOT VERY AGGRESSIVE
You don’t argue with me.
WHY DO YOU THINK I DON’T ARGUE WITH YOU
You are afraid of me.
DOES IT PLEASE YOU TO BELIEVE I AM AFRAID OF YOU
My father is afraid of everybody.
WHAT ELSE COMES TO MIND WHEN YOU THINK OF YOUR FATHER
DOES THAT HAVE ANYTHING TO DO WITH THE FACT THAT YOUR BOYFRIEND MADE YOU COME HERE
It is often assumed that “Eliza” is simply the name of the psychotherapist with which the human “patient” converses, but this is not in fact the case. ELIZA is actually the name of a generalized conversation system of Weizenbaum’s devising, being a reference to a working-class character in George Bernard Shaw’s play Pygmalion who learns to speak in an upper-class diction in spite of her origins. The metaphor, then, is that the computer has traded in the inflexible diction of a programming language for everyday natural language. Different “scripts” could be plugged into ELIZA to represent different characters. The first of these to be developed by Weizenbaum, as well as the one that generated the transcript above and the one that everyone remembers today, was called simply “Doctor.” In the film Rebel at Work Weizenbaum describes the process that led him to this rather brilliant character choice:
“And then all of a sudden it came to me: the psychiatrist. The psychiatrist asks questions in response to what the patient says. It may be partially or totally irrelevant, but the patient will interpret his words in terms of his own frame of mind. The patient assumes that the psychiatrist knows something, that he understands, that there is some sense to his words. ‘I don’t know what it is yet, but it’s not nonsense.’ And that’s how it started — then came ELIZA.
‘Well,’ says the psychiatrist, ‘perhaps… what does this remind you of?’
‘Hmm, very clever!’ thinks the patient. ‘This is a psychiatrist who really knows what I feel. I’m going to continue working with him.'”
As Weizenbaum was careful to describe in his article, in no sense does ELIZA actually understand anything its interlocutor enters. It is simply an elaborate text-generation engine, which searches for patterns in the entered text which can serve as hooks to be manipulated and recombined into its responses. The genius of the “Doctor” script is that this is also essentially what a psychotherapist often does during a session, at least from the perspective of the layman.
Weizenbaum did prepare at least a few other ELIZA scripts, such as (keeping with the mental health theme) one for a paranoid schizophrenic, but these apparently did not have quite the same magic, and aren’t much remembered today. UPDATE: Actually, as Nick points out in the comments below, we have no evidence that Weizenbaum developed any scripts other than “Doctor.”
Even if we confine ourselves to “Doctor,” the famous script I included above is something of a best-case scenario. Weizenbaum, usually quite sober about these things, was stretching the truth considerably when he called it a “typical conversation” in his article. There inevitably comes a point in any ELIZA session that continues for any length of time when the program says something that clearly reveals it to be the elaborate parlor trick that it really is. Such breakdowns are at least as common as the several surprisingly apropos responses in the transcript above.
Weizenbaum wrote ELIZA in Lisp, a somewhat esoteric programming language developed at MIT for artificial intelligence and natural language processing applications. UPDATE: Make that MAD-SLIP, which originated at the University of Michigan. See Nick’s comment below for more details. However, his detailed ACM article served the same purpose as did Don Woods’s meticulously commented Adventure source code of ten years later, making the porting of ELIZA to other platforms and languages a relatively straightforward task. In the process, Weizenbaum’s original concept of a generalized conversation engine was forgotten, and ELIZA the system became Eliza the female psychotherapist. Creative Computing published a version in BASIC by Jeff Shrager and Steve North in its July/August, 1977, issue. In North’s words, “Although the program is an inferior imitation of the original, it does work.” Its limitations in comparison with Weizenbaum’s original derive from being written in BASIC and from the necessity of running in just 16 K of RAM. It’s nevertheless impressive in its way for what it is, and would serve as a springboard for countless sequels and derivations over the next decade. It seemed no one could own a microcomputer in the 1970s or 1980s without having some sort of Eliza variant somewhere in their software collection.
If you’d like to try out this version of Eliza on a virtual TRS-80, you can do so using the SDLTRS emulator and this state file.
1. Make sure the Level 2 ROM file and the NewDOS boot disk are in the emulator’s root directory, and that the state file is in some known location.
2. Start the emulator.
3. Turn your caps-lock on.
4. Press ALT-L to load a state.
5. Navigate to the state file and select it.
You’ll find yourself at a BASIC READY prompt, from which you can LIST the program, edit it, and of course RUN it. (Yes, it is very, very slow; such is life when doing lots of string processing in BASIC on a 1.78 MHz machine.) Type “SHUT” at any prompt to quit the program — and remember, you must have your caps lock on for it to “understand” you.
Finally, for those who know how to deal with such things, I’ve also made available the tokenized TRS-80 BASIC file of Eliza.
So, having talked about what ELIZA is we can soon get to the more interesting questions of how it works and what it means — and why I felt compelled to backtrack this way in the first place.
Postscript (June 17, 2011):
I’ve grown disenchanted with the SDLTRS emulator, and decided to use the one included with the MESS project from now on. Here’s a state file for use with that emulator. See my recently revised post on emulating the TRS-80 for more details on how to get a virtual TRS-80 working under MESS.
June 16, 2011 at 1:56 am
Jimmy, thanks for this note on Eliza and for documenting the distinction between the overall system (Eliza) and the particular psychotherapist script (Doctor). The BASIC port you describe is certainly significant as an example of AI on microcomputers.
You mention that among the other scripts Weizenbaum wrote was “one for a paranoid schizophrenic” – did he really? It was Kenneth Colby who wrote PARRY, if that’s the program you have in mind. I’d be very interested to know if Weizenbaum had written one first, or indeed what were any of the other scripts for the Eliza system that Weizenbaum wrote.
Also, you state that Weizenbaum wrote ELIZA in Lisp, but I think you are referring to a famous port of ELIZA. Weizenbaum wrote the system in MAD (the Michigan Algorithm Decoder) using his own SLIP libraries for that language, see here or here.
June 16, 2011 at 8:22 am
Thanks for the corrections!
One nice thing about developing this material in a blog is that I have lots of smart people looking over my shoulder, which comes in very handy when I get sloppy in my basic research or overreach in my theory. I’m afraid this is a pretty good example of the former.
While I wish I could unveil a treasure trove of new Weizenabum-authored ELIZA scripts at this point, I can’t; I was indeed confusing Weizenbaum’s work with that of Colby. And you are of course also correct about the language Weizenbaum used.
April 10, 2021 at 2:32 pm
I’m very late to this post but one part that’s probably worth clarifying here: by no means is ELIZA (in any variant, most certainly not the BASIC port) “an example of AI on microcomputers.”
Artificial intelligence is not just about parroting responses back after doing some tokenizing. There is literally nothing at all in the programmatic structures of ELIZA that would have even the rudiments of what we now call machine learning, much less artificial intelligence. If anything it could be said to be a pre-cursor to chatbots, but even more accurately it was really just natural language parsing.
I say all this because that aspect of ELIZA’s history is much more important in understanding how it framed a particular type of interface in the form of a “conversation” with the program. In essence, it was a kind of game. This is more interesting when you consider that, later on, Weizenbaum spoke out quite a bit against what he saw as the erosion of boundaries between people the machines they interacted with.
Weizenbaum very much understood that ELIZA was absolutely not artificial intelligence, such that he said has concerned that people didn’t seem to know they were really “talking” to nothing but a bunch of circuits. As such he became very concerned about machines that — unlike ELIZA — perhaps could, someday, mimic some sense of human understanding such that people could actually be fooled quite a bit more than they could with ELIZA.
From a historical standpoint, I think this kind of correction is very much needed and understood, particularly given how much concern Weizenbaum had for people who made the mistake of thinking ELIZA had anything at all to do with “intelligence.”
December 8, 2021 at 5:57 pm
I have a quibble with Jeff’s assertion that “There is literally nothing at all in the programmatic structures of ELIZA that would have even the rudiments of what we now call machine learning, much less artificial intelligence. If anything it could be said to be a pre-cursor to chatbots, but even more accurately it was really just natural language parsing.”
There’s AI and then there’s AI.
You’re right that most people who say “AI” today in 2021 probably mean “statistical AI,” where a computer uses training data to learn a model from patterns in the dataset. But the field of artificial intelligence has a long history prior to the current emphasis on machine learning. Back in 1965 when ELIZA was developed, a more common approach was “symbolic AI,” where humans hard-coded rules for the computer (instead of the computer learning them directly from data). For instance, Newell and Simon watched experts play chess, and coded up heuristic rules for the computer based on what those experts seemed to be doing. Such symbolic AI seemed like a viable approach at the time, before the field realized just how hard the problem really was.
Weizenbaum clearly knew ELIZA was not “intelligent” in the sense of artificial *general* intelligence. But ELIZA’s (very rudimentary!) natural language processing still fits well as an early step in this tradition of what was considered AI in 1965, *at the time that Jimmy is talking about in this article*. Frankly, even when Jimmy wrote this post in 2011, the currently-dominant paradigm within statistical AI (propelled by improvements in deep learning) was just beginning to take off, and the field looks quite different 10 years later.
June 16, 2011 at 8:42 am
My first contact with an Eliza port was in the mid 80’s. It was a BASIC conversion I patiently typed from the spanish edition of an AI book by Tim Hartnell. The editor included a port to ZX Spectrum 48k BASIC (which handled character string arrays in its very own and peculiar way) as an appendix to the book. While the Spectrum conversion was quite effective, its real drawback was the spanish translation, which was made just by literally translating every string on its own. That didn’t work at all as a whole (most answers were a total nonsense). In that sense I was working with a limited version from an already limited version, but just like that first BASIC port you mention, it did its job, driving me into learning how the “magic” was done.
June 25, 2011 at 2:54 am
My parents got me an Apple II/e in 1984 or so, which would have made me seven years old. I only knew how to do a CATALOG or how to RUN a program. Still that proved enough, and one day I ran Eliza. After the session, I tried to think of other commands to try. I figured that LIST would list something, so typed it in, and for the first time saw computer code. It clicked in my little brain! The computer just follows these instructions! I knew right away that I had to learn how to do this. I have programmed ever since. It still feels magical. Thanks Eliza!
May 20, 2017 at 5:16 pm
How to make a moderate bot in a web site?
Good job folks.
November 9, 2017 at 10:13 pm
any length of the time -> any length of time ?
November 10, 2017 at 9:41 am
May 4, 2019 at 8:34 pm
first update: Weisenbaum -> Weizenbaum
when the programs says something-> program
May 7, 2019 at 8:59 am
September 21, 2022 at 8:58 pm
I used a version of this on the TRS-80 in the 1980s, Since I was really young at the time, it seemed like the computer was talking back to me.