Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Artificial Intelligence experiment

by PerlGuy(Tom) (Acolyte)
on Mar 05, 2020 at 10:47 UTC ( #11113837=note: print w/replies, xml ) Need Help??


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

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: https://metacpan.org/pod/Chatbot::Eliza Yay! Something new to play with!

Tom

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

  • Comment on Re^3: Artificial Intelligence experiment

Replies are listed 'Best First'.
Re^4: Artificial Intelligence experiment
by marto (Archbishop) on Mar 05, 2020 at 10:51 UTC

    "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 metacpan.org:

      #!/usr/bin/perl # This simple script implements a Chatbot::Eliza # object in a cgi program. It uses the CGI.pm module # written by Lincoln Stein. # # Needless to say, you must have the CGI.pm module # installed and working properly with CGI scripts on # your Web server before you can try to run this script. # CGI.pm is not included with Eliza.pm. # # Information about CGI.pm is here: # http://www.genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html 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 CGI.pm. (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.

      Tom

        "I might, but no sense reinventing the wheel."

        After asking if anyone else would write one for you...

      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.

      Tom

        "I did originally write..."

        The node XML history does not reflect this, nor have you marked your post as being edited. Regardless of what your personal motivations are it's better to do basic research first (what you asked others to do was already part of the distribution you linked to) or make some effort yourself before soliciting others to work on your 'fun' nostalgia trip.

        A reply falls below the community's threshold of quality. You may see it by logging in.
        "... In the late 80's and early 90's I was involved in the development of the World Wide Web..."

        Yes, sure. And I was in the Foreign Legion in 1954 when we lost the Battle of Dien Bien Phu. And as a matter of fact I’m the one and only son of the Führer. See also. Regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-07-13 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?