Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^2: Artificial Intelligence experiment

by PerlGuy(Tom) (Acolyte)
on Feb 03, 2020 at 21:51 UTC ( #11112341=note: print w/replies, xml ) Need Help??

in reply to Re: Artificial Intelligence experiment
in thread Artificial Intelligence experiment

Thanks! The article about ELIZA is hilarious, in that this AI "doctor" was also based on the principle of the superficiality of communication, and how many people were fooled, feeling like they received real help from an apparent psychotherapist.

My program is much simpler than ELIZA, just a hash, really, and a CGI interface. It could probably be almost a one liner if I was a more experienced programmer. The trickiest part was just getting around Perl's taint checking, and some additional security measures on the server.

In a way though, Bot 2 is more "advanced" in that, according to that article. ELIZA could only be updated by manually rewriting the code. I'm intrigued by the possible potential of a program that can be updated or "learn" from people connecting to it and modifying it from all over the world simultaneously. My biggest wory was that with a potential for thousands of people to be able to "teach" Bot, simultaneously, the hash would grow extremely large very quickly. As it is, that did not happen. A million people could say "Hello Bot", and he says hello. They say "how are you" he says fine. The hash is not modified. People's Repertoire of greetings and casual conversation are surprisingly (to me anyway) limited. The problem has been more, trying to get people to converse long enough to find something not already in the hash.

If people could add alternate responses, that might be more interesting. -- Tom
  • Comment on Re^2: Artificial Intelligence experiment

Replies are listed 'Best First'.
Re^3: Artificial Intelligence experiment
by PerlGuy(Tom) (Acolyte) on Mar 05, 2020 at 10:47 UTC

    I was leafing through Lincoln Stein's "Network Programming with Perl" (2001 edition), and found something not mentioned in the Wikipedia article about ELIZA.

    There is a Perl clone: Yay! Something new to play with!


    PS: (command line - wondering if anyone has created a web interface already. Probably. If not, anyone care to take a stab at it?)

      "If not, anyone care to take a stab at it?"

      Sounds like your are volunteering to fulfill your own request of a web interface for this piece of computer history ;)

        I might, but no sense reinventing the wheel.

        The author, John Nolan, has already provided a web interface with the download from

        #!/usr/bin/perl # This simple script implements a Chatbot::Eliza # object in a cgi program. It uses the module # written by Lincoln Stein. # # Needless to say, you must have the module # installed and working properly with CGI scripts on # your Web server before you can try to run this script. # is not included with # # Information about is here: # use CGI; use Chatbot::Eliza; my $cgi = new CGI; my $chatbot = new Chatbot::Eliza; srand( time ^ ($$ + ($$ << 15)) ); # seed the random number generator print $cgi->header; print $cgi->start_html; print $cgi->start_multipart_form; print $cgi->h2('Eliza session'); # These lines contain the "Eliza" functionality. # User comments are passed through the module's transform # method, and the output is used to prompt the user # for futher input. # if ( $cgi->param() ) { $prompt = $chatbot->transform( $cgi->param('Comment') ); } else { $prompt = $chatbot->transform('Hello'); } $cgi->param('Comment',''); print $cgi->h3($prompt), $cgi->br, $cgi->textarea( -name => 'Comment', -wrap => 'yes', -rows => 3, -columns => 70 ); print $cgi->p, $cgi->submit('Action','Send to Eliza'), $cgi->reset('Reset'); print $cgi->endform; print $cgi->end_html;

        I could just put it up on the web as-is, but I very much doubt the Eliza module is installed on my bargain basement hosting service, or that they would be willing to install it for me.

        It might be fun to write a web version that doesn't depend on (or Chatbot::Eliza for that matter) Probably quite doable. The code is well documented and doesn't appear to be too complicated.

        I'd probably take a different approach to the whole thing though, like drop the "therapy" angle and have it just be more conversational. Code-wise, I'd also drop the object-orientedness.


        I did originally write: "PS: (command line - wondering if anyone has created a web interface already. Probably. If not, I might take a stab at it?)

        But then I didn't want anyone to feel left out. So changed "I" to "Anyone".

        I mostly write programs (or try anyway) for one of two reasons. Either because it seems like fun or it is something required to save humanity from self destruction

        In the late 80's and early 90's I was involved in the development of the World Wide Web because I believed it would reduce paper consumption and, in time, slow, or even reverse the rapid destruction of old growth forests being clear-cut all over the world, at the time, largely, just to supply Newsprint.

        Any programs I've ever written have been General Public License, which is also why I write programs in Perl.

        In this case I don't think an AI Bot is going to save the world, so this would be just for fun.


          A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11112341]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2020-11-26 07:34 GMT
Find Nodes?
    Voting Booth?

    No recent polls found