--- ./src/Process.pl 2001-01-02 07:22:15.000000000 -0700 +++ /home/regurg/common-infobot/src/Process.pl 2002-12-28 06:31:57.000000000 -0700 @@ -416,16 +423,15 @@ } if ($addressed and not $caughtBy) { -# &status("unparseable: $message"); + &status("unparseable: $message"); - if ($msgType =~ /public/) { - &say("$who: ".$confused[int(rand(@confused))]) if $addressed; + if ($msgType =~ /public/) { + &say( &confusedEliza( $message ) ) if $addressed; } else { - &msg($who, $confused[int(rand(@confused))]); + &msg($who, &confusedEliza()); } return "NOPARSE"; } } 1; - --- ./src/Question.pl 2001-01-02 07:22:15.000000000 -0700 +++ /home/regurg/common-infobot/src/Question.pl 2005-03-12 19:12:30.000000000 -0700 @@ -8,6 +8,7 @@ ## sub doQuestion { + local ($msgType, $qmsg, $msgFilter) = @_; chomp $qmsg; @@ -24,6 +25,9 @@ my ($origIn) = $qmsg; $finalQMark += $qmsg =~ s/\?\s*$//; + # Save a copy before it gets messed up + my $elizaMsg = $qmsg; + # convert to canonical reference form $qmsg = &normquery($qmsg); $qmsg = &switchPerson($qmsg); @@ -51,7 +55,7 @@ # ok, here's where we try to actually get it $answer = &getReply($msgType, $qmsg, $msgFilter); - + return 'NOREPLY' if ($answer eq 'NOREPLY'); if (($param{'addressing'} eq 'REQUIRE') && not ($addressed or $continuity)) { @@ -63,32 +67,36 @@ } if ($questionWord ne "" or $finalQMark) { + # if it has not been explicitly marked as a question if ($addressed && (not defined $answer)) { + # and we're addressed and so far the result is null &status("notfound: <$who> $origIn :: $qmsg"); return 'NOREPLY' if $infobots{$nuh}; my $reply; - # generate some random i-don't-know reply. - if ($target ne $who and $target ne $talkchannel) { - $target = $who; # set the target back to the originator - $reply = "I don't know about '$qmsg'"; - } else { - $reply = $dunno[int(rand(@dunno))]; - } +# &status( "random dunno" ); - if (rand() > 0.5) { - $reply = "$locWho: $reply"; - } else { - $reply = "$reply, $locWho"; - } +# # generate some random i-don't-know reply. +# if ($target ne $who and $target ne $talkchannel) { +# $target = $who; # set the target back to the originator +# $reply = "I don't know about '$qmsg'"; +# } else { +# $reply = $dunno[int(rand(@dunno))]; +# } + +# if (rand() > 0.5) { +# $reply = "$locWho: $reply"; +# } else { +# $reply = "$reply, $locWho"; +# } &askFriendlyBots($qmsg); - # and set the result - $answer = $reply; + $answer = confusedEliza( $elizaMsg ); + } else { # the item was found if ($answer ne "") { --- ./extras/Eliza.pl 2007-01-11 21:04:21.000000000 -0700 +++ ./extras/Eliza.pl 2007-01-11 20:53:47.000000000 -0700 @@ -0,0 +1,18 @@ +BEGIN { + + use Chatbot::Eliza; + + $myEliza = new Chatbot::Eliza; + $myEliza->name( "barney" ); +} + +sub confusedEliza { + + my $elizaInput = $_[0]; + + &status( "Sending to Eliza -> $elizaInput" ); + return( $myEliza->transform( $elizaInput ) ); + +} + +1;