README file for Chatbot::Eliza version 0.97 This module implements the classic Eliza algorithm. The original Eliza program was written by Joseph Weizenbaum and described in the Communications of the ACM in 1967. 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. This module encapsulates the Eliza algorithm in the form of an object. This makes the functionality easy to include in larger programs, including CGI scripts for the World Wide Web. USAGE: This is all you need to do to launch a simple Eliza session: use Chatbot::Eliza; $mybot = new Chatbot::Eliza; $mybot->command_interface; When creating an Eliza object, you can specify a name and an alternative scriptfile: $bot = new Chatbot::Eliza "Brian", "myscript.txt"; You can use any of the internal functions in a calling program. The code below takes an arbitrary string and retrieves the reply from the Eliza object: my $string = "I have too many problems."; my $reply = $mybot->transform( $string ); Complete usage notes are in the HTML and text documentation in the doc/ directory. These are right from the embedded POD. INSTALLATION: Installation is just like any other CPAN module, namely: perl Makefile.PL make make test make install WHAT'S NEW? Versions 0.96 & 0.97 - October 1999 -------------------- One tiny change to the regex which implements reassemble rules. Thanks to Gidon Wise for suggesting this improvement. Versions 0.94 & 0.95 - July 1999 -------------------- Fixed a bug in the way the bot invokes its random function when it pulls a comment out of memory. Version 0.93 - June 1999 ------------ Calling programs can now specify their own random-number generators. Use this syntax: $chatbot = new Chatbot::Eliza; $chatbot->myrand( sub { #function goes here! } ); The custom random function should have the same prototype as perl's built-in rand() function. That is, it should take a single (numeric) expression as a parameter, and it should return a floating-point value between 0 and that number. You can also now use a reference to an anonymous hash as a parameter to the new() method to define any fields in that bot instance: $bot = new Chatbot::Eliza { name => "Brian", scriptfile => "myscript.txt", debug => 1, }; Version 0.92 - April 1999 ------------ Fixed some more misspellings. Version 0.91 - April 1999 ------------ Fixed a misspelling (oops). Version 0.90 - April 1999 ------------ Fixed a bug in the way individual bot objects store their memory. Thanks to Randal Schwartz and to Robert Chin for pointing this out. Fixed a very stupid error in the way the random function is invoked. Thanks to Antony Quintal for pointing out the error. Many corrections and improvements were made to the German script by Matthias Hellmund. Thanks, Matthias! Made a minor syntactical change, at the suggestion of Roy Stephan. The memory functionality can now be disabled by setting the $Chatbot::Eliza::memory_on variable to 0, like so: $bot->memory_on(0); Thanks to Robert Chin for suggesting that. Version 0.40 - July 1998 ------------ Re-implemented the memory functionality. (Hope it's working!) Cleaned up and expanded the embedded POD documentation. Added a sample script in German. Modified the debugging behavior. The transform() method itself will no longer print any debugging output directly to STDOUT. Instead, all debugging output is stored in a module variable called "debug_text". The "debug_text" variable is printed out by the command_interface() method, if the debug flag is set. But even if this flag is not set, the variable debug_text is still available to any calling program. Added a few more example scripts which use the module. simple - simple script using Eliza.pm simple.cgi - simple CGI script using Eliza.pm debug.cgi - CGI script which displays debugging output deutsch - script using the German script deutsch.cgi - CGI script using the German script twobots - script which creates two distinct bots Version 0.32 - December 1997 ------------ Fixed a bug in the way Eliza loads its default internal script data. (Thanks to Randal Schwartz for pointing this out.) Removed the "memory" functions internal to Eliza. When I get them working properly I will add them back in. Added one more example program. Fixed some minor errors in the embedded POD documentation. Version 0.31 ------------ The module is now installable, just like any other self-respecting CPAN module. Version 0.30 ------------ This is the first module I've ever submitted to CPAN. I'm curious to hear any comments or criticism, or ways to improve this module in future versions. --John Nolan, jpnolan@op.net