NAME
OurNet::ChatBot - Context-free interactive Q&A engine
SYNOPSIS
use OurNet::ChatBot;
my $bot = eval { OurNet::ChatBot->new('fianjmo', 'fianjmo.db') };
if ($@ or !$bot->{db}{idxcount}) {
die "No database found. you must build it with 'make test'.\n";
}
while (1) {
print '['.($ENV{USER} || 'user').'] ';
print '<fianjmo> '.($bot->input(scalar <STDIN>) || '...')."\n";
}
DESCRIPTION
The ChatBot module simulates a general-purpose, context-free, interactive Chat Bot using the OurBot(tm) engine. It reads the file stored in ChatBot/ directory, parses synonyms and random output settings, then return answers via the input() method.
The lastone property is used to return/set the id of the bot's last sentence. In conjunction of directly manipulating the CHUNKS array (which contains all possible return values for input()), the front-end program could prevent duplicate responses.
CAVEATS
The nextone flag-property is implemented badly.
SEE ALSO
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2001 by Autrijus Tang <autrijus@autrijus.org>.
All rights reserved. You can redistribute and/or modify this module under the same terms as Perl itself.