ElizaBot

From S23Wiki
Jump to: navigation, search

Creating An Eliza IRC Bot: Using The Comprehensive Perl Archive Network

The Net::IRC module provides support for Perl to handle the Internet Relay Chat protocol. With this module, you can write an IRC bot -- a Perl program which connects to an IRC server as if it were an IRC client and interacts with that server programmatically.

The second is one of my favorite modules, Chatbot::Eliza, which implements the classic Eliza algorithm. The original Eliza program was written by Joseph Weizenbaum and was described in the Communications of the ACM in 1966: Eliza is a mock Rogerian psychotherapist. It prompts for user input and uses a simple transformation algorithm to change user input into a follow-up question. The program is designed to give the appearance of understanding.

This program is a faithful implementation of the program described by Weizenbaum. It uses a simplified script language devised by Charles Hayden. The content of the script is the same as Weizenbaum's.

I wanted to see what would happen if the Net::IRC module was hooked into Chatbot::Eliza to make an IRC bot that acts like a psychotherapist. The process was easier than I thought, and a good example of how to reuse existing code from the CPAN.

To install the two modules needed in this program, simply do the following:

$ perl -MCPAN -eshell
cpan> install Net::IRC Chatbot::Eliza
[cpan installation stuff omitted]
cpan> quit
 $

...

--> Joseph Weizenbaum Bots IRC Perl