Back to Top

Artificial intelligence

ALICE and friends. Artificial Intelligence Reloaded

If you've been following my posts on artificial intelligence (or AI, if you prefer), you may have already spent some time playing with Eliza and consulting with the Emacs Doctor. I hope so because I'm going to take this one step further. Log in to your Linux system and let's get going . . . 

As much fun as the emacs doctor might be, you'll soon discover that it's not much different from our friend, Eliza. For a more credible machine intelligence, you'll soon run into something called AIML, or Artificial Intelligence Markup Language. Much of the energy that has gone into developing AI programs of late focuses on AIML interpreters and the A.L.I.C.E. system created by Dr. Richard Wallace (more on this shortly). Dr. Wallace won the 2000, 2001, and 2004 Loebner prize for the most 'human' program; that would be the bronze since no one has yet claimed the gold.

There are many AIML chatbots out there. Some masquerade as famous people like Captain Kirk, Elvis, or God. And yes, you can chat with them on their respective Websites. If, however, you'd like to get into the AIML action yourself, start with one of the projects built on this language. Like Howie.

Meet the Emacs Doctor

Dec 20, 2011 - Tags:

In my last article on the subject of artificial intelligence (or AI, if you prefer), I introduced you to Eliza, a computerized psychiatrist. Eliza may be simple, but she is patient and she's happy to let you talk.

Speaking of therapy, and at the risk of opening up old wounds and old battles, specifically the "vi vs emacs" conflict (the answer is vi, or vim), let's consider another form of AI therapy.

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!

As much fun as the emacs doctor might be, you'll soon discover that it's not much different from our friend, Eliza. The advantage here is that, the doctor is always in, assuming, of course, that you have emacs installed. So next time you find yourself contemplating the meaning of life while you are in the middle of some stubborn Python code, save your work and just call up the doctor. It's free software so you can keep the 5 cents.

Need A Psychiatrist? Meet Eliza

Dec 16, 2011 - Tags:

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!

Comments

Subscribe to Artificial intelligence
The Original Cooking with Linux
 
Appearing monthly, 3rd Thursday, on Computer America
Appearing every 3rd Thurday of every month on the Computer America radio show.
  • :-) Ive been watching Dark Matter on Netflix and reading way too much about robots and AI recently. 3 hours 41 min ago
  • Are you testing to see if I'm a replicant or a lesbia- pansexual? 4 hours 36 min ago
  • 🙄 16 hours 56 sec ago
  • Dads are people, too! At least, I think they are. 16 hours 1 min ago
  • Please stop offending me with you "dad" haiku. 🙄 16 hours 2 min ago