Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^5: Artificial Intelligence experiment

by PerlGuy(Tom) (Acolyte)
on Mar 05, 2020 at 12:59 UTC ( [id://11113846]=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re^6: Artificial Intelligence experiment
by marto (Cardinal) on Mar 05, 2020 at 13:03 UTC

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

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

      PerlGuy(Tom)'s bio: "... I could never get any real programmers to write the programs I thought were needed. I would not accept that what I wanted was really "impossible". Often they didn't really seem to comprehend what I was trying to say, or didn't listen long enough to really get it. ... I still feel frustrated that they just, either didn't quite understand, or just couldn't quite get it right. ..."

        PerlGuy(Tom)'s bio: "... I could never get any real programmers to write the programs I thought were needed. I would not accept that what I wanted was really "impossible". Often they didn't really seem to comprehend what I was trying to say, or didn't listen long enough to really get it. ... I still feel frustrated that they just, either didn't quite understand, or just couldn't quite get it right. ..."

        A case in point. I was an early advocate of the "semantic web" utilizing "xml", which was originally an HTML element which I envisioned would implement a whole new, incredible social era. the possibilities it would open up were amazing and mind blowing and powerful. It would completely transform the Web and change the way people used it.

        What happened was, the "browser wars" made implementing XML as an HTML element impossible. There was no consistency. It appeared nobody understood what this new HTML tag was for or how to implement it. Do we show the XML content? Make it invisible? Some browsers displayed it and some made it invisible, which made designing a web-page utilizing "xml data islands" impossible. XML as an HTML element never got off the ground and was eventually deprecated. Instead, XML, or the general idea, morphed into a kind of programming language. Still useful, but rather far from the original vision.

        Tom

      Re^6: Artificial Intelligence experiment Re^6: Artificial Intelligence experiment by marto on Mar 05, 2020 at 13:03 UTC

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

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

      After downloading and unzipping the actual files, it was then that I found there was a web-interface already included.

      Tom

        Point being, do some basic research before asking others to do work on something you want, yet seem unprepared to do yourself.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 03:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found