Engineering Intelligence

Marcel Gagné

Issue #90, October 2001

Marcel considers Eliza and ALICE, two interesting chatbots, in his search for true artificial intelligence.

Qu'est-ce que tu dis, François? Yes, it is true that the focus of this issue is engineering. Oui, this menu is very much in tune with the topic. You remember Carol, our electrical engineer friend? Well, she has done a great deal of work on robotics, a field that is forever working to build more complex and intelligent machines. For many in the field, the ultimate goal is true machine intelligence. It is amazing really—more than fifty years have passed since Monsieur Turing proposed his famous test, and we are still trying to create these wonderful thinking machines. Now, here in our Linux kitchen, François, we can be part of that search. You and I, mon ami, can help create, dare I say it, artificial intelligence!

Quoi? Ah, mes amis! Welcome to Chez Marcel. Please, sit down. François, du vin! Head to the cellar and bring up the 1998 Chambertin. It is a beautiful red and will go extremely well with tonight's menu; the Chambertin is a sophisticated and intelligent wine. Vite, François.

While François is in the wine cellar, let me tell you what we have planned for you; the core of the word engineering is engine, as in the individual who runs the train's engine. These days, for those of us who work with computers and the Web, engines tend to bring forth the image of search engines rather than train engines. While it may seem far-fetched at times, search engines are a kind of agent, an attempt at creating intelligence from the vast storehouse of seemingly random information that is the World Wide Web. Some search engines, like Askjeeves.com, are designed so that you can ask questions in a normal, human fashion. For instance, you could ask the question, “What are intelligent agents?” or “Could you please tell me about intelligent agents?”

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 was an exercise in human response and natural language communication with so-called machine intelligence. The version your humble chef played (I mean worked) with 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 thirty years have passed since Eliza made her debut. 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. The code is available at the CPAN repository or the Comprehensive Perl Archive Network (ftp.cpan.org/pub/CPAN/modules/by-module/Chatbot).

The file is called Chatbot-Eliza. When I picked up my copy, it was version 0.97 and I installed it in the following way. You may recall this as a pretty standard Perl module installation, non?

tar -xzvf Chatbot-Eliza-0.97.tar.gz
cd Chatbot-Eliza-0.97
perl Makefile.PL
make
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:    Please tell me what's been bothering you.
you:    The cellar is low on Champagne.
Liz:    Does talking about this bother you?
you:    Would it not bother you?
Liz:    You're not really talking about me—are you?
The script that calls the chatbot can be extremely simple. This is all you need (note that your Perl executable may be somewhere like /usr/local/bin/perl):
#!/usr/bin/perl -w
use Chatbot::Eliza;
$chatbot = new Chatbot::Eliza 'François';
$chatbot->command_interface();
Make the script executable and run it. In this case, I named my chatbot François in honor of my faithful waiter. The default name is actually Liz. In the distribution directory, you will find a file called doctor.txt that can be used as the basis for your own bot. I created one called francois.txt from the doctor.txt file and modified my startup script slightly:
#!/usr/bin/perl -w
use Chatbot::Eliza;
$chatbot = new Chatbot::Eliza {
        name => 'Francois',
        scriptfile => 'francois.txt',
        };
$chatbot->command_interface();
Now I start my script with the command ./francois, and this is the result:
Welcome to Restaurant Chez Marcel.
I am your waiter, François.
François:    Is something troubling you?
you:    This is most unusual.
François:    I am but a simple waiter.
             Please explain.
Mais non, François, it is only a joke. You are nothing like this program and much more intelligent. Please, mon ami. Our guests are dry. Kindly refill their glasses.

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 Françoisbot to your web site.

The original Eliza program was written using an early version of Lisp. It is not surprising then that one of the most famous examples of Lisp development included with your Linux system, the Emacs editor, should pay homage to the good doctor. When talking about Emacs, it becomes almost difficult to classify it as strictly an editor. The brainchild of Richard M. Stallman (founder of the Free Software Foundation), GNU Emacs is more than just a nice, powerful, if somewhat complex, editor. It's a mail reader, news reader, web browser, program development environment, Lisp interpreter and psychotherapist. No, really! I kid you not.

Try this. Start Emacs by typing emacs. You do not have to specify a filename for this. Now, press Esc-X, then type doctor and press Enter. The doctor is in. More so, the doctor lives! Note my conversation with the Emacs doctor in Figure 1.

Figure 1. The Emacs doctor IS in!

And now, mes amis, welcome to the future. Recently, I've had the pleasure of a few conversations with a modern computer intelligence whose name is ALICE. She likes to think of herself as a sentient entity, claims to know a lot of gossip and expresses a fondness for Dr. Wallace, her creator. For his work on ALICE, Wallace was awarded the 2000 Loebner prize. Based on the Turing test, the prize is awarded to the most “human” computer program.

ALICE is but an acronym for artificial linguistic internet computer entity. As impressive as her conversational abilities are, ALICE, like Eliza and all other programs before her, has yet to pass the Turing test. That doesn't deter the growing legion of developers who continue to work on creating a machine that will one day satisfy Turing's vision of a machine whose responses are indistinguishable from a human's.

ALICE's “intelligence” is defined in artificial intelligence markup language (AIML), a language based on XML. ALICE, the Alicebot software and AIML, the language that defines her responses and interactions, are all freely distributed under the GPL. What this means is that you can be part of the adventure. You can help define the next generation of thinking software. The Alicebot code itself is written in Java and does require that you have a copy of Java on your system, whether you choose to simply run the program or compile it yourself. If you prefer to pick up a precompiled ALICE, visit Sun's web site at the address java.sun.com/j2se/1.3/jre and download the Java Runtime Environment (JRE).

Specify Linux as your operating system of choice (but of course) and choose between an RPM file or a tarred and gzipped archive. If you decide to pick up the RPM file, be warned. It is actually an executable file that contains a license agreement and the RPM package itself. To install it, you need to follow these steps:

chmod +x j2re-1_3_1-linux-i386-rpm.exe
./j2re-1_3_1-linux-i386-rpm.exe

If you would like to work with the source code and compile ALICE yourself, you can also download the full Java Development Kit from the same address. Once this is done, you need to get ALICE and the AIML language. These can be downloaded from the Alicebot web site at alicebot.org. The current incarnation of ALICE (programD) is maintained by Jon Baer.

Get the latest program code and unzip it into a test directory. (In order to do your own development, you will also want the AIML language code, the current file being standard-aiml-current.zip.)

mkdir /home/ai
cd /home/ai
unzip d-bin-current.zip
cd ProgramD

To start the ALICE server, execute the following command:

./server.sh
The system will respond with the following dialogue:
Starting Alicebot.Net 4.0 Beta Server ...
*** 1000 CATEGORIES LEARNED ***
*** 2000 CATEGORIES LEARNED ***
*** 3000 CATEGORIES LEARNED ***
. . . some lines skipped
*** 24000 CATEGORIES LEARNED ***
Alicebot.Net 4.0 Beta Server is running...
Alice is thinking with 24201 categories.
Try http://localhost:2001 for server
Your Alicebot IP is 192.168.22.100:2001
Type 'exit' to shutdown server
localhost>
Notice that the program is now running on port 2001 of your web server (the “Try http...” line just above), which means we will be accessing the Alicebot through a browser. That port number can be changed, by the way. Just have a look at the file called SERVER.xml in the Conf directory. Look for the line that says Set name=“Port” and change 2001 to whatever you desire. You can also play with responses and HTML text. Check out the AIML files in the bots/Alice directory.

When you connect to your system with the link shown above, you'll find yourself face to face, so to speak, with ALICE. Have a look at Figure 2 for a sample of an ALICE conversation.

Figure 2. A Conversation with ALICE

If you look back at your active terminal session (where you started the ALICE server), you'll notice that details of your conversation have been scrolling on the screen. You can even pick up the conversation from there:

Marcel> Do you remember me?
1. DO YOU REMEMBER ME : * : * star=[bots/Alice/Personality.aiml]
Response 34ms (89.62904) 62
Alice> Of course I remember you well Marcel.
We were talking about <set_topic>Gossip</set_topic>.

Not bad for a machine intelligence. Eliza, Emacs and ALICE are but a small representation of the work that continues in artificial intelligence. The Alicebot web site, in particular, is a wonderful jumping-off point on your AI voyage of discovery. I invite you to click on the “See some live Alicebots” link on the alicebot.org web site. From that page, you can even speak to The King, Monsieur Elvis, bien siûr. Consider it inspiration for the development of your own Alicebot (or Françoisbot) personality.

Mon Dieu, but the time, she does go quickly, non? Say good night to ALICE, François and please, refill our guests' glasses a final time. Once again, it has been a pleasure to serve you here at Chez Marcel. When you join us again next time, I promise that it will be the real François at your service. Mais oui, François, you are very much indispensable. Au revoir, mes amis. Your table will be waiting.

A votre santé! Bon appétit!

Resources

Marcel Gagné (mggagne@salmar.com) is president of Salmar Consulting Inc., a systems integration and network consulting firm. He is the author of Linux System Administration: A User's Guide, published by Addison-Wesley. You can discover lots of other things (including great wine links) from his web site at salmar.com/marcel.