The Genealogy of Eliza

(Maintained by Jeff Shrager (jshrager@stanford.edu))

What's New

[skip the news and jump to the code] [Click to jump to older news]


20190215: This amazing Eliza in gnuCOBOL was written by Arnold J. Trembley. It's a slightly indirect translation of Shrager's 1973/1977 BASIC version. The most amazing part of this (to me) is that it was written in 2017!

Mr. Trembley writes:

I also have a link on my website for an executable download for Eliza in GnuCOBOL that runs on Windows 7 and higher. I think it would probably run on Windows XP too.

I probably first saw ELIZA in BASIC from Ahl's computer games for BASIC book, but I also wrote a version in 1974 ANSI-standard COBOL for an IBM Series/1 Minicomputer way back around 1984. But I never saved that source code, so I had to start all over when I converted it into GnuCOBOL.

Getting Eliza to work was a lot of fun.


20190121: A few days ago I had the pleasure of taking a trip in a real live time machine.

About a week ago I got an out-of-the-blue message from Lars Brinkhoff via the ElizaGen issue tracker: "I have a version of ELIZA ported to Maclisp, dated 1977-09-05. Unfortunately, it's just a compiled binary file. Is this of any interest to you?"

Just a binary wouldn't be too interesting, so my initial reaction was muted: "Is there any way to either run it, or extract the embedded code?"

Turns out that Lars had significantly understated the situation: "The binary file is a compiled FASL, fast load file, so it's not easy to extract any code other than PDP-10 instructions. It might be possible, but a lot of work, to reconstruct Lisp code that compiles to approximately the same FASL code."

However, went on: "...we can run it in Maclisp running on a PDP-10 emulator. I have an emulator online."

Eliza on MacLisp on a PDP-10 emulator? Isn't there a level missing here? On what OS?

The answer gave me pause: MIT's ITS. ITS is one of the most important operating systems in CS history. (Among many other interesting historical facts, the original EMACS was developed on ITS!) I recommend reading about it here: ITS on Wikipedia. When I was an undergrad and grad student, in the late '70s and early '80s, we used MIT-AI's ITS remotely through the early ARPANet. Interestingly, at one point (I don't know for how long) the ITS at MIT-AI had an Eliza hacked into its command line driver so that unless you prefixed your commands with a ":", the response was from Eliza!

Eliza on MacLisp on ITS on a Dec 10 emulator? Really?!

Yeah, really!!

Here's the emulator: https://github.com/PDP-10/its

(Lars notes: "...there are more people involved than me. Foremost Eric Swenson who worked on Maclisp and Macsyma back in the day. We [...] update the emulators to support more hardware, fixing bugs, figuring out how to build and run programs, adding new software, Etc.")

If you want to play with a great piece of software history, you can log into this ITS emulator yourself; It's free and open. No password required!

From Lars:

Telnet to "its.pdp10.se, port 10003". Type Control-Z to log in. Then ":lisp games; eliza (init)" to start Maclisp and load ELIZA. It should look something like this:

==================
You: 
 
      telnet its.pdp10.se 10003

Trying 88.99.191.74...
Connected to pdp10.se.
Escape character is '^]'.

Connected to the KA-10 simulator MTY device, line 4

You: 
 
     type Control-Z

TT ITS.1648. DDT.1546.
TTY 25
2. Lusers, Fair Share = 0%
THIS IS TT ITS, A HIGHTY [sic] VOLATILE SYSTEM FOR TESTING

For brief information, type ?
For a list of colon commands, type :? and press Enter.
For the full info system, type :INFO and Enter.

The management apologizes for the use of the slow TK10 terminal
multiplexer.  We'll upgrade to the much faster Datapoint kludge once
it becomes available.


Then you type:
 
     :lisp games; eliza (init)


(Please Log In)
QUIT
SPEAK UP!
 
Et voila. you're typing back through 40+ years of computer history!
 
(Use double ENTERs to terminate your sentence to Eliza.)
==================

To test it, I pasted the "standard" example conversation from Wiezenbaum's Eliza paper. Here's a screenshot from the paper:

And here it is, running live on Lars's reborn ITS (the mess at the bottom is because I accidentally pasted the sentence twice, and had to backspace over it. The repeated chars are apparently how ITS displays backspacing):

There's a bit of a mystery about where exactly this version came form. Lars and I theorize that since BBN was right across from the AI lab, and it's known that BBN were users of the ITS systems, this may well be Bernie Cosell's original code!


20181031: Stefan Holtgen and Marianna Baranovska have just published a volume entitled: "Hello, I'm Eliza", with Computer Archaeologie.

Here is the abstract (rendered from the German by Google xlate):

The contributions to this volume are partly based on a conference held in October 2016 at the Institute of Musicology and Media Studies, and bring together authors from the fields of computer science, philosophy, media studies and media dramaturgy. In the individual chapters, the origins of the first chatbot ELIZA, which Joseph Weizenbaum developed at MIT's AI Lab in 1966, are reconstructed, Weizenbaum's programming language SLIP is presented and a first German-language translation of his publication to ELIZA is presented. As an extension of the topic, the authors ask what influence ELIZA had on computer culture, AI research, cultural criticism of the computer and art.

And here's the interesting cover:

Note that the code in the background is a part of Shrager's 1973/1977 BASIC Eliza (see below).


[Click to jump to older news]

Joseph Weizenbaum's original article:

Weizenbaum, J. (1966) ELIZA - A computer program for the study of natural language communication between man and machine. CACM 9(1) 36-45.

    [1966 Weizenbaum's original Eliza article in the CACM]

The paper remains under ACM copyright, and so is inaccessible except to those with special privileges. However, Google Scholar lists numerous version of the PDF online. (Use keywords: weisenbaum eliza, and click on the "All ... versions" link below the extract. Then just pick your favorite PDF source.) I have confirmed that there are at least 15 copies that can be accessed by this route.


Code


Bernie Cosell's Lisp Eliza @ BBN c. 1966-1972

This is the original Lisp Eliza (aka. Doctor) program, written by Bernie Cosell based upon Joseph Weizenbaum's original work. Weizenbaum's wrote his program in SLIP, a long-dead Fortran-based symbolic computing package. Cosell, working at BBN, created this BBN Lisp version from Weizenbaum's paper (see above), not from the SLIP code. Nevertheless, as SLIP never saw the popularity of Lisp, this is the version of Eliza that most folks have used, and from which most lisp-based Elizas derive. (A separate BASIC fork, not based upon either the Lisp or SLIP versions, was popular on early PCs. See below.)

Bernie writes: "I *never* saw any of the SLIP code and knew nothing about it. I wrote Doctor *completely* working just from the CACM article! In fact, if the SLIP code actually surfaced, it'd be interesting to see how different/similar ours were, since I [really] never saw any of Weizenbaum's code. Truth is that I did Doctor as a learning hack. Dan Murphy was [and still is] a good friend of mine from MIT and he was working on bringing up Lisp on the PDP-1b in the other building at BBN while I was system-czar for the Hospital Timesharing system on our PDP-1d. I knew a little Lisp from a course at MIT, but I figured that the best way to really "get" Lisp was to write something real. I had just joined the ACM [I started at BBN in the fall of '65] and I think Weizenbaum's Eliza article just happened to be in the very first copy of Communications that I received."

This release include high resolution TIFF scans of printouts of Bernie's code, including the Lisp code and scripts. from 1969 and 1972. He also provided a paper tape version from 1966, which I am in the process of reading, and will make public soon. The release also includes combined OCRed PDFs of each program and script. The OCR is not very accurate. I intend to release perfect transcripts as well as Modern Lisp macros that make this work.

Creative Commons License
Eliza/Doctor in Lisp by Bernie Cosell
Licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

[20131112] 600dpi scans of 1969 and 1972 printouts combined into PDFs and (roughly) OCR'ed
[20131112] 600dpi raw scans of the printouts of BBN Lisp Eliza code and scripts from 1969 and 1972

IT WORKS!

We have made the 1969 version of Eliza (aka. Doctor) work on modern Common Lisp, having to change almost nothing in the raw code transcripts! Here is the GitHub repo containing the code. Thanks to the following folks who helped transcribe the code from the original printouts: eMBee, Dave Cooper, Bob Felts, Saul Good, Ben Hyde, Simon Leinen, Patrick May, Charlie McMackin, Paul Nathan, Matt Niemeir, Peter De Wachter, Thomas Russ, Patrick Stein, and Jeff Shrager. And these folks made it work in modern CL Peter De Wachter, Matt Niemeir, and Jeff Shrager. If you want to become a github collaborator and work hands-on this project, write Jeff Shrager (jshrager@stanford.edu)

Thanks to Peter Seibel for making the original connection to Bernie.


James Markevitch has read and translated the 1966 version of Eliza in BBN lisp, and has created an emulator (in PERL!) for it that results in a working version! It's all available on the github site, and also as a tarball here.



2014-12-20: Jeff Barnett writes:

The original Eliza was moved to the ANFS Q32 at SDC (one of the (D)ARPA block grant sites) in the mid 1960's. The programmer responsible was John Burger who was involved with many early AI efforts. Somehow, John talked to one of the Playboy writers and the next thing we knew, there was an article in Playboy much to Weizenbaum's and everybody else's horror. We got all sorts of calls from therapists who read the article and wanted to contribute their "expertise" to make the program better. Eventually we prepared a stock letter and phone script to put off all of this free consulting.

The crisis passed when the unstoppable John Burger invited a husband and wife, both psychology profs at UCLA, to visit SDC and see the Doctor in action. I was assigned damage control and about lost it when both visitors laughed and kept saying the program was perfect! Finally, one of them caught their breath and finished the sentence: "This program is perfect to show our students just exactly how NOT to do Rogerian* therapy. *I think Rogerian was the term used but it's been a while.

A little latter we were involved in the (D)ARPA Speech Understanding Research (SUR) Program and some of the group was there all hours of day and night. Spouses and significant others tended to visit particularly in the crazy night hours and kept getting in our way. We would amuse them by letting them use Eliza on the Q32 Time Sharing System. One day, the Q32 became unavailable in those off hours for a long period of time. We had a Raytheon 704 computer in the speech lab that I thought we could use to keep visitors happy some of the time. So one weekend I wrote an interpretive Lisp system for the 704 and debugged it the next Monday. The sole purpose of this Lisp was to support Eliza. Someone else adopted the Q32 version to run on the new 704 Lisp. So in less than a week, while doing our normal work, we had a new Lisp system running Eliza and keeping visitors happy while we did our research.

The 704 Eliza system, with quite a different script, was used to generate a conversation with a user about the status of a computer. The dialogue was very similar to one with a human playing the part of a voice recognition and response system where the lines are noisy. The human and Eliza dialogues were included/discussed in A. Newell, et al., "Speech Understanding Systems; Final Report of a Study Group," Published for Artificial Intelligence by North-Holland/ American Elsevier (1973). The content of that report was all generated in the late 1960s but not published immediately.

The web site, http://www.softwarepreservation.org/projects/LISP/, has a little more information about the Raytheon 704 Lisp. The SUR program was partially funded and on-going by 1970.


Jeff Shrager's BASIC Eliza c. 1973 & 1977

Jeff Shrager created a BASIC version of Eliza in 1973 that appeared in Creative Computing in the July/August issue of 1977:

    [1977 BASIC Eliza in Creative Computing]

Shrager actually wrote it in 1973. Although he recalls having seen a copy of the Lisp code much later, his BASIC Eliza was written well before this, and was, to use his own words: "conceptual, and pretty poor." Regardless, 1977 was around the dawning of the era of the personal computer (the Commodore PET, Apple ][, and TRS-80 were all introduced in that year!), and although few folks in the hobbyist community knew Lisp, lots of them knew Basic, so Shrager's Eliza was widely circulated and many knock-offs appeared in many other languages, some as late as 2015. (The latest one I know of is Paco Willers' 2015 GO version.) Shrager's version has even apparently been translated back into Lisp a number of times. Indeed, there are so many near-and-distant knock-offs of this program floating around that it would be pointless to try to assign any sort of Creative Commons, or otherwise, license to it.

The version published in CC in 1977 was under CC editor Steve North's byline, but Shrager is correctly attributed as the author in the comments.

This alternative publication:

    [1984 BASIC Eliza in Big Computer Games]

gives the correct year of creation of the program as 1973.

Note that North's text incorrectly attributes the Lisp Eliza to Joseph Weizenbaum, whereas it was actually written by Bernie Cosell (see above). This was, and continues to be, a common mistake.

Paco Willers has undertaken a detailed, nearly line-by-line, deconstruction of the Shrager/North 1973/1977 BASIC code.

If you have an iPhone or iPad and are seeking immediate Eliza gratification, check out "iAltair", a MITS Altair 8800 CP/M simulator that comes with a copy of ELIZA.BAS, adapted directly from the Creative Computing version.

Check it out:


Richard Stallman's GNU EMACS "Doctor"

The code for the GNU EMACS "doctor" can be found in the GNU EMACS repo, currently:

     http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/play/doctor.el

It begins:

;;; doctor.el --- psychological help for frustrated users

;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2013 Free Software
;; Foundation, Inc.

;; Maintainer: FSF
;; Keywords: games

...

;;; Commentary:

;; The single entry point `doctor', simulates a Rogerian analyst using
;; phrase-production techniques similar to the classic ELIZA demonstration
;; of pseudo-AI.

It was most likely written by Richard Stallman. Note this subset of code:

 (set (make-local-variable 'doctor--stallmanlst)
       '(((doc$ doctor--describe) your (doc$ doctor--feelings-about) him \.)
        ((doc$ doctor--areyou) a friend of Stallman \?)
	 ((doc$ doctor--bother) Stallman is (doc$ doctor--random-adjective) \?)
	  ((doc$ doctor--ibelieve) you are (doc$ doctor--afraidof) him \.)))
It claims to use techniques "similar to the classic Eliza", but doesn't say whether it is based upon Cosell's Lisp code or Weizenbaum's paper. Although it is unknown whether Stallman actually saw Cosell's version, it's pretty likely that he did, being a Lisp hacker and at MIT around the time that the Lisp version would have been making the rounds.


Various other Elizas

If you know of open source Elizas in any language roaming around, please send me links or code so that I can add them to this section.

→ Steve Cherry's 1982 Lisp Eliza

[Okay, this is crazy: Cherry's version of Eliza appears in a book called "Learning Lisp", which was an imprint of the manual for an Apple ][ Lisp, written by Cherry, called PLisp. Cherry's Eliza seems mostly based upon Shrager's 1973/1977 BASIC Eliza. (It has essentially the same key and response structure as Shrager's, but has a priority system, a ittle like Cosell's. So it's not a direct translation, but is pretty close.) Shrager's Eliza had been ported to an Apple ][ at some point, so Cherry would definately have had it close to hand. Anyway, so bear with me here now: Cherry's PLisp manual was actually a port of a Lisp textbook written by Shrager and a friend (Steve Bagley) in about 1979. (See the preface to Learning Lisp). HOWEVER, Shrager and Bagley's book didn't include an Eliza !! Cherry apparently added it for either the PLisp user's manual, or later for the imprinted book version of that manual. What this means is that Cherry, probably unknowingly, borrowed (fairly directly) Shrager's BASIC Eliza, which was itself borrowed (indirectly) by Shrager from a Lisp program, back into a different Lisp program to appear in a manual/book on Lisp originally co-authored by Shrager, who wrote the original (BASIC) Eliza that Cherry based his Lisp Eliza on ... Confusing enough for you!?]

→ This amazing Eliza in gnuCOBOL was written by Arnold J. Trembley. It's a slightly indirect translation of Shrager's 1973/1977 BASIC version. The most amazing part of this (to me) is that it was written in 2017! Mr. Trembley's web site contains links to gnuCOBOL compilers and other fun stuff.

→ TRS-80 Assembly Version (based on the CC Basic -- contributed 2015-11-22 by John D.): Cassette program An emulator that lets you just load the "cas" file directly The original instructions And here's a YouTube video of a real TRS-80 with the Voice Synthesizer, running Talking Eliza.

→ The disk image of Michael Wessel's German BASIC Eliza: https://cpcrulez.fr/applications_list_util-elisa.htm, which can be run using the CPC Emulator in Javascript running in the Browser, here: http://cpcbox.com. (Choose configuration "464", Select the Eliza DSK file, extracted from above, use: "DRIVE A:", When the CPC boots up, enter "cat", Enter: RUN "ELISA-NS")

→ Paco Willers has written a GO version of the classic BASIC Eliza. In the process he did a detailed, nearly line-by-line, deconstruction of the Shrager/North 1973/1977 BASIC code.

→ Tcl Eliza, possibly by Gerry Snyder (explicitly inspired by the BASIC version)

→ NLP-Addtion.com's Eliza Chat Bot in js(directly based on the BASIC version)

→ Eliza in Gawk by Juergen Kahrs (directly based on the BASIC version)

→ Benjamin Ryves's Eliza in TI-83/84 Plus Assembly (based on the BASIC version)

→ Charles Hayden's Eliza java applet (claims to be a faithful implementation of Weizenbaum's).


Old News


20180529: Peter De Wachter found a very interesting version of an Eliza clone from c.1971 (!!) Peter writes: "The B5500 emulation project has imaged a bunch of old tapes and they found (among much other software) a 1971 Eliza implementation by Charles Fricks and John Covert from Georgia Tech."

The full story is here:

http://retro-b5500.blogspot.com/2018/05/the-cube-library-tapes.html

The Eliza source code is here:

https://github.com/retro-software/B5500-software/blob/master/CUBE-Library-13/Files/ELIZA-Z100010.gtl

https://github.com/retro-software/B5500-software/blob/master/CUBE-Library-13/Files/ELIZA-SCRIPT.dat

What makes this so interesting is that the implementation language is "Georgia Tech Language" (?), which seems to be an Algol extended with Lisp primitives. The resulting code looks like this:

P1:  IF ATOM(CADR(NEXT)) THEN BEGIN
     IF CADR(NEXT)=CAR(R) THEN BEGIN
     NEXT:=CDR(NEXT);
     GO TO L1;                  END;
     GO TO L6;   END;
     DL:=IF CAADR(NEXT)= "*" THEN CDADR(NEXT) ELSE CDADADR(NEXT);
     IF MEMBER(CAR(R),DL) THEN BEGIN
     NEXT:=CDR(NEXT);
     GO TO L1;  END;

(Note CDADADR !!)


20171211: My friend and colleague, Michael Wessel, who apparently has a soft spot for ancient speech synthesizers, recently noted this curious coincidence/historical anecdote about a German version of my BASIC Eliza. (Michael and I worked together on the AURA project at SRI for about a year around 2013.)

Michael writes:

"About 1985 I typed in a version of your BASIC Eliza from a public library copy of the 'Creative Computing Computer Games' book, into my Amstrad CPC 464 home computer. The book had been translated into German, and so was Eliza! I wish the editors hadn't done so, as it makes much less sense!

Back then I owned a speech synthesizer (the Amstrad SSA-1 for the CPC), and I had extended your BASIC Eliza with speech capabilities. The audio/speech quality was as awful as some of the TRS 80 speech synths you can hear on YouTube.

Now, 32 years later or so I am working on a little spare time hobby project - a modern, understandable speech synthesizer for the Amstrad CPC, which is designed to be compatible with that original "retro" Amstrad SSA-1 speech synthesizer. And indeed, the old Eliza that got extended with SSA-1 speech output is working well with my modern speech synthesizer."

Here's a youtube video of Michael's German-speaking Eliza.
And here is another version for the CPC, also with speech output.

Michael continues:

"With respect to the second video (the English one), the original author of this Eliza version also mentions your Eliza as the source for the program, but he says he extended it significantly, and then I added speech output, this time using the 'native mode' of my speech synthesizer, which gives much better speech quality than the emulated 'retro SSA-1' compatibility mode, as you can hear."
As I mentioned above, Michael and I worked closely together at SRI for about a year. He concluded his note this way: "It's really a funny and strange coincidence that our ways have crossed; What are the chances that you get to work with someone whose BASIC program you typed in from a public library book 30 years ago? Sometimes, the world is small!"

I couldn't agree more!


Here's the disk image of Michael's German BASIC Eliza:

https://cpcrulez.fr/applications_list_util-elisa.htm

To run it:


Here are some PS2 Screenshots from emulator running in Firefox:

20170728: Through the efforts of Dave Walden and Bernie Cosell, the tapes and listings of Bernie's original Lisp version of Eliza/Doctor have been accepted into the Computer History Museum archives as lot number: X8258.2017.

20170307: Jeffrey Perrone pointed out this hysterical video of Eliza talking to Eliza on two side-by-side Google Home systems!

20151122: John D. writes (email to Jeff Shrager of 2015-11-22): "Back in 1979, Radio Shack released their own commercial version of Eliza for their TRS-80 Model I, sold in their stores. It was written in machine language, not Basic, on cassette tape. In fact, the tape had two versions: a regular one, and a special version that gave Eliza's response through the expensive Voice Synthesizer they were selling (a Votrax derivative)."

"The interesting thing about Radio Shack's version is that it seemed a bit more sophisticated than the original Weizenbaum version. It recognized more words. (Including swear words--just so it could react with 'There's no need for that language.'-- which is weird to see inside a mass-market product sold by a major corporation!) And when you said "Goodbye" it gave you a diagnosis: everything from "You have no psychological problems besides a normal amount of paranoia" to 'I must conclude you are dangerously psychotic and should be locked up'!"

"It was apparently written by Device Oriented Games in Dallas (near where Radio Shack was based)."

Links to runnable code:

John also found this YouTube video of a real TRS-80 with the Voice Synthesizer, running Talking Eliza. The Votrax quality is terrible, but that makes it all the more fun!

20151013: Paco Willers has written a GO version of the classic BASIC Eliza. In the process he did a detailed, nearly line-by-line, deconstruction of the Shrager/North 1973/1977 BASIC code.

20150910: Melody Ayres-Griffiths (melody@planetirata.com) found this completely wacko version written by Dave Babcock in Integer BASIC, which uses computed gotos! It looks to my eye like someone took the Shrager/North version and stuck it in a blender. :-) It would be easier to generate this from a compiler, than to write it out straight!

20150105: James Markevitch has updated his 1966 version with a slightly cleaned up transcript, and his amazing PERL BBN Lisp Interepreter! I've uploaded everything to the github site, and it is all also available for download as a tarball here.



This site is maintained by Jeff Shrager (jshrager@stanford.edu)
Thanks to CommerceNet for their support.