Need A Psychiatrist? Meet Eliza

For some of us, our original exposure to AI, or artificial intelligence, goes back to an old program called Eliza. Eliza was a kind of computerized psychiatrist written in the 1960s by Professor Joseph Weizenbaum at the Massachusetts Institute of Technology. Eliza (named after the character in George Bernard Shaw's "Pygmalion") was an exercise in human response and natural language communication with so-called machine intelligence. The version I played with all those years ago was a DOS program running on a TRS-80. Ah, nostalgia. Eliza may not have been a great doctor, but it was a fun and fascinating program, a kind of whimsical promise of the future of AI.

Over forty years have passed since Eliza made her debut in 1966. You can still find incarnations of her everywhere on the Internet. Eliza's ghost is represented in many of the bots and chatterbots you'll find on IRC channels and MUDs. In fact, you can download Eliza as a Perl module and experiment with the creation of your own bots using your own Linux system. The code is available at the CPAN repository or the Comprehensive Perl Archive Network. You can find the latest incarnation at http://search.cpan.org/dist/Chatbot-Eliza/ .

The file is called Chatbot-Eliza. When I picked up my copy, it was version 1.04 and I installed it in the following way.

tar -xzvf Chatbot-Eliza-1.04.tar.gz
cd Chatbot-Eliza-1.04
perl Makefile.PL
make
sudo make install

In the installation directory, you'll notice a file called simple. You can use this as the basis for creating your own AI, or you can simply execute the script by typing ./simple as I did in the following example:

$ ./simple
Welcome to your therapy session.
Your therapist's name is Liz.

Liz:    Is something troubling you?
you:    I'm concerned about artificial intelligence.
Liz:    Do you know anyone else who is concerned about artificial intelligence?
you:    Several people I know have different concerns regarding the subject.
Liz:    What differences do you see?
you:    Some are excited about computer intelligence and others are frightened.
Liz:    Do computers worry you?
you:    Not particularly.
Liz:    Tell me more about that.
you:    I've always had a fondness for computers, real or fictional.
Liz:    What about machines worries you?
you:    That they might actually understand what i am talking about.
Liz:    Are such questions much on your mind?
you:    Are they on yours?
Liz:    Possibly they are they on mine.
you:    Do you have anything else to offer?
Liz:    We were discussing you -- not me.
you:    I see. I should probably go.
Liz:    That's quite interesting.
you:    Goodbye.
Liz:    Goodbye.  It was nice talking to you.

The script that calls the chatbot can be extremely simple, hence its name. If you don't like the name Liz or the introductory text, edit the file and change it here.

use Chatbot::Eliza;
$chatbot = new Chatbot::Eliza 'Sigmund';
$chatbot->command_interface();

Make the script executable and run it. In this case, I have renamed my chatbot Sigmund. The default name is actually Liz. In the distribution directory, you will also find a file called doctor.txt that can be used as the basis for your own bot. I created one called mywords.txt from the doctor.txt file and modified my startup script slightly:

#!/usr/bin/perl -w
use Chatbot::Eliza;
$chatbot = new Chatbot::Eliza {
        name => 'Turing',
        scriptfile => 'mywords.txt',
        };
$chatbot->command_interface();

Now I start my script with the command ./myai, and this is the result:

$ ./my-ai

Turing: Well, well. Another person trying to see if machines can think.
you: There's no doubt that I am curious.

Particularly interesting in this distribution is an included script called twobots that lets two Eliza bots talk to each other. The resulting discussions can be quite interesting. You'll also find a script called simple.cgi so that you may add your own Eliza chatbot to your web site and share your therapist, or whatever you want Eliza to be, with the world. 

Artificial? Definitely. Intelligence? Depends on who you ask, I suppose.

Have fun!

Facebook Comments Box

Leave a Reply

Your email address will not be published. Required fields are marked *