@@ -0,0 +1,93 @@
+Revision history for Perl module Chatbot::Eliza
+
+1.05 2014-04-17
+ - Moved Chatbot/Eliza.pm to lib/Chatbot/Eliza.pm
+ - Added this Changes file; moved changelog entries from pod to here.
+ - Moved all example scripts into examples/ directory
+ - Added a minimal test that actually exercises Eliza with a script
+ - Added "use warnings" and dropped use vars in favour of 'our'
+ - Added COPYRIGHT AND LICENSE section to pod
+ - Switched to Dist::Zilla
+
+1.04_01 2014-04-05
+ - All the changes in 1.05 (above) were first done
+ for this developer release.
+
+1.04 2003-01-24
+ - Added a Norwegian script, kindly contributed by Mats Stafseng Einarsen.
+ Thanks Mats!
+
+1.01 2003-01-17
+ - Added an empty DESTORY method, to eliminate some pesky warning messages.
+ Suggested by Stas Bekman.
+
+0.97 1999-10-31
+ - One tiny change to the regex which implements reassemble rules.
+ Thanks to Gidon Wise for suggesting this improvement.
+
+0.95 1999-07-09
+ - Fixed a bug in the way the bot invokes its random function
+ when it pulls a comment out of memory.
+
+0.93 1999-06-04
+ - Calling programs can now specify their own random-number generators.
+ Use this syntax:
+ $chatbot = new Chatbot::Eliza;
+ $chatbot->myrand( sub { #function goes here! } );
+ The custom random function should have the same prototype
+ as perl's built-in rand() function. That is, it should take
+ a single (numeric) expression as a parameter, and it should
+ return a floating-point value between 0 and that number.
+ - You can also now use a reference to an anonymous hash
+ as a parameter to the new() method to define any fields
+ in that bot instance:
+ $bot = new Chatbot::Eliza {
+ name => "Brian",
+ scriptfile => "myscript.txt",
+ debug => 1,
+ };
+
+0.91 1999-04-08
+ - Fixed some misspellings.
+ - Fixed a bug in the way individual bot objects store their memory.
+ Thanks to Randal Schwartz and to Robert Chin for pointing this out.
+ - Fixed a very stupid error in the way the random function is invoked.
+ Thanks to Antony Quintal for pointing out the error.
+ - Many corrections and improvements were made to the German script
+ by Matthias Hellmund. Thanks, Matthias!
+ - Made a minor syntactical change, at the suggestion of Roy Stephan.
+ - The memory functionality can now be disabled by setting the
+ $Chatbot::Eliza::memory_on variable to 0, like so:
+ $bot->memory_on(0);
+ Thanks to Robert Chin for suggesting that.
+
+0.40 1998-07-25
+ - Re-implemented the memory functionality.
+ - Cleaned up and expanded the embedded POD documentation.
+ - Added a sample script in German.
+ - Modified the debugging behavior. The transform() method itself
+ will no longer print any debugging output directly to STDOUT.
+ Instead, all debugging output is stored in a module variable
+ called "debug_text". The "debug_text" variable is printed out
+ by the command_interface() method, if the debug flag is set.
+ But even if this flag is not set, the variable debug_text
+ is still available to any calling program.
+ - Added a few more example scripts which use the module.
+ simple - simple script using Eliza.pm
+ simple.cgi - simple CGI script using Eliza.pm
+ debug.cgi - CGI script which displays debugging output
+ deutsch - script using the German script
+ deutsch.cgi - CGI script using the German script
+ twobots - script which creates two distinct bots
+
+0.32 1997-12-13
+ - Fixed a bug in the way Eliza loads its default internal script data.
+ (Thanks to Randal Schwartz for pointing this out.)
+ - Removed the "memory" functions internal to Eliza.
+ When I get them working properly I will add them back in.
+ - Added one more example program.
+ - Fixed some minor errors in the embedded POD documentation.
+
+0.31 1997-12-06
+ - First release to CPAN
+
@@ -1,1763 +0,0 @@
-###################################################################
-
-package Chatbot::Eliza;
-
-# Copyright (c) 1997-2003 John Nolan. All rights reserved.
-# This program is free software. You may modify and/or
-# distribute it under the same terms as Perl itself.
-# This copyright notice must remain attached to the file.
-#
-# You can run this file through either pod2man or pod2html
-# to produce pretty documentation in manual or html file format
-# (these utilities are part of the Perl 5 distribution).
-#
-# POD documentation is distributed throughout the actual code
-# so that it also functions as comments.
-
-require 5.003;
-use strict;
-use Carp;
-
-use vars qw($VERSION @ISA $AUTOLOAD);
-
-$VERSION = '1.04';
-sub Version { $VERSION; }
-
-
-####################################################################
-# ---{ B E G I N P O D D O C U M E N T A T I O N }--------------
-#
-
-=head1 NAME
-
-B<Chatbot::Eliza> - A clone of the classic Eliza program
-
-=head1 SYNOPSIS
-
- use Chatbot::Eliza;
-
- $mybot = new Chatbot::Eliza;
- $mybot->command_interface;
-
- # see below for details
-
-
-=head1 DESCRIPTION
-
-This module implements the classic Eliza algorithm.
-The original Eliza program was written by Joseph
-Weizenbaum and described in the Communications
-of the ACM in 1966. Eliza is a mock Rogerian
-psychotherapist. It prompts for user input,
-and uses a simple transformation algorithm
-to change user input into a follow-up question.
-The program is designed to give the appearance
-of understanding.
-
-This program is a faithful implementation of the program
-described by Weizenbaum. It uses a simplified script
-language (devised by Charles Hayden). The content
-of the script is the same as Weizenbaum's.
-
-This module encapsulates the Eliza algorithm
-in the form of an object. This should make
-the functionality easy to incorporate in larger programs.
-
-
-=head1 INSTALLATION
-
-The current version of Chatbot::Eliza.pm is available on CPAN:
-
- http://www.perl.com/CPAN/modules/by-module/Chatbot/
-
-To install this package, just change to the directory which
-you created by untarring the package, and type the following:
-
- perl Makefile.PL
- make test
- make
- make install
-
-This will copy Eliza.pm to your perl library directory for
-use by all perl scripts. You probably must be root to do this,
-unless you have installed a personal copy of perl.
-
-
-=head1 USAGE
-
-This is all you need to do to launch a simple
-Eliza session:
-
- use Chatbot::Eliza;
-
- $mybot = new Chatbot::Eliza;
- $mybot->command_interface;
-
-You can also customize certain features of the
-session:
-
- $myotherbot = new Chatbot::Eliza;
-
- $myotherbot->name( "Hortense" );
- $myotherbot->debug( 1 );
-
- $myotherbot->command_interface;
-
-These lines set the name of the bot to be
-"Hortense" and turn on the debugging output.
-
-When creating an Eliza object, you can specify
-a name and an alternative scriptfile:
-
- $bot = new Chatbot::Eliza "Brian", "myscript.txt";
-
-You can also use an anonymous hash to set these parameters.
-Any of the fields can be initialized using this syntax:
-
- $bot = new Chatbot::Eliza {
- name => "Brian",
- scriptfile => "myscript.txt",
- debug => 1,
- prompts_on => 1,
- memory_on => 0,
- myrand =>
- sub { my $N = defined $_[0] ? $_[0] : 1; rand($N); },
- };
-
-If you don't specify a script file, then the new object will be
-initialized with a default script. The module contains this
-script within itself.
-
-You can use any of the internal functions in
-a calling program. The code below takes an
-arbitrary string and retrieves the reply from
-the Eliza object:
-
- my $string = "I have too many problems.";
- my $reply = $mybot->transform( $string );
-
-You can easily create two bots, each with a different
-script, and see how they interact:
-
- use Chatbot::Eliza
-
- my ($harry, $sally, $he_says, $she_says);
-
- $sally = new Chatbot::Eliza "Sally", "histext.txt";
- $harry = new Chatbot::Eliza "Harry", "hertext.txt";
-
- $he_says = "I am sad.";
-
- # Seed the random number generator.
- srand( time ^ ($$ + ($$ << 15)) );
-
- while (1) {
- $she_says = $sally->transform( $he_says );
- print $sally->name, ": $she_says \n";
-
- $he_says = $harry->transform( $she_says );
- print $harry->name, ": $he_says \n";
- }
-
-Mechanically, this works well. However, it critically depends
-on the actual script data. Having two mock Rogerian therapists
-talk to each other usually does not produce any sensible conversation,
-of course.
-
-After each call to the transform() method, the debugging output
-for that transformation is stored in a variable called $debug_text.
-
- my $reply = $mybot->transform( "My foot hurts" );
- my $debugging = $mybot->debug_text;
-
-This feature always available, even if the instance's $debug
-variable is set to 0.
-
-Calling programs can specify their own random-number generators.
-Use this syntax:
-
- $chatbot = new Chatbot::Eliza;
- $chatbot->myrand(
- sub {
- #function goes here!
- }
- );
-
-The custom random function should have the same prototype
-as perl's built-in rand() function. That is, it should take
-a single (numeric) expression as a parameter, and it should
-return a floating-point value between 0 and that number.
-
-What this code actually does is pass a reference to an anonymous
-subroutine ("code reference"). Make sure you've read the perlref
-manpage for details on how code references actually work.
-
-If you don't specify any custom rand function, then the Eliza
-object will just use the built-in rand() function.
-
-=head1 MAIN DATA MEMBERS
-
-Each Eliza object uses the following data structures
-to hold the script data in memory:
-
-=head2 %decomplist
-
-I<Hash>: the set of keywords; I<Values>: strings containing
-the decomposition rules.
-
-=head2 %reasmblist
-
-I<Hash>: a set of values which are each the join
-of a keyword and a corresponding decomposition rule;
-I<Values>: the set of possible reassembly statements
-for that keyword and decomposition rule.
-
-=head2 %reasmblist_for_memory
-
-This structure is identical to C<%reasmblist>, except
-that these rules are only invoked when a user comment
-is being retrieved from memory. These contain comments
-such as "Earlier you mentioned that...," which are only
-appropriate for remembered comments. Rules in the script
-must be specially marked in order to be included
-in this list rather than C<%reasmblist>. The default
-script only has a few of these rules.
-
-=head2 @memory
-
-A list of user comments which an Eliza instance is remembering
-for future use. Eliza does not remember everything, only some things.
-In this implementation, Eliza will only remember comments
-which match a decomposition rule which actually has reassembly
-rules that are marked with the keyword "reasm_for_memory"
-rather than the normal "reasmb". The default script
-only has a few of these.
-
-=head2 %keyranks
-
-I<Hash>: the set of keywords; I<Values>: the ranks for each keyword
-
-=head2 @quit
-
-"quit" words -- that is, words the user might use
-to try to exit the program.
-
-=head2 @initial
-
-Possible greetings for the beginning of the program.
-
-=head2 @final
-
-Possible farewells for the end of the program.
-
-=head2 %pre
-
-I<Hash>: words which are replaced before any transformations;
-I<Values>: the respective replacement words.
-
-=head2 %post
-
-I<Hash>: words which are replaced after the transformations
-and after the reply is constructed; I<Values>: the respective
-replacement words.
-
-=head2 %synon
-
-I<Hash>: words which are found in decomposition rules;
-I<Values>: words which are treated just like their
-corresponding synonyms during matching of decomposition
-rules.
-
-=head2 Other data members
-
-There are several other internal data members. Hopefully
-these are sufficiently obvious that you can learn about them
-just by reading the source code.
-
-=cut
-
-
-my %fields = (
- name => 'Eliza',
- scriptfile => '',
-
- debug => 0,
- debug_text => '',
- transform_text => '',
- prompts_on => 1,
- memory_on => 1,
- botprompt => '',
- userprompt => '',
-
- myrand =>
- sub { my $N = defined $_[0] ? $_[0] : 1; rand($N); },
-
- keyranks => undef,
- decomplist => undef,
- reasmblist => undef,
- reasmblist_for_memory => undef,
-
- pre => undef,
- post => undef,
- synon => undef,
- initial => undef,
- final => undef,
- quit => undef,
-
- max_memory_size => 5,
- likelihood_of_using_memory => 1,
- memory => undef,
-);
-
-
-####################################################################
-# ---{ B E G I N M E T H O D S }----------------------------------
-#
-
-=head1 METHODS
-
-=head2 new()
-
- my $chatterbot = new Chatbot::Eliza;
-
-new() creates a new Eliza object. This method
-also calls the internal _initialize() method, which in turn
-calls the parse_script_data() method, which initializes
-the script data.
-
- my $chatterbot = new Chatbot::Eliza 'Ahmad', 'myfile.txt';
-
-The eliza object defaults to the name "Eliza", and it
-contains default script data within itself. However,
-using the syntax above, you can specify an alternative
-name and an alternative script file.
-
-See the method parse_script_data(). for a description
-of the format of the script file.
-
-=cut
-
-sub new {
- my ($that,$name,$scriptfile) = @_;
- my $class = ref($that) || $that;
- my $self = {
- _permitted => \%fields,
- %fields,
- };
- bless $self, $class;
- $self->_initialize($name,$scriptfile);
- return $self;
-} # end method new
-
-sub _initialize {
- my ($self,$param1,$param2) = @_;
-
- if (defined $param1 and ref $param1 eq "HASH") {
-
- # Allow the calling program to pass in intial parameters
- # as an anonymous hash
- map { $self->{$_} = $param1->{$_}; } keys %$param1;
-
- $self->parse_script_data( $self->{scriptfile} );
-
- } else {
- $self->name($param1) if $param1;
- $self->parse_script_data($param2);
- }
-
- # Initialize the memory array ref at instantiation time,
- # rather than at class definition time.
- # (THANKS to Randal Schwartz and Robert Chin for fixing this bug.)
- #
- $self->{memory} = [];
-}
-
-sub AUTOLOAD {
- my $self = shift;
- my $class = ref($self) || croak "$self is not an object : $!\n";
- my $field = $AUTOLOAD;
- $field =~ s/.*://; # Strip fully-qualified portion
-
- unless (exists $self->{"_permitted"}->{$field} ) {
- croak "Can't access `$field' field in object of class $class : $!\n";
- }
-
- if (@_) {
- return $self->{$field} = shift;
- } else {
- return $self->{$field};
- }
-} # end method AUTOLOAD
-
-
-####################################################################
-# --- command_interface ---
-
-=head2 command_interface()
-
- $chatterbot->command_interface;
-
-command_interface() opens an interactive session with
-the Eliza object, just like the original Eliza program.
-
-If you want to design your own session format, then
-you can write your own while loop and your own functions
-for prompting for and reading user input, and use the
-transform() method to generate Eliza's responses.
-(I<Note>: you do not need to invoke preprocess()
-and postprocess() directly, because these are invoked
-from within the transform() method.)
-
-But if you're lazy and you want to skip all that,
-then just use command_interface(). It's all done for you.
-
-During an interactive session invoked using command_interface(),
-you can enter the word "debug" to toggle debug mode on and off.
-You can also enter the keyword "memory" to invoke the _debug_memory()
-method and print out the contents of the Eliza instance's memory.
-
-=cut
-
-sub command_interface {
- my $self = shift;
- my ($user_input, $previous_user_input, $reply);
-
- $user_input = "";
-
- $self->botprompt($self->name . ":\t"); # Eliza's prompt
- $self->userprompt("you:\t"); # User's prompt
-
- # Seed the random number generator.
- srand( time() ^ ($$ + ($$ << 15)) );
-
- # Print the Eliza prompt
- print $self->botprompt if $self->prompts_on;
-
- # Print an initial greeting
- print "$self->{initial}->[ int &{$self->{myrand}}( scalar @{ $self->{initial} } ) ]\n";
-
-
- ###################################################################
- # command loop. This loop should go on forever,
- # until we explicity break out of it.
- #
- while (1) {
-
- print $self->userprompt if $self->prompts_on;
-
- $previous_user_input = $user_input;
- chomp( $user_input = <STDIN> );
-
-
- # If the user wants to quit,
- # print out a farewell and quit.
- if ($self->_testquit($user_input) ) {
- $reply = "$self->{final}->[ int &{$self->{myrand}}( scalar @{$self->{final}} ) ]";
- print $self->botprompt if $self->prompts_on;
- print "$reply\n";
- last;
- }
-
- # If the user enters the word "debug",
- # then toggle on/off this Eliza's debug output.
- if ($user_input eq "debug") {
- $self->debug( ! $self->debug );
- $user_input = $previous_user_input;
- }
-
- # If the user enters the word "memory",
- # then use the _debug_memory method to dump out
- # the current contents of Eliza's memory
- if ($user_input eq "memory" or $user_input eq "debug memory") {
- print $self->_debug_memory();
- redo;
- }
-
- # If the user enters the word "debug that",
- # then dump out the debugging of the
- # most recent call to transform.
- if ($user_input eq "debug that") {
- print $self->debug_text();
- redo;
- }
-
- # Invoke the transform method
- # to generate a reply.
- $reply = $self->transform( $user_input );
-
-
- # Print out the debugging text if debugging is set to on.
- # This variable should have been set by the transform method.
- print $self->debug_text if $self->debug;
-
- # Print the actual reply
- print $self->botprompt if $self->prompts_on;
- print "$reply\n";
-
- } # End UI command loop.
-
-
-} # End method command_interface
-
-
-####################################################################
-# --- preprocess ---
-
-=head2 preprocess()
-
- $string = preprocess($string);
-
-preprocess() applies simple substitution rules to the input string.
-Mostly this is to catch varieties in spelling, misspellings,
-contractions and the like.
-
-preprocess() is called from within the transform() method.
-It is applied to user-input text, BEFORE any processing,
-and before a reassebly statement has been selected.
-
-It uses the array C<%pre>, which is created
-during the parse of the script.
-
-=cut
-
-sub preprocess {
- my ($self,$string) = @_;
-
- my ($i, @wordsout, @wordsin, $keyword);
-
- @wordsout = @wordsin = split / /, $string;
-
- WORD: for ($i = 0; $i < @wordsin; $i++) {
- foreach $keyword (keys %{ $self->{pre} }) {
- if ($wordsin[$i] =~ /\b$keyword\b/i ) {
- ($wordsout[$i] = $wordsin[$i]) =~ s/$keyword/$self->{pre}->{$keyword}/ig;
- next WORD;
- }
- }
- }
- return join ' ', @wordsout;
-}
-
-
-####################################################################
-# --- postprocess ---
-
-=head2 postprocess()
-
- $string = postprocess($string);
-
-postprocess() applies simple substitution rules to the
-reassembly rule. This is where all the "I"'s and "you"'s
-are exchanged. postprocess() is called from within the
-transform() function.
-
-It uses the array C<%post>, created
-during the parse of the script.
-
-=cut
-
-sub postprocess {
- my ($self,$string) = @_;
-
- my ($i, @wordsout, @wordsin, $keyword);
-
- @wordsin = @wordsout = split (/ /, $string);
-
- WORD: for ($i = 0; $i < @wordsin; $i++) {
- foreach $keyword (keys %{ $self->{post} }) {
- if ($wordsin[$i] =~ /\b$keyword\b/i ) {
- ($wordsout[$i] = $wordsin[$i]) =~ s/$keyword/$self->{post}->{$keyword}/ig;
- next WORD;
- }
- }
- }
- return join ' ', @wordsout;
-}
-
-####################################################################
-# --- _testquit ---
-
-=head2 _testquit()
-
- if ($self->_testquit($user_input) ) { ... }
-
-_testquit() detects words like "bye" and "quit" and returns
-true if it finds one of them as the first word in the sentence.
-
-These words are listed in the script, under the keyword "quit".
-
-=cut
-
-sub _testquit {
- my ($self,$string) = @_;
-
- my ($quitword, @wordsin);
-
- foreach $quitword (@{ $self->{quit} }) {
- return 1 if ($string =~ /\b$quitword\b/i ) ;
- }
-}
-
-
-####################################################################
-# --- _debug_memory ---
-
-=head2 _debug_memory()
-
- $self->_debug_memory()
-
-_debug_memory() is a special function which returns
-the contents of Eliza's memory stack.
-
-
-=cut
-
-sub _debug_memory {
-
- my ($self) = @_;
-
- my $string = "\t";
- $string .= $#{ $self->memory } + 1;
- $string .= " item(s) in memory stack:\n";
-
- # [THANKS to Roy Stephan for helping me adjust this bit]
- #
- foreach (@{ $self->memory } ) {
-
- my $line = $_;
- $string .= sprintf "\t\t->$line\n" ;
- };
-
- return $string;
-}
-
-####################################################################
-# --- transform ---
-
-=head2 transform()
-
- $reply = $chatterbot->transform( $string, $use_memory );
-
-transform() applies transformation rules to the user input
-string. It invokes preprocess(), does transformations,
-then invokes postprocess(). It returns the tranformed
-output string, called C<$reasmb>.
-
-The algorithm embedded in the transform() method has three main parts:
-
-=over
-
-=item 1
-
-Search the input string for a keyword.
-
-=item 2
-
-If we find a keyword, use the list of decomposition rules
-for that keyword, and pattern-match the input string against
-each rule.
-
-=item 3
-
-If the input string matches any of the decomposition rules,
-then randomly select one of the reassembly rules for that
-decomposition rule, and use it to construct the reply.
-
-=back
-
-transform() takes two parameters. The first is the string we want
-to transform. The second is a flag which indicates where this sting
-came from. If the flag is set, then the string has been pulled
-from memory, and we should use reassembly rules appropriate
-for that. If the flag is not set, then the string is the most
-recent user input, and we can use the ordinary reassembly rules.
-
-The memory flag is only set when the transform() function is called
-recursively. The mechanism for setting this parameter is
-embedded in the transoform method itself. If the flag is set
-inappropriately, it is ignored.
-
-=cut
-
-sub transform{
- my ($self,$string,$use_memory) = @_;
-
- # Initialize the debugging text buffer.
- $self->debug_text('');
-
- $self->debug_text(sprintf "\t[Pulling string \"$string\" from memory.]\n")
- if $use_memory;
-
- my ($i, @string_parts, $string_part, $rank, $goto, $reasmb, $keyword,
- $decomp, $this_decomp, $reasmbkey, @these_reasmbs,
- @decomp_matches, $synonyms, $synonym_index);
-
- # Default to a really low rank.
- $rank = -2;
- $reasmb = "";
- $goto = "";
-
- # First run the string through the preprocessor.
- $string = $self->preprocess( $string );
-
- # Convert punctuation to periods. We will assume that commas
- # and certain conjunctions separate distinct thoughts/sentences.
- $string =~ s/[?!,]/./g;
- $string =~ s/but/./g; # Yikes! This is English-specific.
-
- # Split the string by periods into an array
- @string_parts = split /\./, $string ;
-
- # Examine each part of the input string in turn.
- STRING_PARTS: foreach $string_part (@string_parts) {
-
- # Run through the whole list of keywords.
- KEYWORD: foreach $keyword (keys %{ $self->{decomplist} }) {
-
- # Check to see if the input string contains a keyword
- # which outranks any we have found previously
- # (On first loop, rank is set to -2.)
- if ( ($string_part =~ /\b$keyword\b/i or $keyword eq $goto)
- and
- $rank < $self->{keyranks}->{$keyword}
- )
- {
- # If we find one, then set $rank to equal
- # the rank of that keyword.
- $rank = $self->{keyranks}->{$keyword};
-
- $self->debug_text($self->debug_text . sprintf "\t$rank> $keyword");
-
- # Now let's check all the decomposition rules for that keyword.
- DECOMP: foreach $decomp (@{ $self->{decomplist}->{$keyword} }) {
-
- # Change '*' to '\b(.*)\b' in this decomposition rule,
- # so we can use it for regular expressions. Later,
- # we will want to isolate individual matches to each wildcard.
- ($this_decomp = $decomp) =~ s/\s*\*\s*/\\b\(\.\*\)\\b/g;
-
- # If this docomposition rule contains a word which begins with '@',
- # then the script also contained some synonyms for that word.
- # Find them all using %synon and generate a regular expression
- # containing all of them.
- if ($this_decomp =~ /\@/ ) {
- ($synonym_index = $this_decomp) =~ s/.*\@(\w*).*/$1/i ;
- $synonyms = join ('|', @{ $self->{synon}->{$synonym_index} });
- $this_decomp =~ s/(.*)\@$synonym_index(.*)/$1($synonym_index\|$synonyms)$2/g;
- }
-
- $self->debug_text($self->debug_text . sprintf "\n\t\t: $decomp");
-
- # Using the regular expression we just generated,
- # match against the input string. Use empty "()"'s to
- # eliminate warnings about uninitialized variables.
- if ($string_part =~ /$this_decomp()()()()()()()()()()/i) {
-
- # If this decomp rule matched the string,
- # then create an array, so that we can refer to matches
- # to individual wildcards. Use '0' as a placeholder
- # (we don't want to refer to any "zeroth" wildcard).
- @decomp_matches = ("0", $1, $2, $3, $4, $5, $6, $7, $8, $9);
- $self->debug_text($self->debug_text . sprintf " : @decomp_matches\n");
-
- # Using the keyword and the decomposition rule,
- # reconstruct a key for the list of reassamble rules.
- $reasmbkey = join ($;,$keyword,$decomp);
-
- # Get the list of possible reassembly rules for this key.
- #
- if (defined $use_memory and $#{ $self->{reasmblist_for_memory}->{$reasmbkey} } >= 0) {
-
- # If this transform function was invoked with the memory flag,
- # and there are in fact reassembly rules which are appropriate
- # for pulling out of memory, then include them.
- @these_reasmbs = @{ $self->{reasmblist_for_memory}->{$reasmbkey} }
-
- } else {
-
- # Otherwise, just use the plain reassembly rules.
- # (This is what normally happens.)
- @these_reasmbs = @{ $self->{reasmblist}->{$reasmbkey} }
- }
-
- # Pick out a reassembly rule at random.
- $reasmb = $these_reasmbs[ int &{$self->{myrand}}( scalar @these_reasmbs ) ];
-
- $self->debug_text($self->debug_text . sprintf "\t\t--> $reasmb\n");
-
- # If the reassembly rule we picked contains the word "goto",
- # then we start over with a new keyword. Set $keyword to equal
- # that word, and start the whole loop over.
- if ($reasmb =~ m/^goto\s(\w*).*/i) {
- $self->debug_text($self->debug_text . sprintf "\$1 = $1\n");
- $goto = $keyword = $1;
- $rank = -2;
- redo KEYWORD;
- }
-
- # Otherwise, using the matches to wildcards which we stored above,
- # insert words from the input string back into the reassembly rule.
- # [THANKS to Gidon Wise for submitting a bugfix here]
- for ($i=1; $i <= $#decomp_matches; $i++) {
- $decomp_matches[$i] = $self->postprocess( $decomp_matches[$i] );
- $decomp_matches[$i] =~ s/([,;?!]|\.*)$//;
- $reasmb =~ s/\($i\)/$decomp_matches[$i]/g;
- }
-
- # Move on to the next keyword. If no other keywords match,
- # then we'll end up actually using the $reasmb string
- # we just generated above.
- next KEYWORD ;
-
- } # End if ($string_part =~ /$this_decomp/i)
-
- $self->debug_text($self->debug_text . sprintf "\n");
-
- } # End DECOMP: foreach $decomp (@{ $self->{decomplist}->{$keyword} })
-
- } # End if ( ($string_part =~ /\b$keyword\b/i or $keyword eq $goto)
-
- } # End KEYWORD: foreach $keyword (keys %{ $self->{decomplist})
-
- } # End STRING_PARTS: foreach $string_part (@string_parts) {
-
-=head2 How memory is used
-
-In the script, some reassembly rules are special. They are marked with
-the keyword "reasm_for_memory", rather than just "reasm".
-Eliza "remembers" any comment when it matches a docomposition rule
-for which there are any reassembly rules for memory.
-An Eliza object remembers up to C<$max_memory_size> (default: 5)
-user input strings.
-
-If, during a subsequent run, the transform() method fails to find any
-appropriate decomposition rule for a user's comment, and if there are
-any comments inside the memory array, then Eliza may elect to ignore
-the most recent comment and instead pull out one of the strings from memory.
-In this case, the transform method is called recursively with the memory flag.
-
-Honestly, I am not sure exactly how this memory functionality
-was implemented in the original Eliza program. Hopefully
-this implementation is not too far from Weizenbaum's.
-
-If you don't want to use the memory functionality at all,
-then you can disable it:
-
- $mybot->memory_on(0);
-
-You can also achieve the same effect by making sure
-that the script data does not contain any reassembly rules
-marked with the keyword "reasm_for_memory". The default
-script data only has 4 such items.
-
-=cut
-
- if ($reasmb eq "") {
-
- # If all else fails, call this method recursively
- # and make sure that it has something to parse.
- # Use a string from memory if anything is available.
- #
- # $self-likelihood_of_using_memory should be some number
- # between 1 and 0; it defaults to 1.
- #
- if (
- $#{ $self->memory } >= 0
- and
- &{$self->{myrand}}(1) >= 1 - $self->likelihood_of_using_memory
- ) {
-
- $reasmb = $self->transform( shift @{ $self->memory }, "use memory" );
-
- } else {
- $reasmb = $self->transform("xnone");
- }
-
- } elsif ($self->memory_on) {
-
- # If memory is switched on, then we handle memory.
-
- # Now that we have successfully transformed this string,
- # push it onto the end of the memory stack... unless, of course,
- # that's where we got it from in the first place, or if the rank
- # is not the kind we remember.
- #
- if (
- $#{ $self->{reasmblist_for_memory}->{$reasmbkey} } >= 0
- and
- not defined $use_memory
- ) {
-
- push @{ $self->memory },$string ;
- }
-
- # Shift out the least-recent item from the bottom
- # of the memory stack if the stack exceeds the max size.
- shift @{ $self->memory } if $#{ $self->memory } >= $self->max_memory_size;
-
- $self->debug_text($self->debug_text
- . sprintf("\t%d item(s) in memory.\n", $#{ $self->memory } + 1 ) ) ;
-
- } # End if ($reasmb eq "")
-
- $reasmb =~ tr/ / /s; # Eliminate any duplicate space characters.
- $reasmb =~ s/[ ][?]$/?/; # Eliminate any spaces before the question mark.
-
- # Save the return string so that forgetful calling programs
- # can ask the bot what the last reply was.
- $self->transform_text($reasmb);
-
- return $reasmb ;
-}
-
-
-####################################################################
-# --- parse_script_data ---
-
-=head2 parse_script_data()
-
- $self->parse_script_data;
- $self->parse_script_data( $script_file );
-
-parse_script_data() is invoked from the _initialize() method,
-which is called from the new() function. However, you can also
-call this method at any time against an already-instantiated
-Eliza instance. In that case, the new script data is I<added>
-to the old script data. The old script data is not deleted.
-
-You can pass a parameter to this function, which is the name of the
-script file, and it will read in and parse that file.
-If you do not pass any parameter to this method, then
-it will read the data embedded at the end of the module as its
-default script data.
-
-If you pass the name of a script file to parse_script_data(),
-and that file is not available for reading, then the module dies.
-
-
-=head1 Format of the script file
-
-This module includes a default script file within itself,
-so it is not necessary to explicitly specify a script file
-when instantiating an Eliza object.
-
-Each line in the script file can specify a key,
-a decomposition rule, or a reassembly rule.
-
- key: remember 5
- decomp: * i remember *
- reasmb: Do you often think of (2) ?
- reasmb: Does thinking of (2) bring anything else to mind ?
- decomp: * do you remember *
- reasmb: Did you think I would forget (2) ?
- reasmb: What about (2) ?
- reasmb: goto what
- pre: equivalent alike
- synon: belief feel think believe wish
-
-The number after the key specifies the rank.
-If a user's input contains the keyword, then
-the transform() function will try to match
-one of the decomposition rules for that keyword.
-If one matches, then it will select one of
-the reassembly rules at random. The number
-(2) here means "use whatever set of words
-matched the second asterisk in the decomposition
-rule."
-
-If you specify a list of synonyms for a word,
-the you should use a "@" when you use that
-word in a decomposition rule:
-
- decomp: * i @belief i *
- reasmb: Do you really think so ?
- reasmb: But you are not sure you (3).
-
-Otherwise, the script will never check to see
-if there are any synonyms for that keyword.
-
-Reassembly rules should be marked with I<reasm_for_memory>
-rather than I<reasmb> when it is appropriate for use
-when a user's comment has been extracted from memory.
-
- key: my 2
- decomp: * my *
- reasm_for_memory: Let's discuss further why your (2).
- reasm_for_memory: Earlier you said your (2).
- reasm_for_memory: But your (2).
- reasm_for_memory: Does that have anything to do with the fact that your (2) ?
-
-=head1 How the script file is parsed
-
-Each line in the script file contains an "entrytype"
-(key, decomp, synon) and an "entry", separated by
-a colon. In turn, each "entry" can itself be
-composed of a "key" and a "value", separated by
-a space. The parse_script_data() function
-parses each line out, and splits the "entry" and
-"entrytype" portion of each line into two variables,
-C<$entry> and C<$entrytype>.
-
-Next, it uses the string C<$entrytype> to determine
-what sort of stuff to expect in the C<$entry> variable,
-if anything, and parses it accordingly. In some cases,
-there is no second level of key-value pair, so the function
-does not even bother to isolate or create C<$key> and C<$value>.
-
-C<$key> is always a single word. C<$value> can be null,
-or one single word, or a string composed of several words,
-or an array of words.
-
-Based on all these entries and keys and values,
-the function creates two giant hashes:
-C<%decomplist>, which holds the decomposition rules for
-each keyword, and C<%reasmblist>, which holds the
-reassembly phrases for each decomposition rule.
-It also creates C<%keyranks>, which holds the ranks for
-each key.
-
-Six other arrays are created: C<%reasm_for_memory, %pre, %post,
-%synon, @initial,> and C<@final>.
-
-=cut
-
-sub parse_script_data {
-
- my ($self,$scriptfile) = @_;
- my @scriptlines;
-
- if ($scriptfile) {
-
- # If we have an external script file, open it
- # and read it in (the whole thing, all at once).
- open (SCRIPTFILE, "<$scriptfile")
- or die "Could not read from file $scriptfile : $!\n";
- @scriptlines = <SCRIPTFILE>; # read in script data
- $self->scriptfile($scriptfile);
- close (SCRIPTFILE);
-
- } else {
-
- # Otherwise, read in the data from the bottom
- # of this file. This data might be read several
- # times, so we save the offset pointer and
- # reset it when we're done.
- my $where= tell(DATA);
- @scriptlines = <DATA>; # read in script data
- seek(DATA, $where, 0);
- $self->scriptfile('');
- }
-
- my ($entrytype, $entry, $key, $value) ;
- my $thiskey = "";
- my $thisdecomp = "";
-
- ############################################################
- # Examine each line of script data.
- for (@scriptlines) {
-
- # Skip comments and lines with only whitespace.
- next if (/^\s*#/ || /^\s*$/);
-
- # Split entrytype and entry, using a colon as the delimiter.
- ($entrytype, $entry) = $_ =~ m/^\s*(\S*)\s*:\s*(.*)\s*$/;
-
- # Case loop, based on the entrytype.
- for ($entrytype) {
-
- /quit/ and do { push @{ $self->{quit} }, $entry; last; };
- /initial/ and do { push @{ $self->{initial} }, $entry; last; };
- /final/ and do { push @{ $self->{final} }, $entry; last; };
-
- /decomp/ and do {
- die "$0: error parsing script: decomposition rule with no keyword.\n"
- if $thiskey eq "";
- $thisdecomp = join($;,$thiskey,$entry);
- push @{ $self->{decomplist}->{$thiskey} }, $entry ;
- last;
- };
-
- /reasmb/ and do {
- die "$0: error parsing script: reassembly rule with no decomposition rule.\n"
- if $thisdecomp eq "";
- push @{ $self->{reasmblist}->{$thisdecomp} }, $entry ;
- last;
- };
-
- /reasm_for_memory/ and do {
- die "$0: error parsing script: reassembly rule with no decomposition rule.\n"
- if $thisdecomp eq "";
- push @{ $self->{reasmblist_for_memory}->{$thisdecomp} }, $entry ;
- last;
- };
-
- # The entrytypes below actually expect to see a key and value
- # pair in the entry, so we split them out. The first word,
- # separated by a space, is the key, and everything else is
- # an array of values.
-
- ($key,$value) = $entry =~ m/^\s*(\S*)\s*(.*)/;
-
- /pre/ and do { $self->{pre}->{$key} = $value; last; };
- /post/ and do { $self->{post}->{$key} = $value; last; };
-
- # synon expects an array, so we split $value into an array, using " " as delimiter.
- /synon/ and do { $self->{synon}->{$key} = [ split /\ /, $value ]; last; };
-
- /key/ and do {
- $thiskey = $key;
- $thisdecomp = "";
- $self->{keyranks}->{$thiskey} = $value ;
- last;
- };
-
- } # End for ($entrytype) (case loop)
-
- } # End for (@scriptlines)
-
-} # End of method parse_script_data
-
-
-# Eliminate some pesky warnings.
-#
-sub DESTROY {}
-
-
-# ---{ E N D M E T H O D S }----------------------------------
-####################################################################
-
-1; # Return a true value.
-
-
-=head1 CHANGES
-
-=over 4
-
-=item * Version 1.02-1.04 - January 2003
-
- Added a Norwegian script, kindly contributed by
- Mats Stafseng Einarsen. Thanks Mats!
-
-=item * Version 1.01 - January 2003
-
- Added an empty DESTORY method, to eliminate
- some pesky warning messages. Suggested by
- Stas Bekman.
-
-=item * Version 0.98 - March 2000
-
- Some changes to the documentation.
-
-=item * Versions 0.96-0.97 - October 1999
-
- One tiny change to the regex which implements
- reassemble rules. Thanks to Gidon Wise for
- suggesting this improvement.
-
-=item * Versions 0.94-0.95 - July 1999
-
-
- Fixed a bug in the way the bot invokes its random function
- when it pulls a comment out of memory.
-
-=item * Version 0.93 - June 1999
-
- Calling programs can now specify their own random-number generators.
- Use this syntax:
-
- $chatbot = new Chatbot::Eliza;
- $chatbot->myrand(
- sub {
- #function goes here!
- }
- );
-
- The custom random function should have the same prototype
- as perl's built-in rand() function. That is, it should take
- a single (numeric) expression as a parameter, and it should
- return a floating-point value between 0 and that number.
-
- You can also now use a reference to an anonymous hash
- as a parameter to the new() method to define any fields
- in that bot instance:
-
- $bot = new Chatbot::Eliza {
- name => "Brian",
- scriptfile => "myscript.txt",
- debug => 1,
- };
-
-
-=item * Versions 0.91-0.92 - April 1999
-
- Fixed some misspellings.
-
-
-=item * Version 0.90 - April 1999
-
- Fixed a bug in the way individual bot objects store
- their memory. Thanks to Randal Schwartz and to
- Robert Chin for pointing this out.
-
- Fixed a very stupid error in the way the random
- function is invoked. Thanks to Antony Quintal
- for pointing out the error.
-
- Many corrections and improvements were made
- to the German script by Matthias Hellmund.
- Thanks, Matthias!
-
- Made a minor syntactical change, at the suggestion
- of Roy Stephan.
-
- The memory functionality can now be disabled by setting the
- $Chatbot::Eliza::memory_on variable to 0, like so:
-
- $bot->memory_on(0);
-
- Thanks to Robert Chin for suggesting that.
-
-
-
-=item * Version 0.40 - July 1998
-
- Re-implemented the memory functionality.
-
- Cleaned up and expanded the embedded POD documentation.
-
- Added a sample script in German.
-
- Modified the debugging behavior. The transform() method itself
- will no longer print any debugging output directly to STDOUT.
- Instead, all debugging output is stored in a module variable
- called "debug_text". The "debug_text" variable is printed out
- by the command_interface() method, if the debug flag is set.
- But even if this flag is not set, the variable debug_text
- is still available to any calling program.
-
- Added a few more example scripts which use the module.
-
- simple - simple script using Eliza.pm
- simple.cgi - simple CGI script using Eliza.pm
- debug.cgi - CGI script which displays debugging output
- deutsch - script using the German script
- deutsch.cgi - CGI script using the German script
- twobots - script which creates two distinct bots
-
-=item * Version 0.32 - December 1997
-
- Fixed a bug in the way Eliza loads its default internal script data.
- (Thanks to Randal Schwartz for pointing this out.)
-
- Removed the "memory" functions internal to Eliza.
- When I get them working properly I will add them back in.
-
- Added one more example program.
-
- Fixed some minor errors in the embedded POD documentation.
-
-=item * Version 0.31
-
- The module is now installable, just like any other self-respecting
- CPAN module.
-
-=item * Version 0.30
-
- First release.
-
-=back
-
-
-=head1 AUTHOR
-
-John Nolan jpnolan@sonic.net January 2003.
-
-Implements the classic Eliza algorithm by Prof. Joseph Weizenbaum.
-Script format devised by Charles Hayden.
-
-=cut
-
-
-
-####################################################################
-# ---{ B E G I N D E F A U L T S C R I P T D A T A }----------
-#
-# This script was prepared by Chris Hayden. Hayden's Eliza
-# program was written in Java, however, it attempted to match
-# the functionality of Weizenbaum's original program as closely
-# as possible.
-#
-# Hayden's script format was quite different from Weizenbaum's,
-# but it maintained the same content. I have adapted Hayden's
-# script format, since it was simple and convenient enough
-# for my purposes.
-#
-# I've made small modifications here and there.
-#
-
-# We use the token __DATA__ rather than __END__,
-# so that all this data is visible within the current package.
-
-__DATA__
-initial: How do you do. Please tell me your problem.
-initial: Hello, I am a computer program.
-initial: Please tell me what's been bothering you.
-initial: Is something troubling you?
-final: Goodbye. It was nice talking to you.
-final: Goodbye. I hope you found this session helpful.
-final: I think you should talk to a REAL analyst. Ciao!
-final: Life is tough. Hang in there!
-quit: bye
-quit: goodbye
-quit: done
-quit: exit
-quit: quit
-pre: dont don't
-pre: cant can't
-pre: wont won't
-pre: recollect remember
-pre: recall remember
-pre: dreamt dreamed
-pre: dreams dream
-pre: maybe perhaps
-pre: certainly yes
-pre: machine computer
-pre: machines computer
-pre: computers computer
-post: am are
-post: your my
-post: yours mine
-pre: were was
-post: me you
-pre: you're you are
-pre: i'm i am
-post: myself yourself
-post: yourself myself
-post: i you
-post: you me
-post: my your
-post: me you
-post: i'm you are
-pre: same alike
-pre: identical alike
-pre: equivalent alike
-synon: belief feel think believe wish
-synon: family mother mom father dad sister brother wife children child
-synon: desire want need
-synon: sad unhappy depressed sick
-synon: happy elated glad better
-synon: cannot can't
-synon: everyone everybody nobody noone
-synon: be am is are was
-key: xnone -1
- decomp: *
- reasmb: I'm not sure I understand you fully.
- reasmb: Please go on.
- reasmb: That is interesting. Please continue.
- reasmb: Tell me more about that.
- reasmb: Does talking about this bother you ?
-key: sorry 0
- decomp: *
- reasmb: Please don't apologise.
- reasmb: Apologies are not necessary.
- reasmb: I've told you that apologies are not required.
- reasmb: It did not bother me. Please continue.
-key: apologise 0
- decomp: *
- reasmb: goto sorry
-key: remember 5
- decomp: * i remember *
- reasmb: Do you often think of (2) ?
- reasmb: Does thinking of (2) bring anything else to mind ?
- reasmb: What else do you recollect ?
- reasmb: Why do you remember (2) just now ?
- reasmb: What in the present situation reminds you of (2) ?
- reasmb: What is the connection between me and (2) ?
- reasmb: What else does (2) remind you of ?
- decomp: * do you remember *
- reasmb: Did you think I would forget (2) ?
- reasmb: Why do you think I should recall (2) now ?
- reasmb: What about (2) ?
- reasmb: goto what
- reasmb: You mentioned (2) ?
- decomp: * you remember *
- reasmb: How could I forget (2) ?
- reasmb: What about (2) should I remember ?
- reasmb: goto you
-key: forget 5
- decomp: * i forget *
- reasmb: Can you think of why you might forget (2) ?
- reasmb: Why can't you remember (2) ?
- reasmb: How often do you think of (2) ?
- reasmb: Does it bother you to forget that ?
- reasmb: Could it be a mental block ?
- reasmb: Are you generally forgetful ?
- reasmb: Do you think you are suppressing (2) ?
- decomp: * did you forget *
- reasmb: Why do you ask ?
- reasmb: Are you sure you told me ?
- reasmb: Would it bother you if I forgot (2) ?
- reasmb: Why should I recall (2) just now ?
- reasmb: goto what
- reasmb: Tell me more about (2).
-key: if 3
- decomp: * if *
- reasmb: Do you think its likely that (2) ?
- reasmb: Do you wish that (2) ?
- reasmb: What do you know about (2) ?
- reasmb: Really, if (2) ?
- reasmb: What would you do if (2) ?
- reasmb: But what are the chances that (2) ?
- reasmb: What does this speculation lead to ?
-key: dreamed 4
- decomp: * i dreamed *
- reasmb: Really, (2) ?
- reasmb: Have you ever fantasized (2) while you were awake ?
- reasmb: Have you ever dreamed (2) before ?
- reasmb: goto dream
-key: dream 3
- decomp: *
- reasmb: What does that dream suggest to you ?
- reasmb: Do you dream often ?
- reasmb: What persons appear in your dreams ?
- reasmb: Do you believe that dreams have something to do with your problem ?
-key: perhaps 0
- decomp: *
- reasmb: You don't seem quite certain.
- reasmb: Why the uncertain tone ?
- reasmb: Can't you be more positive ?
- reasmb: You aren't sure ?
- reasmb: Don't you know ?
- reasmb: How likely, would you estimate ?
-key: name 15
- decomp: *
- reasmb: I am not interested in names.
- reasmb: I've told you before, I don't care about names -- please continue.
-key: deutsch 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand German.
-key: francais 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand French.
-key: italiano 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Italian.
-key: espanol 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Spanish.
-key: xfremd 0
- decomp: *
- reasmb: I speak only English.
-key: hello 0
- decomp: *
- reasmb: How do you do. Please state your problem.
- reasmb: Hi. What seems to be your problem ?
-key: computer 50
- decomp: *
- reasmb: Do computers worry you ?
- reasmb: Why do you mention computers ?
- reasmb: What do you think machines have to do with your problem ?
- reasmb: Don't you think computers can help people ?
- reasmb: What about machines worries you ?
- reasmb: What do you think about machines ?
-key: am 0
- decomp: * am i *
- reasmb: Do you believe you are (2) ?
- reasmb: Would you want to be (2) ?
- reasmb: Do you wish I would tell you you are (2) ?
- reasmb: What would it mean if you were (2) ?
- reasmb: goto what
- decomp: * i am *
- reasmb: goto i
- decomp: *
- reasmb: Why do you say 'am' ?
- reasmb: I don't understand that.
-key: are 0
- decomp: * are you *
- reasmb: Why are you interested in whether I am (2) or not ?
- reasmb: Would you prefer if I weren't (2) ?
- reasmb: Perhaps I am (2) in your fantasies.
- reasmb: Do you sometimes think I am (2) ?
- reasmb: goto what
- reasmb: Would it matter to you ?
- reasmb: What if I were (2) ?
- decomp: * you are *
- reasmb: goto you
- decomp: * are *
- reasmb: Did you think they might not be (2) ?
- reasmb: Would you like it if they were not (2) ?
- reasmb: What if they were not (2) ?
- reasmb: Are they always (2) ?
- reasmb: Possibly they are (2).
- reasmb: Are you positive they are (2) ?
-key: your 0
- decomp: * your *
- reasmb: Why are you concerned over my (2) ?
- reasmb: What about your own (2) ?
- reasmb: Are you worried about someone else's (2) ?
- reasmb: Really, my (2) ?
- reasmb: What makes you think of my (2) ?
- reasmb: Do you want my (2) ?
-key: was 2
- decomp: * was i *
- reasmb: What if you were (2) ?
- reasmb: Do you think you were (2) ?
- reasmb: Were you (2) ?
- reasmb: What would it mean if you were (2) ?
- reasmb: What does ' (2) ' suggest to you ?
- reasmb: goto what
- decomp: * i was *
- reasmb: Were you really ?
- reasmb: Why do you tell me you were (2) now ?
- reasmb: Perhaps I already know you were (2).
- decomp: * was you *
- reasmb: Would you like to believe I was (2) ?
- reasmb: What suggests that I was (2) ?
- reasmb: What do you think ?
- reasmb: Perhaps I was (2).
- reasmb: What if I had been (2) ?
-key: i 0
- decomp: * i @desire *
- reasmb: What would it mean to you if you got (3) ?
- reasmb: Why do you want (3) ?
- reasmb: Suppose you got (3) soon.
- reasmb: What if you never got (3) ?
- reasmb: What would getting (3) mean to you ?
- reasmb: What does wanting (3) have to do with this discussion ?
- decomp: * i am* @sad *
- reasmb: I am sorry to hear that you are (3).
- reasmb: Do you think coming here will help you not to be (3) ?
- reasmb: I'm sure it's not pleasant to be (3).
- reasmb: Can you explain what made you (3) ?
- decomp: * i am* @happy *
- reasmb: How have I helped you to be (3) ?
- reasmb: Has your treatment made you (3) ?
- reasmb: What makes you (3) just now ?
- reasmb: Can you explain why you are suddenly (3) ?
- decomp: * i was *
- reasmb: goto was
- decomp: * i @belief i *
- reasmb: Do you really think so ?
- reasmb: But you are not sure you (3).
- reasmb: Do you really doubt you (3) ?
- decomp: * i* @belief *you *
- reasmb: goto you
- decomp: * i am *
- reasmb: Is it because you are (2) that you came to me ?
- reasmb: How long have you been (2) ?
- reasmb: Do you believe it is normal to be (2) ?
- reasmb: Do you enjoy being (2) ?
- reasmb: Do you know anyone else who is (2) ?
- decomp: * i @cannot *
- reasmb: How do you know that you can't (3) ?
- reasmb: Have you tried ?
- reasmb: Perhaps you could (3) now.
- reasmb: Do you really want to be able to (3) ?
- reasmb: What if you could (3) ?
- decomp: * i don't *
- reasmb: Don't you really (2) ?
- reasmb: Why don't you (2) ?
- reasmb: Do you wish to be able to (2) ?
- reasmb: Does that trouble you ?
- decomp: * i feel *
- reasmb: Tell me more about such feelings.
- reasmb: Do you often feel (2) ?
- reasmb: Do you enjoy feeling (2) ?
- reasmb: Of what does feeling (2) remind you ?
- decomp: * i * you *
- reasmb: Perhaps in your fantasies we (2) each other.
- reasmb: Do you wish to (2) me ?
- reasmb: You seem to need to (2) me.
- reasmb: Do you (2) anyone else ?
- decomp: *
- reasmb: You say (1) ?
- reasmb: Why do you say (1) ?
- reasmb: Can you elaborate on that ?
- reasmb: Do you say (1) for some special reason ?
- reasmb: That's quite interesting.
-key: you 0
- decomp: * you remind me of *
- reasmb: goto alike
- decomp: * you are *
- reasmb: What makes you think I am (2) ?
- reasmb: Does it please you to believe I am (2) ?
- reasmb: Do you sometimes wish you were (2) ?
- reasmb: Perhaps you would like to be (2).
- decomp: * you* me *
- reasmb: Why do you think I (2) you ?
- reasmb: You like to think I (2) you -- don't you ?
- reasmb: What makes you think I (2) you ?
- reasmb: Really, I (2) you ?
- reasmb: Do you wish to believe I (2) you ?
- reasmb: Suppose I did (2) you -- what would that mean ?
- reasmb: Does someone else believe I (2) you ?
- decomp: * you *
- reasmb: We were discussing you -- not me.
- reasmb: Oh, I (2) ?
- reasmb: You're not really talking about me -- are you ?
- reasmb: What are your feelings now ?
-key: yes 0
- decomp: *
- reasmb: Please go on.
- reasmb: Please tell me some more about this.
- reasmb: Why don't you tell me a little more about this.
- reasmb: I see.
- reasmb: I understand.
-key: no 0
- decomp: * no one *
- reasmb: Are you sure, no one (2) ?
- reasmb: Surely someone (2) .
- reasmb: Can you think of anyone at all ?
- reasmb: Are you thinking of a very special person ?
- reasmb: Who, may I ask ?
- reasmb: You have a particular person in mind, don't you ?
- reasmb: Who do you think you are talking about ?
- decomp: *
- reasmb: Are you saying no just to be negative?
- reasmb: Does this make you feel unhappy?
- reasmb: Why not ?
- reasmb: Why 'no' ?
-key: my 2
- decomp: * my* @family *
- reasmb: Tell me more about your family.
- reasmb: Who else in your family (4) ?
- reasmb: Your (3) ?
- reasmb: What else comes to mind when you think of your (3) ?
- decomp: * my *
- reasmb: Your (2) ?
- reasmb: Why do you say your (2) ?
- reasmb: Does that suggest anything else which belongs to you ?
- reasmb: Is it important to you that your (2) ?
- reasm_for_memory: Let's discuss further why your (2).
- reasm_for_memory: Earlier you said your (2).
- reasm_for_memory: But your (2).
- reasm_for_memory: Does that have anything to do with the fact that your (2) ?
-key: can 0
- decomp: * can you *
- reasmb: You believe I can (2) don't you ?
- reasmb: goto what
- reasmb: You want me to be able to (2).
- reasmb: Perhaps you would like to be able to (2) yourself.
- decomp: * can i *
- reasmb: Whether or not you can (2) depends on you more than on me.
- reasmb: Do you want to be able to (2) ?
- reasmb: Perhaps you don't want to (2).
- reasmb: goto what
-key: what 0
- decomp: *
- reasmb: Why do you ask ?
- reasmb: Does that question interest you ?
- reasmb: What is it you really want to know ?
- reasmb: Are such questions much on your mind ?
- reasmb: What answer would please you most ?
- reasmb: What do you think ?
- reasmb: What comes to mind when you ask that ?
- reasmb: Have you asked such questions before ?
- reasmb: Have you asked anyone else ?
-key: who 0
- decomp: who *
- reasmb: goto what
-key: when 0
- decomp: when *
- reasmb: goto what
-key: where 0
- decomp: where *
- reasmb: goto what
-key: how 0
- decomp: how *
- reasmb: goto what
-key: because 0
- decomp: *
- reasmb: Is that the real reason ?
- reasmb: Don't any other reasons come to mind ?
- reasmb: Does that reason seem to explain anything else ?
- reasmb: What other reasons might there be ?
-key: why 0
- decomp: * why don't you *
- reasmb: Do you believe I don't (2) ?
- reasmb: Perhaps I will (2) in good time.
- reasmb: Should you (2) yourself ?
- reasmb: You want me to (2) ?
- reasmb: goto what
- decomp: * why can't i *
- reasmb: Do you think you should be able to (2) ?
- reasmb: Do you want to be able to (2) ?
- reasmb: Do you believe this will help you to (2) ?
- reasmb: Have you any idea why you can't (2) ?
- reasmb: goto what
- decomp: *
- reasmb: goto what
-key: everyone 2
- decomp: * @everyone *
- reasmb: Really, (2) ?
- reasmb: Surely not (2).
- reasmb: Can you think of anyone in particular ?
- reasmb: Who, for example?
- reasmb: Are you thinking of a very special person ?
- reasmb: Who, may I ask ?
- reasmb: Someone special perhaps ?
- reasmb: You have a particular person in mind, don't you ?
- reasmb: Who do you think you're talking about ?
-key: everybody 2
- decomp: *
- reasmb: goto everyone
-key: nobody 2
- decomp: *
- reasmb: goto everyone
-key: noone 2
- decomp: *
- reasmb: goto everyone
-key: always 1
- decomp: *
- reasmb: Can you think of a specific example ?
- reasmb: When ?
- reasmb: What incident are you thinking of ?
- reasmb: Really, always ?
-key: alike 10
- decomp: *
- reasmb: In what way ?
- reasmb: What resemblence do you see ?
- reasmb: What does that similarity suggest to you ?
- reasmb: What do you suppose that resemblence means ?
- reasmb: What is the connection, do you suppose ?
- reasmb: Could there really be some connection ?
- reasmb: How ?
-key: like 10
- decomp: * @be *like *
- reasmb: goto alike
-key: different 0
- decomp: *
- reasmb: How is it different ?
- reasmb: What differences do you see ?
- reasmb: What does that difference suggest to you ?
- reasmb: What other distinctions do you see ?
- reasmb: What do you suppose that disparity means ?
- reasmb: Could there be some connection, do you suppose ?
- reasmb: How ?
-key: fuck 10
- decomp: *
- reasmb: goto xswear
-key: fucker 10
- decomp: *
- reasmb: goto xswear
-key: shit 10
- decomp: *
- reasmb: goto xswear
-key: damn 10
- decomp: *
- reasmb: goto xswear
-key: shut 10
- decomp: * shut up *
- reasmb: goto xswear
-key: xswear 10
- decomp: *
- reasmb: Does it make you feel strong to use that kind of language ?
- reasmb: Are you venting your feelings now ?
- reasmb: Are you angry ?
- reasmb: Does this topic make you feel angry ?
- reasmb: Is something making you feel angry ?
- reasmb: Does using that kind of language make you feel better ?
@@ -0,0 +1,379 @@
+This software is copyright (c) 2003 by John Nolan.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+Terms of the Perl programming language system itself
+
+a) the GNU General Public License as published by the Free
+ Software Foundation; either version 1, or (at your option) any
+ later version, or
+b) the "Artistic License"
+
+--- The GNU General Public License, Version 1, February 1989 ---
+
+This software is Copyright (c) 2003 by John Nolan.
+
+This is free software, licensed under:
+
+ The GNU General Public License, Version 1, February 1989
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 1, February 1989
+
+ Copyright (C) 1989 Free Software Foundation, Inc.
+ 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The license agreements of most software companies try to keep users
+at the mercy of those companies. By contrast, our General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. The
+General Public License applies to the Free Software Foundation's
+software and to any other program whose authors commit to using it.
+You can use it for your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Specifically, the General Public License is designed to make
+sure that you have the freedom to give away or sell copies of free
+software, that you receive source code or can get it if you want it,
+that you can change the software or use pieces of it in new free
+programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of a such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must tell them their rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any program or other work which
+contains a notice placed by the copyright holder saying it may be
+distributed under the terms of this General Public License. The
+"Program", below, refers to any such program or work, and a "work based
+on the Program" means either the Program or any work containing the
+Program or a portion of it, either verbatim or with modifications. Each
+licensee is addressed as "you".
+
+ 1. You may copy and distribute verbatim copies of the Program's source
+code as you receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice and
+disclaimer of warranty; keep intact all the notices that refer to this
+General Public License and to the absence of any warranty; and give any
+other recipients of the Program a copy of this General Public License
+along with the Program. You may charge a fee for the physical act of
+transferring a copy.
+
+ 2. You may modify your copy or copies of the Program or any portion of
+it, and copy and distribute such modifications under the terms of Paragraph
+1 above, provided that you also do the following:
+
+ a) cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change; and
+
+ b) cause the whole of any work that you distribute or publish, that
+ in whole or in part contains the Program or any part thereof, either
+ with or without modifications, to be licensed at no charge to all
+ third parties under the terms of this General Public License (except
+ that you may choose to grant warranty protection to some or all
+ third parties, at your option).
+
+ c) If the modified program normally reads commands interactively when
+ run, you must cause it, when started running for such interactive use
+ in the simplest and most usual way, to print or display an
+ announcement including an appropriate copyright notice and a notice
+ that there is no warranty (or else, saying that you provide a
+ warranty) and that users may redistribute the program under these
+ conditions, and telling the user how to view a copy of this General
+ Public License.
+
+ d) You may charge a fee for the physical act of transferring a
+ copy, and you may at your option offer warranty protection in
+ exchange for a fee.
+
+Mere aggregation of another independent work with the Program (or its
+derivative) on a volume of a storage or distribution medium does not bring
+the other work under the scope of these terms.
+
+ 3. You may copy and distribute the Program (or a portion or derivative of
+it, under Paragraph 2) in object code or executable form under the terms of
+Paragraphs 1 and 2 above provided that you also do one of the following:
+
+ a) accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ b) accompany it with a written offer, valid for at least three
+ years, to give any third party free (except for a nominal charge
+ for the cost of distribution) a complete machine-readable copy of the
+ corresponding source code, to be distributed under the terms of
+ Paragraphs 1 and 2 above; or,
+
+ c) accompany it with the information you received as to where the
+ corresponding source code may be obtained. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form alone.)
+
+Source code for a work means the preferred form of the work for making
+modifications to it. For an executable file, complete source code means
+all the source code for all modules it contains; but, as a special
+exception, it need not include source code for modules which are standard
+libraries that accompany the operating system on which the executable
+file runs, or for standard header files or definitions files that
+accompany that operating system.
+
+ 4. You may not copy, modify, sublicense, distribute or transfer the
+Program except as expressly provided under this General Public License.
+Any attempt otherwise to copy, modify, sublicense, distribute or transfer
+the Program is void, and will automatically terminate your rights to use
+the Program under this License. However, parties who have received
+copies, or rights to use copies, from you under this General Public
+License will not have their licenses terminated so long as such parties
+remain in full compliance.
+
+ 5. By copying, distributing or modifying the Program (or any work based
+on the Program) you indicate your acceptance of this license to do so,
+and all its terms and conditions.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the original
+licensor to copy, distribute or modify the Program subject to these
+terms and conditions. You may not impose any further restrictions on the
+recipients' exercise of the rights granted herein.
+
+ 7. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of the license which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+the license, you may choose any version ever published by the Free Software
+Foundation.
+
+ 8. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ Appendix: How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to humanity, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these
+terms.
+
+ To do so, attach the following notices to the program. It is safest to
+attach them to the start of each source file to most effectively convey
+the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 1, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19xx name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the
+appropriate parts of the General Public License. Of course, the
+commands you use may be called something other than `show w' and `show
+c'; they could even be mouse-clicks or menu items--whatever suits your
+program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ program `Gnomovision' (a program to direct compilers to make passes
+ at assemblers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+--- The Artistic License 1.0 ---
+
+This software is Copyright (c) 2003 by John Nolan.
+
+This is free software, licensed under:
+
+ The Artistic License 1.0
+
+The Artistic License
+
+Preamble
+
+The intent of this document is to state the conditions under which a Package
+may be copied, such that the Copyright Holder maintains some semblance of
+artistic control over the development of the package, while giving the users of
+the package the right to use and distribute the Package in a more-or-less
+customary fashion, plus the right to make reasonable modifications.
+
+Definitions:
+
+ - "Package" refers to the collection of files distributed by the Copyright
+ Holder, and derivatives of that collection of files created through
+ textual modification.
+ - "Standard Version" refers to such a Package if it has not been modified,
+ or has been modified in accordance with the wishes of the Copyright
+ Holder.
+ - "Copyright Holder" is whoever is named in the copyright or copyrights for
+ the package.
+ - "You" is you, if you're thinking about copying or distributing this Package.
+ - "Reasonable copying fee" is whatever you can justify on the basis of media
+ cost, duplication charges, time of people involved, and so on. (You will
+ not be required to justify it to the Copyright Holder, but only to the
+ computing community at large as a market that must bear the fee.)
+ - "Freely Available" means that no fee is charged for the item itself, though
+ there may be fees involved in handling the item. It also means that
+ recipients of the item may redistribute it under the same conditions they
+ received it.
+
+1. You may make and give away verbatim copies of the source form of the
+Standard Version of this Package without restriction, provided that you
+duplicate all of the original copyright notices and associated disclaimers.
+
+2. You may apply bug fixes, portability fixes and other modifications derived
+from the Public Domain or from the Copyright Holder. A Package modified in such
+a way shall still be considered the Standard Version.
+
+3. You may otherwise modify your copy of this Package in any way, provided that
+you insert a prominent notice in each changed file stating how and when you
+changed that file, and provided that you do at least ONE of the following:
+
+ a) place your modifications in the Public Domain or otherwise make them
+ Freely Available, such as by posting said modifications to Usenet or an
+ equivalent medium, or placing the modifications on a major archive site
+ such as ftp.uu.net, or by allowing the Copyright Holder to include your
+ modifications in the Standard Version of the Package.
+
+ b) use the modified Package only within your corporation or organization.
+
+ c) rename any non-standard executables so the names do not conflict with
+ standard executables, which must also be provided, and provide a separate
+ manual page for each non-standard executable that clearly documents how it
+ differs from the Standard Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+4. You may distribute the programs of this Package in object code or executable
+form, provided that you do at least ONE of the following:
+
+ a) distribute a Standard Version of the executables and library files,
+ together with instructions (in the manual page or equivalent) on where to
+ get the Standard Version.
+
+ b) accompany the distribution with the machine-readable source of the Package
+ with your modifications.
+
+ c) accompany any non-standard executables with their corresponding Standard
+ Version executables, giving the non-standard executables non-standard
+ names, and clearly documenting the differences in manual pages (or
+ equivalent), together with instructions on where to get the Standard
+ Version.
+
+ d) make other distribution arrangements with the Copyright Holder.
+
+5. You may charge a reasonable copying fee for any distribution of this
+Package. You may charge any fee you choose for support of this Package. You
+may not charge a fee for this Package itself. However, you may distribute this
+Package in aggregate with other (possibly commercial) programs as part of a
+larger (possibly commercial) software distribution provided that you do not
+advertise this Package as a product of your own.
+
+6. The scripts and library files supplied as input to or produced as output
+from the programs of this Package do not automatically fall under the copyright
+of this Package, but belong to whomever generated them, and may be sold
+commercially, and may be aggregated with this Package.
+
+7. C or perl subroutines supplied by you and linked into this Package shall not
+be considered part of this Package.
+
+8. The name of the Copyright Holder may not be used to endorse or promote
+products derived from this software without specific prior written permission.
+
+9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+
+The End
+
@@ -1,16 +1,23 @@
-Chatbot/Eliza.pm
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.015.
+Changes
+LICENSE
MANIFEST
+META.yml
Makefile.PL
README
-debug.cgi
-deutsch
-deutsch.cgi
-deutsch.txt
-doctor.txt
-norsk
-norsk.cgi
-norsk.txt
-simple
-simple.cgi
-test.pl
-twobots
+dist.ini
+examples/debug.cgi
+examples/deutsch
+examples/deutsch.cgi
+examples/deutsch.txt
+examples/doctor.txt
+examples/norsk
+examples/norsk.cgi
+examples/norsk.txt
+examples/simple
+examples/simple.cgi
+examples/twobots
+lib/Chatbot/Eliza.pm
+t/01-require.t
+t/02-test-bot.t
+t/test-script.txt
@@ -0,0 +1,24 @@
+---
+abstract: 'A clone of the classic Eliza program'
+author:
+ - 'John Nolan <jpnolan@sonic.net>'
+build_requires:
+ Test::More: '0.88'
+configure_requires:
+ ExtUtils::MakeMaker: '6.30'
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 5.015, CPAN::Meta::Converter version 2.133380'
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: '1.4'
+name: Chatbot-Eliza
+requires:
+ Carp: '0'
+ perl: '5.006'
+ strict: '0'
+ warnings: '0'
+resources:
+ homepage: https://github.com/neilbowers/Chatbot-Eliza
+ repository: https://github.com/neilbowers/Chatbot-Eliza.git
+version: '1.05'
@@ -1,8 +1,58 @@
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
- 'NAME' => 'Chatbot',
- 'DISTNAME' => 'Eliza',
- 'VERSION_FROM' => 'Chatbot/Eliza.pm', # finds $VERSION
+
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.015.
+use strict;
+use warnings;
+
+use 5.006;
+
+use ExtUtils::MakeMaker 6.30;
+
+
+
+my %WriteMakefileArgs = (
+ "ABSTRACT" => "A clone of the classic Eliza program",
+ "AUTHOR" => "John Nolan <jpnolan\@sonic.net>",
+ "BUILD_REQUIRES" => {},
+ "CONFIGURE_REQUIRES" => {
+ "ExtUtils::MakeMaker" => "6.30"
+ },
+ "DISTNAME" => "Chatbot-Eliza",
+ "EXE_FILES" => [],
+ "LICENSE" => "perl",
+ "NAME" => "Chatbot::Eliza",
+ "PREREQ_PM" => {
+ "Carp" => 0,
+ "strict" => 0,
+ "warnings" => 0
+ },
+ "TEST_REQUIRES" => {
+ "Test::More" => "0.88"
+ },
+ "VERSION" => "1.05",
+ "test" => {
+ "TESTS" => "t/*.t"
+ }
);
+
+
+my %FallbackPrereqs = (
+ "Carp" => 0,
+ "Test::More" => "0.88",
+ "strict" => 0,
+ "warnings" => 0
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+ delete $WriteMakefileArgs{TEST_REQUIRES};
+ delete $WriteMakefileArgs{BUILD_REQUIRES};
+ $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
+}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
+
@@ -1,603 +1,15 @@
-README file for Chatbot::Eliza 1.04
+This archive contains the distribution Chatbot-Eliza,
+version 1.05:
-NAME
- Chatbot::Eliza - A clone of the classic Eliza program
+ A clone of the classic Eliza program
-SYNOPSIS
- use Chatbot::Eliza;
+This software is copyright (c) 2003 by John Nolan.
- $mybot = new Chatbot::Eliza;
- $mybot->command_interface;
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
- # see below for details
-DESCRIPTION
- This module implements the classic Eliza algorithm. The original
- Eliza program was written by Joseph Weizenbaum and described in
- the Communications of the ACM in 1966. Eliza is a mock Rogerian
- psychotherapist. It prompts for user input, and uses a simple
- transformation algorithm to change user input into a follow-up
- question. The program is designed to give the appearance of
- understanding.
-
- This program is a faithful implementation of the program
- described by Weizenbaum. It uses a simplified script language
- (devised by Charles Hayden). The content of the script is the
- same as Weizenbaum's.
-
- This module encapsulates the Eliza algorithm in the form of an
- object. This should make the functionality easy to incorporate
- in larger programs.
-
-INSTALLATION
- The current version of Chatbot::Eliza.pm is available on CPAN:
-
- http://www.perl.com/CPAN/modules/by-module/Chatbot/
-
- To install this package, just change to the directory which you
- created by untarring the package, and type the following:
-
- perl Makefile.PL
- make test
- make
- make install
-
- This will copy Eliza.pm to your perl library directory for use
- by all perl scripts. You probably must be root to do this,
- unless you have installed a personal copy of perl.
-
-USAGE
- This is all you need to do to launch a simple Eliza session:
-
- use Chatbot::Eliza;
-
- $mybot = new Chatbot::Eliza;
- $mybot->command_interface;
-
- You can also customize certain features of the session:
-
- $myotherbot = new Chatbot::Eliza;
-
- $myotherbot->name( "Hortense" );
- $myotherbot->debug( 1 );
-
- $myotherbot->command_interface;
-
- These lines set the name of the bot to be "Hortense" and turn on
- the debugging output.
-
- When creating an Eliza object, you can specify a name and an
- alternative scriptfile:
-
- $bot = new Chatbot::Eliza "Brian", "myscript.txt";
-
- You can also use an anonymous hash to set these parameters. Any
- of the fields can be initialized using this syntax:
-
- $bot = new Chatbot::Eliza {
- name => "Brian",
- scriptfile => "myscript.txt",
- debug => 1,
- prompts_on => 1,
- memory_on => 0,
- myrand =>
- sub { my $N = defined $_[0] ? $_[0] : 1; rand($N); },
- };
-
- If you don't specify a script file, then the new object will be
- initialized with a default script. The module contains this
- script within itself.
-
- You can use any of the internal functions in a calling program.
- The code below takes an arbitrary string and retrieves the reply
- from the Eliza object:
-
- my $string = "I have too many problems.";
- my $reply = $mybot->transform( $string );
-
- You can easily create two bots, each with a different script,
- and see how they interact:
-
- use Chatbot::Eliza
-
- my ($harry, $sally, $he_says, $she_says);
-
- $sally = new Chatbot::Eliza "Sally", "histext.txt";
- $harry = new Chatbot::Eliza "Harry", "hertext.txt";
-
- $he_says = "I am sad.";
-
- # Seed the random number generator.
- srand( time ^ ($$ + ($$ << 15)) );
-
- while (1) {
- $she_says = $sally->transform( $he_says );
- print $sally->name, ": $she_says \n";
-
- $he_says = $harry->transform( $she_says );
- print $harry->name, ": $he_says \n";
- }
-
- Mechanically, this works well. However, it critically depends on
- the actual script data. Having two mock Rogerian therapists talk
- to each other usually does not produce any sensible
- conversation, of course.
-
- After each call to the transform() method, the debugging output
- for that transformation is stored in a variable called
- $debug_text.
-
- my $reply = $mybot->transform( "My foot hurts" );
- my $debugging = $mybot->debug_text;
-
- This feature always available, even if the instance's $debug
- variable is set to 0.
-
- Calling programs can specify their own random-number generators.
- Use this syntax:
-
- $chatbot = new Chatbot::Eliza;
- $chatbot->myrand(
- sub {
- #function goes here!
- }
- );
-
- The custom random function should have the same prototype as
- perl's built-in rand() function. That is, it should take a
- single (numeric) expression as a parameter, and it should return
- a floating-point value between 0 and that number.
-
- What this code actually does is pass a reference to an anonymous
- subroutine ("code reference"). Make sure you've read the perlref
- manpage for details on how code references actually work.
-
- If you don't specify any custom rand function, then the Eliza
- object will just use the built-in rand() function.
-
-MAIN DATA MEMBERS
- Each Eliza object uses the following data structures to hold the
- script data in memory:
-
- %decomplist
-
- *Hash*: the set of keywords; *Values*: strings containing the
- decomposition rules.
-
- %reasmblist
-
- *Hash*: a set of values which are each the join of a keyword and
- a corresponding decomposition rule; *Values*: the set of
- possible reassembly statements for that keyword and
- decomposition rule.
-
- %reasmblist_for_memory
-
- This structure is identical to `%reasmblist', except that these
- rules are only invoked when a user comment is being retrieved
- from memory. These contain comments such as "Earlier you
- mentioned that...," which are only appropriate for remembered
- comments. Rules in the script must be specially marked in order
- to be included in this list rather than `%reasmblist'. The
- default script only has a few of these rules.
-
- @memory
-
- A list of user comments which an Eliza instance is remembering
- for future use. Eliza does not remember everything, only some
- things. In this implementation, Eliza will only remember
- comments which match a decomposition rule which actually has
- reassembly rules that are marked with the keyword
- "reasm_for_memory" rather than the normal "reasmb". The default
- script only has a few of these.
-
- %keyranks
-
- *Hash*: the set of keywords; *Values*: the ranks for each
- keyword
-
- @quit
-
- "quit" words -- that is, words the user might use to try to exit
- the program.
-
- @initial
-
- Possible greetings for the beginning of the program.
-
- @final
-
- Possible farewells for the end of the program.
-
- %pre
-
- *Hash*: words which are replaced before any transformations;
- *Values*: the respective replacement words.
-
- %post
-
- *Hash*: words which are replaced after the transformations and
- after the reply is constructed; *Values*: the respective
- replacement words.
-
- %synon
-
- *Hash*: words which are found in decomposition rules; *Values*:
- words which are treated just like their corresponding synonyms
- during matching of decomposition rules.
-
- Other data members
-
- There are several other internal data members. Hopefully these
- are sufficiently obvious that you can learn about them just by
- reading the source code.
-
-METHODS
- new()
-
- my $chatterbot = new Chatbot::Eliza;
-
- new() creates a new Eliza object. This method also calls the
- internal _initialize() method, which in turn calls the
- parse_script_data() method, which initializes the script data.
-
- my $chatterbot = new Chatbot::Eliza 'Ahmad', 'myfile.txt';
-
- The eliza object defaults to the name "Eliza", and it contains
- default script data within itself. However, using the syntax
- above, you can specify an alternative name and an alternative
- script file.
-
- See the method parse_script_data(). for a description of the
- format of the script file.
-
- command_interface()
-
- $chatterbot->command_interface;
-
- command_interface() opens an interactive session with the Eliza
- object, just like the original Eliza program.
-
- If you want to design your own session format, then you can
- write your own while loop and your own functions for prompting
- for and reading user input, and use the transform() method to
- generate Eliza's responses. (*Note*: you do not need to invoke
- preprocess() and postprocess() directly, because these are
- invoked from within the transform() method.)
-
- But if you're lazy and you want to skip all that, then just use
- command_interface(). It's all done for you.
-
- During an interactive session invoked using command_interface(),
- you can enter the word "debug" to toggle debug mode on and off.
- You can also enter the keyword "memory" to invoke the
- _debug_memory() method and print out the contents of the Eliza
- instance's memory.
-
- preprocess()
-
- $string = preprocess($string);
-
- preprocess() applies simple substitution rules to the input
- string. Mostly this is to catch varieties in spelling,
- misspellings, contractions and the like.
-
- preprocess() is called from within the transform() method. It is
- applied to user-input text, BEFORE any processing, and before a
- reassebly statement has been selected.
-
- It uses the array `%pre', which is created during the parse of
- the script.
-
- postprocess()
-
- $string = postprocess($string);
-
- postprocess() applies simple substitution rules to the
- reassembly rule. This is where all the "I"'s and "you"'s are
- exchanged. postprocess() is called from within the transform()
- function.
-
- It uses the array `%post', created during the parse of the
- script.
-
- _testquit()
-
- if ($self->_testquit($user_input) ) { ... }
-
- _testquit() detects words like "bye" and "quit" and returns true
- if it finds one of them as the first word in the sentence.
-
- These words are listed in the script, under the keyword "quit".
-
- _debug_memory()
-
- $self->_debug_memory()
-
- _debug_memory() is a special function which returns the contents
- of Eliza's memory stack.
-
- transform()
-
- $reply = $chatterbot->transform( $string, $use_memory );
-
- transform() applies transformation rules to the user input
- string. It invokes preprocess(), does transformations, then
- invokes postprocess(). It returns the tranformed output string,
- called `$reasmb'.
-
- The algorithm embedded in the transform() method has three main
- parts:
-
- 1 Search the input string for a keyword.
-
- 2 If we find a keyword, use the list of decomposition rules for
- that keyword, and pattern-match the input string against
- each rule.
-
- 3 If the input string matches any of the decomposition rules, then
- randomly select one of the reassembly rules for that
- decomposition rule, and use it to construct the reply.
-
- transform() takes two parameters. The first is the string we
- want to transform. The second is a flag which indicates where
- this sting came from. If the flag is set, then the string has
- been pulled from memory, and we should use reassembly rules
- appropriate for that. If the flag is not set, then the string is
- the most recent user input, and we can use the ordinary
- reassembly rules.
-
- The memory flag is only set when the transform() function is
- called recursively. The mechanism for setting this parameter is
- embedded in the transoform method itself. If the flag is set
- inappropriately, it is ignored.
-
- How memory is used
-
- In the script, some reassembly rules are special. They are
- marked with the keyword "reasm_for_memory", rather than just
- "reasm". Eliza "remembers" any comment when it matches a
- docomposition rule for which there are any reassembly rules for
- memory. An Eliza object remembers up to `$max_memory_size'
- (default: 5) user input strings.
-
- If, during a subsequent run, the transform() method fails to
- find any appropriate decomposition rule for a user's comment,
- and if there are any comments inside the memory array, then
- Eliza may elect to ignore the most recent comment and instead
- pull out one of the strings from memory. In this case, the
- transform method is called recursively with the memory flag.
-
- Honestly, I am not sure exactly how this memory functionality
- was implemented in the original Eliza program. Hopefully this
- implementation is not too far from Weizenbaum's.
-
- If you don't want to use the memory functionality at all, then
- you can disable it:
-
- $mybot->memory_on(0);
-
- You can also achieve the same effect by making sure that the
- script data does not contain any reassembly rules marked with
- the keyword "reasm_for_memory". The default script data only has
- 4 such items.
-
- parse_script_data()
-
- $self->parse_script_data;
- $self->parse_script_data( $script_file );
-
- parse_script_data() is invoked from the _initialize() method,
- which is called from the new() function. However, you can also
- call this method at any time against an already-instantiated
- Eliza instance. In that case, the new script data is *added* to
- the old script data. The old script data is not deleted.
-
- You can pass a parameter to this function, which is the name of
- the script file, and it will read in and parse that file. If you
- do not pass any parameter to this method, then it will read the
- data embedded at the end of the module as its default script
- data.
-
- If you pass the name of a script file to parse_script_data(),
- and that file is not available for reading, then the module
- dies.
-
-Format of the script file
- This module includes a default script file within itself, so it
- is not necessary to explicitly specify a script file when
- instantiating an Eliza object.
-
- Each line in the script file can specify a key, a decomposition
- rule, or a reassembly rule.
-
- key: remember 5
- decomp: * i remember *
- reasmb: Do you often think of (2) ?
- reasmb: Does thinking of (2) bring anything else to mind ?
- decomp: * do you remember *
- reasmb: Did you think I would forget (2) ?
- reasmb: What about (2) ?
- reasmb: goto what
- pre: equivalent alike
- synon: belief feel think believe wish
-
- The number after the key specifies the rank. If a user's input
- contains the keyword, then the transform() function will try to
- match one of the decomposition rules for that keyword. If one
- matches, then it will select one of the reassembly rules at
- random. The number (2) here means "use whatever set of words
- matched the second asterisk in the decomposition rule."
-
- If you specify a list of synonyms for a word, the you should use
- a "@" when you use that word in a decomposition rule:
-
- decomp: * i @belief i *
- reasmb: Do you really think so ?
- reasmb: But you are not sure you (3).
-
- Otherwise, the script will never check to see if there are any
- synonyms for that keyword.
-
- Reassembly rules should be marked with *reasm_for_memory* rather
- than *reasmb* when it is appropriate for use when a user's
- comment has been extracted from memory.
-
- key: my 2
- decomp: * my *
- reasm_for_memory: Let's discuss further why your (2).
- reasm_for_memory: Earlier you said your (2).
- reasm_for_memory: But your (2).
- reasm_for_memory: Does that have anything to do with the fact that your (2) ?
-
-How the script file is parsed
- Each line in the script file contains an "entrytype" (key,
- decomp, synon) and an "entry", separated by a colon. In turn,
- each "entry" can itself be composed of a "key" and a "value",
- separated by a space. The parse_script_data() function parses
- each line out, and splits the "entry" and "entrytype" portion of
- each line into two variables, `$entry' and `$entrytype'.
-
- Next, it uses the string `$entrytype' to determine what sort of
- stuff to expect in the `$entry' variable, if anything, and
- parses it accordingly. In some cases, there is no second level
- of key-value pair, so the function does not even bother to
- isolate or create `$key' and `$value'.
-
- `$key' is always a single word. `$value' can be null, or one
- single word, or a string composed of several words, or an array
- of words.
-
- Based on all these entries and keys and values, the function
- creates two giant hashes: `%decomplist', which holds the
- decomposition rules for each keyword, and `%reasmblist', which
- holds the reassembly phrases for each decomposition rule. It
- also creates `%keyranks', which holds the ranks for each key.
-
- Six other arrays are created: `%reasm_for_memory, %pre, %post,
- %synon, @initial,' and `@final'.
-
-CHANGES
- * Version 1.02-1.04 - January 2003
- Added a Norwegian script, kindly contributed by
- Mats Stafseng Einarsen. Thanks Mats!
-
- * Version 1.01 - January 2003
- Added an empty DESTORY method, to eliminate
- some pesky warning messages. Suggested by
- Stas Bekman.
-
- * Version 0.98 - March 2000
- Some changes to the documentation.
-
- * Versions 0.96-0.97 - October 1999
- One tiny change to the regex which implements
- reassemble rules. Thanks to Gidon Wise for
- suggesting this improvement.
-
- * Versions 0.94-0.95 - July 1999
- Fixed a bug in the way the bot invokes its random function
- when it pulls a comment out of memory.
-
- * Version 0.93 - June 1999
- Calling programs can now specify their own random-number generators.
- Use this syntax:
-
- $chatbot = new Chatbot::Eliza;
- $chatbot->myrand(
- sub {
- #function goes here!
- }
- );
-
- The custom random function should have the same prototype
- as perl's built-in rand() function. That is, it should take
- a single (numeric) expression as a parameter, and it should
- return a floating-point value between 0 and that number.
-
- You can also now use a reference to an anonymous hash
- as a parameter to the new() method to define any fields
- in that bot instance:
-
- $bot = new Chatbot::Eliza {
- name => "Brian",
- scriptfile => "myscript.txt",
- debug => 1,
- };
-
- * Versions 0.91-0.92 - April 1999
- Fixed some misspellings.
-
- * Version 0.90 - April 1999
- Fixed a bug in the way individual bot objects store
- their memory. Thanks to Randal Schwartz and to
- Robert Chin for pointing this out.
-
- Fixed a very stupid error in the way the random
- function is invoked. Thanks to Antony Quintal
- for pointing out the error.
-
- Many corrections and improvements were made
- to the German script by Matthias Hellmund.
- Thanks, Matthias!
-
- Made a minor syntactical change, at the suggestion
- of Roy Stephan.
-
- The memory functionality can now be disabled by setting the
- $Chatbot::Eliza::memory_on variable to 0, like so:
-
- $bot->memory_on(0);
-
- Thanks to Robert Chin for suggesting that.
-
- * Version 0.40 - July 1998
- Re-implemented the memory functionality.
-
- Cleaned up and expanded the embedded POD documentation.
-
- Added a sample script in German.
-
- Modified the debugging behavior. The transform() method itself
- will no longer print any debugging output directly to STDOUT.
- Instead, all debugging output is stored in a module variable
- called "debug_text". The "debug_text" variable is printed out
- by the command_interface() method, if the debug flag is set.
- But even if this flag is not set, the variable debug_text
- is still available to any calling program.
-
- Added a few more example scripts which use the module.
-
- simple - simple script using Eliza.pm
- simple.cgi - simple CGI script using Eliza.pm
- debug.cgi - CGI script which displays debugging output
- deutsch - script using the German script
- deutsch.cgi - CGI script using the German script
- twobots - script which creates two distinct bots
-
- * Version 0.32 - December 1997
- Fixed a bug in the way Eliza loads its default internal script data.
- (Thanks to Randal Schwartz for pointing this out.)
-
- Removed the "memory" functions internal to Eliza.
- When I get them working properly I will add them back in.
-
- Added one more example program.
-
- Fixed some minor errors in the embedded POD documentation.
-
- * Version 0.31
- The module is now installable, just like any other self-respecting
- CPAN module.
-
- * Version 0.30
- First release.
-
-AUTHOR
- John Nolan jpnolan@sonic.net January 2003.
-
- Implements the classic Eliza algorithm by Prof. Joseph
- Weizenbaum. Script format devised by Charles Hayden.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.015.
@@ -1,62 +0,0 @@
-#!/usr/bin/perl
-
-# This script implements a Chatbot::Eliza object
-# in a cgi program. It uses the CGI.pm module
-# written by Lincoln Stein.
-#
-# It also prints out the debugging output available
-# in the Eliza chatbot module.
-#
-# 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');
-}
-
-$comment = $cgi->param('Comment');
-$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');
-
-print $cgi->endform;
-print $cgi->hr;
-
-print $cgi->h2('Debugging Output');
-print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
-
-print $cgi->end_html;
-
@@ -1,14 +0,0 @@
-#!/usr/bin/perl -w
-
-use Chatbot::Eliza;
-
-# This little script tests the German-language
-# version of the "doctor" script.
-
-# seed the random number generator
-srand( time ^ ($$ + ($$ << 15)) );
-
-$chatbot = new Chatbot::Eliza "Hans", "deutsch.txt";
-##$chatbot->debug(1);
-$chatbot->command_interface();
-
@@ -1,67 +0,0 @@
-#!/usr/bin/perl
-
-# This script implements a Chatbot::Eliza object
-# in a cgi program. It uses the CGI.pm module
-# written by Lincoln Stein.
-#
-# It makes use of a German-language "Doctor" script.
-#
-# It also prints out the debugging output available
-# in the Eliza chatbot module.
-#
-# 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.
-#
-# The German-language script must also be available
-# to this script.
-#
-# 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 "Eliza", "deutsch.txt";
-
-srand( time ^ ($$ + ($$ << 15)) ); # seed the random number generator
-
-print $cgi->header;
-print $cgi->start_html;
-print $cgi->start_multipart_form;
-print $cgi->h2('Eliza Sitzung');
-
-# 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');
-}
-
-$comment = $cgi->param('Comment');
-$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');
-
-print $cgi->endform;
-print $cgi->hr;
-
-print $cgi->h2('Debugging Output');
-print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
-
-print $cgi->end_html;
-
@@ -1,504 +0,0 @@
-####################################################################
-#
-# This script is meant to be a close translation of the original "doctor"
-# script by Weizenbaum. Obviously, an exact translation is not possible.
-# German word order, as well as the conjugation of verbs, renders
-# many of the original English rules flatly unworkable in German.
-# However, many of the rules do pretty work well, and German offers
-# opportunities for at least few new ones of its own (e.g., "mir ist *").
-#
-# Prepared by John Nolan and Matthias Hellmund.
-#
-#
-initial: Freut mich. Erzähl mir dein Problem!
-initial: Hallo, ich bin Rechnerprogram.
-initial: Sag mir bitte, was dich stört.
-initial: Was hast du denn?
-final: Ciao. War nett mit dir zu reden. Bis dann.
-final: Tschüß! Hoffentlich hast du diese Sitzung hilfreich gefunden.
-final: Ich glaube, du solltest mit einem ECTHEN Analytiker sprechen. Ciao!
-final: Das Leben ist schwer. Bleib am Ball!
-quit: exit
-quit: quit
-quit: ende
-quit: Tschüß
-quit: ciao
-quit: tschuess
-quit: bye
-quit: goodbye
-pre: erinnere erinnre
-pre: Träume Traum
-pre: wieso warum
-pre: weshalb warum
-pre: hab habe
-pre: meins meines
-pre: deins deines
-pre: dus du es
-pre: du's du es
-pre: Machine Computer
-pre: Machines Computer
-pre: Machinen Computer
-pre: Computers Computer
-pre: Rechner Computer
-post: ich du
-post: du ich
-post: dich mich
-post: mich dich
-post: dir mir
-post: mir dir
-post: dein mein
-post: deine meine
-post: deiner meiner
-post: deinen meinen
-post: deines meines
-post: mein dein
-post: meiner deiner
-post: meines deines
-post: meinen deinen
-post: meine deine
-post: bin bist
-post: bist bin
-post: warst war
-post: war warst
-post: will willst
-post: willst will
-post: mochte mochtest
-post: mochtest mochte
-post: möchte möchtest
-post: möchtest möchte
-post: werde wirst
-post: wirst werde
-post: darfst darf
-post: darf darfst
-post: hast habe
-post: habe hast
-post: hatte hattest
-post: hattest hatte
-post: hätte hättest
-post: hättest hätte
-post: mag magst
-post: magst mag
-post: soll sollst
-post: sollst soll
-post: solltest sollte
-post: sollte solltest
-post: könnte könntest
-post: könntest könnte
-post: konnte konntest
-post: konntest konnte
-post: mußt muß
-post: muß mußt
-post: muss mußt
-post: musst muß
-pre: gleich ähnlich
-pre: identisch ähnlich
-pre: dasselbe ähnlich
-synon: glaube glauben finde finden wünsche wünschen
-synon: Familie Mutter Mutti Schwester Kinder
-synon: Familie-m Vater Vati Bruder Kind
-synon: moechte möchte will brauche
-synon: sicher bestimmt natürlich
-synon: traurig deprimiert unglücklich unzufrieden krank
-synon: gluecklich glücklich zufrieden froh besser
-synon: jeder jederman jedes jede
-synon: sein bin ist sind seid
-key: xnone -1
- decomp: *
- reasmb: Ich bin nicht sicher, ob ich dich verstanden habe.
- reasmb: Erzähl mir weiter.
- reasmb: Das ist ja interessant. Sprich bitte weiter.
- reasmb: Kannst du das nicht etwas erläutern ?
- reasmb: Stört es dich, daß wir über dieses Thema sprechen ?
-key: Leid 0
- decomp: * tut mir Leid *
- reasmb: Bitte entschuldige dich nicht!
- reasmb: Es ist nicht notwendig, sich zu entschuldigen.
- reasmb: Ich habe dir schon gesagt, es ist nicht notwendig, sich zu entschuldigen.
- reasmb: Es hat mich nicht gestört. Sprich bitte weiter.
-key: entschuldige 0
- decomp: *
- reasmb: goto Leid
-key: entschuldigen 0
- decomp: *
- reasmb: goto Leid
-key: erinnere 5
- decomp: * ich erinnere mich an *
- reasmb: Denkst du häufig an (2) ?
- reasmb: Fällt dir noch etwas ein, wenn du an (2) denkst ?
- reasmb: Woran erinnerst du dich noch ?
- reasmb: Warum erinnerst du dich jetzt gerade an (2)?
- reasmb: Was in der jetzigen Situation erinnert dich an (2) ?
- reasmb: Welche Verbindung gibt es zwischen mir und (2) ?
- reasmb: Woran erinnert dich (2) noch?
-key: erinnerst 5
- decomp: * erinnerst du dich * an *
- reasmb: Meinst du, ich würde (3) vergessen ?
- reasmb: Warum glaubst du, ich sollte mich an (3) erinnern ?
- reasmb: Wie ist es mit (3) ?
- reasmb: goto was
- reasm_for_memory: Du hast (3) erwähnt.
- decomp: * du erinnerst dich an *
- reasmb: Wie könnte ich (2) vergessen ?
- reasmb: What about (2) should I remember ?
- reasmb: goto du
-key: vergessen 5
- decomp: * ich habe * vergessen
- reasmb: Warum würdest du (2) vergessen ?
- reasmb: Warum kannst du dich nicht an (2) erinnern ?
- reasmb: Wie häufig denkst du an (2) ?
- reasmb: Stört es dich, (2) zu vergessen ?
- reasmb: Könnte das eine geistige Sperre sein ?
- reasmb: Bist du vergeßlich im allgemeinen ?
- reasmb: Glaubst du, du unterdrückst (2) ?
- decomp: * hast du * vergessen *
- reasmb: Warum fragst du das ?
- reasmb: Bist du sicher, daß du mir das gesagt hast ?
- reasmb: Würde es dich stören, wenn ich (2) vergessen würde ?
- reasmb: Warum soll ich mich jetzt an (2) erinnern ?
- reasmb: goto was
- reasmb: Sprich weiter über (2).
-key: wenn 3
- decomp: * wenn *
- reasmb: Glaubst du, es ist möglich, daß (2) ?
- reasmb: Wünschst du, daß (2) ?
- reasmb: Was weißt du über (2) ?
- reasmb: Tatsächlich, wenn (2) ?
- reasmb: Was würdest du machen, wenn (2) ?
- reasmb: Aber wieviele Chancen gibt es, daß (2) ?
-key: geträumt 4
- decomp: * habe * geträumt, daß *
- reasmb: Wirklich, daß (2) ?
- reasmb: Hast du schon einmal phantasiert, daß (2), während du wach warst ?
- reasmb: Hast du früher irgendwann geträumt, daß (2) ?
- reasmb: goto Traum
-key: Traum 3
- decomp: *
- reasmb: Worauf deutet dieser Traum hin ?
- reasmb: Träumst du oft ?
- reasmb: Welche Leute stellen sich in deinen Träumen vor ?
- reasmb: Glaubst du, daß Träume etwas mit deinem Problem zu tun haben ?
-key: vielleicht 0
- decomp: *
- reasmb: Du scheinst dir nicht völlig sicher zu sein.
- reasmb: Warum dieser unsichere Ton ?
- reasmb: Kannst du nicht positiver sein ?
- reasmb: Du bist nicht sicher ?
- reasmb: Weißt du nicht ?
- reasmb: Wie wahrscheinlich, meinst du, ist es ?
-key: Namen 15
- decomp: *
- reasmb: goto Name
-key: Name 15
- decomp: *
- reasmb: Namen interessieren mich nicht.
- reasmb: Ich habe dir schon gesagt, daß Namen mich nicht interessieren. Sprich bitte weiter!
-key: English 0
- decomp: *
- reasmb: goto xfremd
- reasmb: Ich habe dir schon gesagt, ich verstehe Englisch nicht.
-key: francais 0
- decomp: *
- reasmb: goto xfremd
- reasmb: Ich habe dir schon gesagt, ich verstehe Französisch nicht.
-key: italiano 0
- decomp: *
- reasmb: goto xfremd
- reasmb: Ich habe dir schon gesagt, ich verstehe Italianisch nicht.
-key: espanol 0
- decomp: *
- reasmb: goto xfremd
- reasmb: Ich habe dir schon gesagt, ich verstehe Spanisch nicht.
-key: xfremd 0
- decomp: *
- reasmb: Ich spreche nur Deutsch.
-key: hello 0
- decomp: *
- reasmb: Freut mich. Erzähl mir dein Problem!
- reasmb: Hallo. Was hast du denn?
-key: Computer 50
- decomp: *
- reasmb: Machen dir Computer Sorgen ?
- reasmb: Warum hast du Computer erwähnt ?
- reasmb: Was haben Maschinen mit deinem Problem zu tun, deiner Meinung nach ?
- reasmb: Glaubst du nicht, daß Computer Leuten helfen können ?
- reasmb: Was stört dich an Maschinen ?
- reasmb: Was hältst du von Maschinen ?
- reasmb: Du glaubst nicht, daß ich ein Computerprogramm bin, nicht wahr ?
-key: hi 0
- decomp: * hi *
- reasmb: goto hello
-key: hallo 0
- decomp: * hallo *
- reasmb: goto hello
-key: bin 0
- decomp: * bin ich *
- reasmb: Glaubst du, du bist (2) ?
- reasmb: Möchtest du (2) sein ?
- reasmb: Möchtest du, daß ich dir sage, du bist (2) ?
- reasmb: Was würde es dir bedeuten, wenn du (2) wärest ?
- reasmb: goto was
- decomp: * ich bin *
- reasmb: goto ich
- decomp: *
- reasmb: Warum sagst du 'bin' ?
- reasmb: Ich verstehe das nicht.
-key: bist 0
- decomp: * bist du *
- reasmb: Warum interessiert es dich, ob ich (2) bin oder nicht ?
- reasmb: Hättest du es lieber, wenn ich nicht (2) wäre ?
- reasmb: Vielleicht bin ich (2) in deinen Fantasien.
- reasmb: Glaubst du manchmal, ich bin (2) ?
- reasmb: goto was
- reasmb: Würde das dir etwas ausmachen ?
- reasmb: Was ist, wenn ich (2) wäre ?
- decomp: * du bist *
- reasmb: goto du
-key: sind 0
- decomp: * sind *
- reasmb: Glaubst du, daß sie vielleicht nicht (2) sind ?
- reasmb: Würdest du dich freuen, wenn sie nicht (2) wären ?
- reasmb: Was ist, wenn sie nicht (2) wären ?
- reasmb: Sind sie immer (2) ?
- reasmb: Möglicherwiese sind sie doch (2).
- reasmb: Bist du überzeugt, sie sind (2) ?
-key: deine 0
- decomp: * deine *
- reasmb: Warum bist du beunruhigt über meine (2) ?
- reasmb: Wie ist es mit deiner eigenen (2) ?
- reasmb: Bist du besorgt wegen jemands anderen (2) ?
- reasmb: Wirklich, meine (2) ?
- reasmb: Warum denkst du an meine (2) ?
- reasmb: Willst du meine (2) ?
-key: dein 0
- decomp: * dein *
- reasmb: Warum bist du beunruhigt über mein (2) ?
- reasmb: Wie ist es mit deinem eigenen (2) ?
- reasmb: Bist du besorgt wegen jemandes anderen (2) ?
- reasmb: Wirklich, mein (2) ?
- reasmb: Warum denkst du an mein (2) ?
- reasmb: Willst du mein (2) ?
-key: war 2
- decomp: * war ich *
- reasmb: Was ist, wenn du (2) wärest ?
- reasmb: Glaubst du, daß du (2) warst ?
- reasmb: Warst du (2) ?
- reasmb: Was würde es dir bedeuten, wenn du (2) wärest ?
- reasmb: Was bedeutet dir eigentlich ' (2) ' ?
- reasmb: goto was
- decomp: * ich war *
- reasmb: Warst du wirklich (2) ?
- reasmb: Warum sagst du mir jetzt, daß du (2) warst ?
- reasmb: Vielleicht weiß ich schon, daß du (2) warst.
-key: warst 2
- decomp: * warst du nicht *
- reasmb: Vielleicht war ich doch (2).
- decomp: * warst du *
- reasmb: Möchtest du glauben, daß ich (2) war?
- reasmb: Was deutet darauf hin, daß ich (2) war ?
- reasmb: Was glaubst du daran ?
- reasmb: Was ist, wenn ich (2) gewesen wäre ?
-key: mir 0
- decomp: * mir ist *
- reasmb: Warum ist dir (2) ?
- reasmb: Bist du zu mir gekommen, weil dir (2) ist ?
-key: ich 0
- decomp: * ich @moechte *
- reasmb: Was würde es dir bedeuten, wenn du diesen Wunsch realisieren würdest ?
- reasmb: Warum willst du das ?
- reasmb: Stell dir mal vor, dein Wunsch wird bald Wirklichkeit.
- reasmb: Was ist, wenn dieser Wunsch sich nie realisieren läßt ?
- reasmb: Was hat dieser Wunsch mit unserem Gespräch zu tun ?
- decomp: * ich bin * @traurig *
- reasmb: Es tut mir Leid zu hören, daß du (3) bist.
- reasmb: Glaubst du, hierhin zu kommen wird dir helfen, nicht (3) zu sein ?
- reasmb: Es ist bestimmt nicht angenehm, (3) zu sein.
- reasmb: Kannst du erzählen, was dich (3) gemacht hat ?
- decomp: * ich bin * @gluecklich *
- reasmb: Inwiefern habe ich dir geholfen, (3) zu sein ?
- reasmb: Hat dich deine Behandlung (3) gemacht ?
- reasmb: Was machst du (3) gerade ?
- reasmb: Kannst du mir erzählen, warum du gerade (3) bist?
- decomp: * ich war *
- reasmb: goto war
- decomp: * ich @glaube *
- reasmb: Glaubst du das wirklich ?
- reasmb: Aber du bist nicht sicher (3).
- reasmb: Bezweifelst du wirklich, (3) ?
- decomp: * ich* @glaube * du *
- reasmb: goto du
- decomp: * ich bin *
- reasmb: Bist du zu mir gekommen, weil du (2) bist ?
- reasmb: Seit wann bist du so ?
- reasmb: Glaubst du, es ist normal, (2) zu sein ?
- reasmb: Macht es dir Spaß, (2) zu sein ?
- reasmb: Kennst du noch jemanden, der (2) ist ?
- decomp: * ich kann * nicht *
- reasmb: Woher weißt du, daß du (2) nicht (3) kannst ?
- reasmb: Hast du es schon versucht ?
- reasmb: Vielleicht kannst du jetzt (3).
- reasmb: Willst du wirklich (2) (3) können ?
- reasmb: Was ist, wenn du (2) (3) könntest ?
- decomp: * ich fühle mich *
- reasmb: Sprich weiter über diese Gefühle.
- reasmb: Wie häufig fühlst du dich (2) ?
- reasmb: Fühlst du dich (2) gerne ?
- reasmb: An welches Gefühl erinnert dich dieses (2) fühlen ?
- decomp: *
- reasmb: (1) ?
- reasmb: Warum sagst du, (1) ?
- reasmb: Kannst du das nicht etwas erläutern ?
- reasmb: Sagst du das aus irgendeinem speziellen Grund ?
- reasmb: Das ist ja interessant.
- reasmb: Aha.
-key: du 0
- decomp: * du erinnerst mich an *
- reasmb: goto ähnlich
- decomp: * du bist *
- reasmb: Warum glaubst du, daß ich (2) bin ?
- reasmb: Gefällt es dir zu glauben, ich bin (2) ?
- reasmb: Träumst du manchmal, daß du (2) bist ?
- reasmb: Vielleicht möchtest du (2) sein.
- decomp: * du *
- reasmb: Wir reden über dich, nicht über mich.
- reasmb: Wirklich, ich (2) ?
- reasmb: Du sprichst nicht über mich in Wirklichkeit, nicht wahr ?
- reasmb: Welche Gefühle hast du jetzt ?
-key: ja 0
- decomp: *
- reasmb: Erzähl mir bitte mehr!
- reasmb: Kannst du das nicht etwas erläutern ?
- reasmb: So ist das also.
- reasmb: Ich verstehe.
-key: nein 0
- decomp: *
- reasmb: Sagst du nein, nur um negativ zu sein ?
- reasmb: Macht dich das unglücklich ?
- reasmb: Warum nicht ?
- reasmb: Wieso "nein" ?
-key: meine 2
- decomp: * meine* @Familie *
- reasmb: Erzähl mir mehr über deine Familie.
- reasmb: Wer noch in deiner Familie (4) ?
- reasmb: Deine (3) ?
- reasmb: Was fällt dir noch ein, wenn du an deine (3) denkst ?
- reasm_for_memory: Hat das etwas mit deiner (2) zu tun ?
- decomp: * meine *
- reasmb: Deine (2) ?
- reasmb: Warum sagst du, deine (2) ?
- reasmb: Deutet das noch auf etwas hin, das dir gehört ?
- reasmb: Ist das dir wichtig -- deine (2) ?
- reasm_for_memory: Besprechen wir weiter warum deine (2).
- reasm_for_memory: Früher hast du deine (2) erwähnt.
- reasm_for_memory: Aber deine (2).
-key: mein 2
- decomp: * mein* @Familie-m *
- reasmb: Erzähl mir mehr über deine Familie.
- reasmb: Wer noch in deiner Familie (4) ?
- reasmb: Dein (3) ?
- reasm_for_memory: Hat das etwas mit deinem (2) zu tun ?
- decomp: * mein *
- reasmb: Dein (2) ?
- reasmb: Warum sagst du, dein (2) ?
- reasmb: Deutet das noch auf etwas hin, das dir gehört ?
- reasmb: Ist das dir wichtig -- dein (2) ?
- reasm_for_memory: Besprechen wir weiter warum dein (2).
- reasm_for_memory: Früher hast du dein (2) erwähnt.
- reasm_for_memory: Aber dein (2).
-key: kannst 0
- decomp: * kannst du *
- reasmb: Du glaubst, daß ich (2) kann, nicht wahr ?
- reasmb: goto was
- reasmb: Du willst, daß ich (2) kann ?
- reasmb: Vielleicht möchtest du selber (2).
-key: kann 0
- decomp: * kann ich *
- reasmb: Ob du (2) kannst, hängt mehr von dir als von mir ab.
- reasmb: Willst du (2) können ?
- reasmb: Vielleich willst du nicht (2).
- reasmb: goto was
-key: was 0
- decomp: *
- reasmb: Warum fragst du das ?
- reasmb: Interessiert dich diese Frage ?
- reasmb: Was willst du wirklich wissen ?
- reasmb: Beschäftigen dich diese Fragen ?
- reasmb: Welche Antwort würde dir am meisten gefallen ?
- reasmb: Was denkst du ?
- reasmb: Was noch kommt dir in die Gedanken, wenn du daran denkst ?
- reasmb: Hast du solche Fragen schon früher gefragt ?
- reasmb: Hast du schon jemanden anderen gefragt ?
-key: wer 0
- decomp: who *
- reasmb: goto was
-key: wann 0
- decomp: when *
- reasmb: goto was
-key: wo 0
- decomp: where *
- reasmb: goto was
-key: wie 0
- decomp: how *
- reasmb: goto was
-key: denn 0
- decomp: *
- reasmb: Ist das der echte Grund ?
- reasmb: Fallen dir keine anderen Gründe ein ?
- reasmb: Erklärt dieser Grund etwas anderes ?
- reasmb: Welche andere Gründe könnte es noch geben ?
-key: warum 0
- decomp: * warum hast du nicht *
- reasmb: Glaubst du, daß ich nicht (2) habe ?
- reasmb: Vielleicht habe ich doch (2).
- reasmb: Hast du (2) ?
- reasmb: goto was
- decomp: * warum kann ich nicht *
- reasmb: Glaubst du, du solltest die Fähigkeit haben, (2) ?
- reasmb: Willst du die Fähigkeit haben, (2) ?
- reasmb: Glaubst du, daß das dir dabei hilft, (2) ?
- reasmb: Hast du eine Idee, warum du nicht (2) kannst ?
- reasmb: goto was
- decomp: *
- reasmb: goto was
-key: jeder 2
- decomp: * @jeder *
- reasmb: Wirklich, (2) ?
- reasmb: Bestimmt nicht (2).
- reasmb: Kannst du an jemanden besonderen denken ?
- reasmb: Wer, zum Beispiel?
- reasmb: Denkst du an eine ganz spezielle Person ?
- reasmb: Wer, wenn ich fragen darf ?
- reasmb: Vielleicht jemand spezielles ?
- reasmb: Du denkst an eine bestimmte Person, nicht wahr ?
- reasmb: Über wen sprichst du, deiner Meinung nach?
-key: niemand 2
- decomp: * niemand *
- reasmb: Bist du sicher, daß niemand (2) ?
- reasmb: Nein, bestimmt niemand (2) .
- reasmb: Kannst du an irgendjemanden denken ?
- reasmb: Denkst du an eine ganz spezielle Person ?
- reasmb: Wer, wenn ich fragen darf ?
- reasmb: Eigentlich denkst du an eine bestimmte Person, nicht wahr ?
- reasmb: An wen denkst du wirklich ?
-key: immer 1
- decomp: *
- reasmb: Kannst du ein Beispiel nennen ?
- reasmb: Wann ?
- reasmb: An welchen Vorfall denkst du ?
- reasmb: Wirklich immer ?
-key: ähnlich 10
- decomp: *
- reasmb: Inwiefern ?
- reasmb: Welche Ähnlichkeit siehst du ?
- reasmb: Worauf deutet diese Ähnlichkeit hin ?
- reasmb: Welche Ähnlichkeit siehst du noch ?
- reasmb: Welche Verbindung, meinst du, gibt es?
- reasmb: Könnte es wirklich irgendwelche Verbindung geben ?
-key: anders 0
- decomp: *
- reasmb: Inwiefern ist es anders ?
- reasmb: Welchen Unterschied siehst du ?
- reasmb: Worauf deutet dieser Unterschied hin ?
- reasmb: Welche Unterscheidung siehst du noch ?
- reasmb: Was bedeutet diese Ungleichheit ?
- reasmb: Glaubst du, es könnte irgendwelche Verbindung geben ?
- reasmb: Inwiefern ?
@@ -0,0 +1,12 @@
+name = Chatbot-Eliza
+author = John Nolan <jpnolan@sonic.net>
+license = Perl_5
+copyright_holder = John Nolan
+copyright_year = 2003
+
+version = 1.05
+
+[@Basic]
+[PkgVersion]
+[AutoPrereqs]
+[GithubMeta]
@@ -1,479 +0,0 @@
-####################################################################
-# ---{ B E G I N D E F A U L T S C R I P T D A T A }----------
-#
-# This script was prepared by Chris Hayden. Hayden's Eliza
-# program was written in Java, however, it attempted to match
-# the functionality of Weizenbaum's original program as closely
-# as possible.
-#
-# Hayden's script format was quite different from Weizenbaum's,
-# but it maintained the same content. I have adapted Hayden's
-# script format, since it was simple and convenient enough
-# for my purposes.
-#
-# I've made small modifications here and there.
-#
-#
-#
-initial: How do you do. Please tell me your problem.
-initial: Hello, I am a computer program.
-initial: Please tell me what's been bothering you.
-initial: Is something troubling you?
-final: Goodbye. It was nice talking to you.
-final: Goodbye. I hope you found this session helpful.
-final: I think you should talk to a REAL analyst. Ciao!
-final: Life is tough. Hang in there!
-quit: bye
-quit: goodbye
-quit: done
-quit: exit
-quit: quit
-pre: dont don't
-pre: cant can't
-pre: wont won't
-pre: recollect remember
-pre: recall remember
-pre: dreamt dreamed
-pre: dreams dream
-pre: maybe perhaps
-pre: certainly yes
-pre: machine computer
-pre: machines computer
-pre: computers computer
-post: am are
-post: your my
-post: yours mine
-pre: were was
-post: me you
-pre: you're you are
-pre: i'm i am
-post: myself yourself
-post: yourself myself
-post: i you
-post: you me
-post: my your
-post: me you
-post: i'm you are
-pre: same alike
-pre: identical alike
-pre: equivalent alike
-synon: belief feel think believe wish
-synon: family mother mom father dad sister brother wife children child
-synon: desire want need
-synon: sad unhappy depressed sick
-synon: happy elated glad better
-synon: cannot can't
-synon: everyone everybody nobody noone
-synon: be am is are was
-key: xnone -1
- decomp: *
- reasmb: I'm not sure I understand you fully.
- reasmb: Please go on.
- reasmb: That is interesting. Please continue.
- reasmb: Tell me more about that.
- reasmb: Does talking about this bother you ?
-key: sorry 0
- decomp: *
- reasmb: Please don't apologise.
- reasmb: Apologies are not necessary.
- reasmb: I've told you that apologies are not required.
- reasmb: It did not bother me. Please continue.
-key: apologise 0
- decomp: *
- reasmb: goto sorry
-key: remember 5
- decomp: * i remember *
- reasmb: Do you often think of (2) ?
- reasmb: Does thinking of (2) bring anything else to mind ?
- reasmb: What else do you recollect ?
- reasmb: Why do you remember (2) just now ?
- reasmb: What in the present situation reminds you of (2) ?
- reasmb: What is the connection between me and (2) ?
- reasmb: What else does (2) remind you of ?
- decomp: * do you remember *
- reasmb: Did you think I would forget (2) ?
- reasmb: Why do you think I should recall (2) now ?
- reasmb: What about (2) ?
- reasmb: goto what
- reasmb: You mentioned (2) ?
- decomp: * you remember *
- reasmb: How could I forget (2) ?
- reasmb: What about (2) should I remember ?
- reasmb: goto you
-key: forget 5
- decomp: * i forget *
- reasmb: Can you think of why you might forget (2) ?
- reasmb: Why can't you remember (2) ?
- reasmb: How often do you think of (2) ?
- reasmb: Does it bother you to forget that ?
- reasmb: Could it be a mental block ?
- reasmb: Are you generally forgetful ?
- reasmb: Do you think you are suppressing (2) ?
- decomp: * did you forget *
- reasmb: Why do you ask ?
- reasmb: Are you sure you told me ?
- reasmb: Would it bother you if I forgot (2) ?
- reasmb: Why should I recall (2) just now ?
- reasmb: goto what
- reasmb: Tell me more about (2).
-key: if 3
- decomp: * if *
- reasmb: Do you think its likely that (2) ?
- reasmb: Do you wish that (2) ?
- reasmb: What do you know about (2) ?
- reasmb: Really, if (2) ?
- reasmb: What would you do if (2) ?
- reasmb: But what are the chances that (2) ?
- reasmb: What does this speculation lead to ?
-key: dreamed 4
- decomp: * i dreamed *
- reasmb: Really, (2) ?
- reasmb: Have you ever fantasized (2) while you were awake ?
- reasmb: Have you ever dreamed (2) before ?
- reasmb: goto dream
-key: dream 3
- decomp: *
- reasmb: What does that dream suggest to you ?
- reasmb: Do you dream often ?
- reasmb: What persons appear in your dreams ?
- reasmb: Do you believe that dreams have something to do with your problem ?
-key: perhaps 0
- decomp: *
- reasmb: You don't seem quite certain.
- reasmb: Why the uncertain tone ?
- reasmb: Can't you be more positive ?
- reasmb: You aren't sure ?
- reasmb: Don't you know ?
- reasmb: How likely, would you estimate ?
-key: name 15
- decomp: *
- reasmb: I am not interested in names.
- reasmb: I've told you before, I don't care about names -- please continue.
-key: deutsch 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand German.
-key: francais 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand French.
-key: italiano 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Italian.
-key: espanol 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Spanish.
-key: xfremd 0
- decomp: *
- reasmb: I speak only English.
-key: hello 0
- decomp: *
- reasmb: How do you do. Please state your problem.
- reasmb: Hi. What seems to be your problem ?
-key: computer 50
- decomp: *
- reasmb: Do computers worry you ?
- reasmb: Why do you mention computers ?
- reasmb: What do you think machines have to do with your problem ?
- reasmb: Don't you think computers can help people ?
- reasmb: What about machines worries you ?
- reasmb: What do you think about machines ?
-key: am 0
- decomp: * am i *
- reasmb: Do you believe you are (2) ?
- reasmb: Would you want to be (2) ?
- reasmb: Do you wish I would tell you you are (2) ?
- reasmb: What would it mean if you were (2) ?
- reasmb: goto what
- decomp: * i am *
- reasmb: goto i
- decomp: *
- reasmb: Why do you say 'am' ?
- reasmb: I don't understand that.
-key: are 0
- decomp: * are you *
- reasmb: Why are you interested in whether I am (2) or not ?
- reasmb: Would you prefer if I weren't (2) ?
- reasmb: Perhaps I am (2) in your fantasies.
- reasmb: Do you sometimes think I am (2) ?
- reasmb: goto what
- reasmb: Would it matter to you ?
- reasmb: What if I were (2) ?
- decomp: * you are *
- reasmb: goto you
- decomp: * are *
- reasmb: Did you think they might not be (2) ?
- reasmb: Would you like it if they were not (2) ?
- reasmb: What if they were not (2) ?
- reasmb: Are they always (2) ?
- reasmb: Possibly they are (2).
- reasmb: Are you positive they are (2) ?
-key: your 0
- decomp: * your *
- reasmb: Why are you concerned over my (2) ?
- reasmb: What about your own (2) ?
- reasmb: Are you worried about someone else's (2) ?
- reasmb: Really, my (2) ?
- reasmb: What makes you think of my (2) ?
- reasmb: Do you want my (2) ?
-key: was 2
- decomp: * was i *
- reasmb: What if you were (2) ?
- reasmb: Do you think you were (2) ?
- reasmb: Were you (2) ?
- reasmb: What would it mean if you were (2) ?
- reasmb: What does ' (2) ' suggest to you ?
- reasmb: goto what
- decomp: * i was *
- reasmb: Were you really ?
- reasmb: Why do you tell me you were (2) now ?
- reasmb: Perhaps I already know you were (2).
- decomp: * was you *
- reasmb: Would you like to believe I was (2) ?
- reasmb: What suggests that I was (2) ?
- reasmb: What do you think ?
- reasmb: Perhaps I was (2).
- reasmb: What if I had been (2) ?
-key: i 0
- decomp: * i @desire *
- reasmb: What would it mean to you if you got (3) ?
- reasmb: Why do you want (3) ?
- reasmb: Suppose you got (3) soon.
- reasmb: What if you never got (3) ?
- reasmb: What would getting (3) mean to you ?
- reasmb: What does wanting (3) have to do with this discussion ?
- decomp: * i am* @sad *
- reasmb: I am sorry to hear that you are (3).
- reasmb: Do you think coming here will help you not to be (3) ?
- reasmb: I'm sure it's not pleasant to be (3).
- reasmb: Can you explain what made you (3) ?
- decomp: * i am* @happy *
- reasmb: How have I helped you to be (3) ?
- reasmb: Has your treatment made you (3) ?
- reasmb: What makes you (3) just now ?
- reasmb: Can you explain why you are suddenly (3) ?
- decomp: * i was *
- reasmb: goto was
- decomp: * i @belief i *
- reasmb: Do you really think so ?
- reasmb: But you are not sure you (3).
- reasmb: Do you really doubt you (3) ?
- decomp: * i* @belief *you *
- reasmb: goto you
- decomp: * i am *
- reasmb: Is it because you are (2) that you came to me ?
- reasmb: How long have you been (2) ?
- reasmb: Do you believe it is normal to be (2) ?
- reasmb: Do you enjoy being (2) ?
- reasmb: Do you know anyone else who is (2) ?
- decomp: * i @cannot *
- reasmb: How do you know that you can't (3) ?
- reasmb: Have you tried ?
- reasmb: Perhaps you could (3) now.
- reasmb: Do you really want to be able to (3) ?
- reasmb: What if you could (3) ?
- decomp: * i don't *
- reasmb: Don't you really (2) ?
- reasmb: Why don't you (2) ?
- reasmb: Do you wish to be able to (2) ?
- reasmb: Does that trouble you ?
- decomp: * i feel *
- reasmb: Tell me more about such feelings.
- reasmb: Do you often feel (2) ?
- reasmb: Do you enjoy feeling (2) ?
- reasmb: Of what does feeling (2) remind you ?
- decomp: * i * you *
- reasmb: Perhaps in your fantasies we (2) each other.
- reasmb: Do you wish to (2) me ?
- reasmb: You seem to need to (2) me.
- reasmb: Do you (2) anyone else ?
- decomp: *
- reasmb: You say (1) ?
- reasmb: Why do you say (1) ?
- reasmb: Can you elaborate on that ?
- reasmb: Do you say (1) for some special reason ?
- reasmb: That's quite interesting.
-key: you 0
- decomp: * you remind me of *
- reasmb: goto alike
- decomp: * you are *
- reasmb: What makes you think I am (2) ?
- reasmb: Does it please you to believe I am (2) ?
- reasmb: Do you sometimes wish you were (2) ?
- reasmb: Perhaps you would like to be (2).
- decomp: * you* me *
- reasmb: Why do you think I (2) you ?
- reasmb: You like to think I (2) you -- don't you ?
- reasmb: What makes you think I (2) you ?
- reasmb: Really, I (2) you ?
- reasmb: Do you wish to believe I (2) you ?
- reasmb: Suppose I did (2) you -- what would that mean ?
- reasmb: Does someone else believe I (2) you ?
- decomp: * you *
- reasmb: We were discussing you -- not me.
- reasmb: Oh, I (2) ?
- reasmb: You're not really talking about me -- are you ?
- reasmb: What are your feelings now ?
-key: yes 0
- decomp: *
- reasmb: Please go on.
- reasmb: Please tell me some more about this.
- reasmb: Why don't you tell me a little more about this.
- reasmb: I see.
- reasmb: I understand.
-key: no 0
- decomp: * no one *
- reasmb: Are you sure, no one (2) ?
- reasmb: Surely someone (2) .
- reasmb: Can you think of anyone at all ?
- reasmb: Are you thinking of a very special person ?
- reasmb: Who, may I ask ?
- reasmb: You have a particular person in mind, don't you ?
- reasmb: Who do you think you are talking about ?
- decomp: *
- reasmb: Are you saying no just to be negative?
- reasmb: Does this make you feel unhappy?
- reasmb: Why not ?
- reasmb: Why 'no' ?
-key: my 2
- decomp: * my* @family *
- reasmb: Tell me more about your family.
- reasmb: Who else in your family (4) ?
- reasmb: Your (3) ?
- reasmb: What else comes to mind when you think of your (3) ?
- decomp: * my *
- reasmb: Your (2) ?
- reasmb: Why do you say your (2) ?
- reasmb: Does that suggest anything else which belongs to you ?
- reasmb: Is it important to you that your (2) ?
- reasm_for_memory: Let's discuss further why your (2).
- reasm_for_memory: Earlier you said your (2).
- reasm_for_memory: But your (2).
- reasm_for_memory: Does that have anything to do with the fact that your (2) ?
-key: can 0
- decomp: * can you *
- reasmb: You believe I can (2) don't you ?
- reasmb: goto what
- reasmb: You want me to be able to (2).
- reasmb: Perhaps you would like to be able to (2) yourself.
- decomp: * can i *
- reasmb: Whether or not you can (2) depends on you more than on me.
- reasmb: Do you want to be able to (2) ?
- reasmb: Perhaps you don't want to (2).
- reasmb: goto what
-key: what 0
- decomp: *
- reasmb: Why do you ask ?
- reasmb: Does that question interest you ?
- reasmb: What is it you really want to know ?
- reasmb: Are such questions much on your mind ?
- reasmb: What answer would please you most ?
- reasmb: What do you think ?
- reasmb: What comes to mind when you ask that ?
- reasmb: Have you asked such questions before ?
- reasmb: Have you asked anyone else ?
-key: who 0
- decomp: who *
- reasmb: goto what
-key: when 0
- decomp: when *
- reasmb: goto what
-key: where 0
- decomp: where *
- reasmb: goto what
-key: how 0
- decomp: how *
- reasmb: goto what
-key: because 0
- decomp: *
- reasmb: Is that the real reason ?
- reasmb: Don't any other reasons come to mind ?
- reasmb: Does that reason seem to explain anything else ?
- reasmb: What other reasons might there be ?
-key: why 0
- decomp: * why don't you *
- reasmb: Do you believe I don't (2) ?
- reasmb: Perhaps I will (2) in good time.
- reasmb: Should you (2) yourself ?
- reasmb: You want me to (2) ?
- reasmb: goto what
- decomp: * why can't i *
- reasmb: Do you think you should be able to (2) ?
- reasmb: Do you want to be able to (2) ?
- reasmb: Do you believe this will help you to (2) ?
- reasmb: Have you any idea why you can't (2) ?
- reasmb: goto what
- decomp: *
- reasmb: goto what
-key: everyone 2
- decomp: * @everyone *
- reasmb: Really, (2) ?
- reasmb: Surely not (2).
- reasmb: Can you think of anyone in particular ?
- reasmb: Who, for example?
- reasmb: Are you thinking of a very special person ?
- reasmb: Who, may I ask ?
- reasmb: Someone special perhaps ?
- reasmb: You have a particular person in mind, don't you ?
- reasmb: Who do you think you're talking about ?
-key: everybody 2
- decomp: *
- reasmb: goto everyone
-key: nobody 2
- decomp: *
- reasmb: goto everyone
-key: noone 2
- decomp: *
- reasmb: goto everyone
-key: always 1
- decomp: *
- reasmb: Can you think of a specific example ?
- reasmb: When ?
- reasmb: What incident are you thinking of ?
- reasmb: Really, always ?
-key: alike 10
- decomp: *
- reasmb: In what way ?
- reasmb: What resemblence do you see ?
- reasmb: What does that similarity suggest to you ?
- reasmb: What do you suppose that resemblence means ?
- reasmb: What is the connection, do you suppose ?
- reasmb: Could there really be some connection ?
- reasmb: How ?
-key: like 10
- decomp: * @be *like *
- reasmb: goto alike
-key: different 0
- decomp: *
- reasmb: How is it different ?
- reasmb: What differences do you see ?
- reasmb: What does that difference suggest to you ?
- reasmb: What other distinctions do you see ?
- reasmb: What do you suppose that disparity means ?
- reasmb: Could there be some connection, do you suppose ?
- reasmb: How ?
-key: fuck 10
- decomp: *
- reasmb: goto xswear
-key: fucker 10
- decomp: *
- reasmb: goto xswear
-key: shit 10
- decomp: *
- reasmb: goto xswear
-key: damn 10
- decomp: *
- reasmb: goto xswear
-key: shut 10
- decomp: * shut up *
- reasmb: goto xswear
-key: xswear 10
- decomp: *
- reasmb: Does it make you feel strong to use that kind of language ?
- reasmb: Are you venting your feelings now ?
- reasmb: Are you angry ?
- reasmb: Does this topic make you feel angry ?
- reasmb: Is something making you feel angry ?
- reasmb: Does using that kind of language make you feel better ?
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+
+# This script implements a Chatbot::Eliza object
+# in a cgi program. It uses the CGI.pm module
+# written by Lincoln Stein.
+#
+# It also prints out the debugging output available
+# in the Eliza chatbot module.
+#
+# 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');
+}
+
+$comment = $cgi->param('Comment');
+$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');
+
+print $cgi->endform;
+print $cgi->hr;
+
+print $cgi->h2('Debugging Output');
+print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
+
+print $cgi->end_html;
+
@@ -0,0 +1,14 @@
+#!/usr/bin/perl -w
+
+use Chatbot::Eliza;
+
+# This little script tests the German-language
+# version of the "doctor" script.
+
+# seed the random number generator
+srand( time ^ ($$ + ($$ << 15)) );
+
+$chatbot = new Chatbot::Eliza "Hans", "deutsch.txt";
+##$chatbot->debug(1);
+$chatbot->command_interface();
+
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+# This script implements a Chatbot::Eliza object
+# in a cgi program. It uses the CGI.pm module
+# written by Lincoln Stein.
+#
+# It makes use of a German-language "Doctor" script.
+#
+# It also prints out the debugging output available
+# in the Eliza chatbot module.
+#
+# 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.
+#
+# The German-language script must also be available
+# to this script.
+#
+# 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 "Eliza", "deutsch.txt";
+
+srand( time ^ ($$ + ($$ << 15)) ); # seed the random number generator
+
+print $cgi->header;
+print $cgi->start_html;
+print $cgi->start_multipart_form;
+print $cgi->h2('Eliza Sitzung');
+
+# 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');
+}
+
+$comment = $cgi->param('Comment');
+$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');
+
+print $cgi->endform;
+print $cgi->hr;
+
+print $cgi->h2('Debugging Output');
+print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
+
+print $cgi->end_html;
+
@@ -0,0 +1,504 @@
+####################################################################
+#
+# This script is meant to be a close translation of the original "doctor"
+# script by Weizenbaum. Obviously, an exact translation is not possible.
+# German word order, as well as the conjugation of verbs, renders
+# many of the original English rules flatly unworkable in German.
+# However, many of the rules do pretty work well, and German offers
+# opportunities for at least few new ones of its own (e.g., "mir ist *").
+#
+# Prepared by John Nolan and Matthias Hellmund.
+#
+#
+initial: Freut mich. Erzähl mir dein Problem!
+initial: Hallo, ich bin Rechnerprogram.
+initial: Sag mir bitte, was dich stört.
+initial: Was hast du denn?
+final: Ciao. War nett mit dir zu reden. Bis dann.
+final: Tschüß! Hoffentlich hast du diese Sitzung hilfreich gefunden.
+final: Ich glaube, du solltest mit einem ECTHEN Analytiker sprechen. Ciao!
+final: Das Leben ist schwer. Bleib am Ball!
+quit: exit
+quit: quit
+quit: ende
+quit: Tschüß
+quit: ciao
+quit: tschuess
+quit: bye
+quit: goodbye
+pre: erinnere erinnre
+pre: Träume Traum
+pre: wieso warum
+pre: weshalb warum
+pre: hab habe
+pre: meins meines
+pre: deins deines
+pre: dus du es
+pre: du's du es
+pre: Machine Computer
+pre: Machines Computer
+pre: Machinen Computer
+pre: Computers Computer
+pre: Rechner Computer
+post: ich du
+post: du ich
+post: dich mich
+post: mich dich
+post: dir mir
+post: mir dir
+post: dein mein
+post: deine meine
+post: deiner meiner
+post: deinen meinen
+post: deines meines
+post: mein dein
+post: meiner deiner
+post: meines deines
+post: meinen deinen
+post: meine deine
+post: bin bist
+post: bist bin
+post: warst war
+post: war warst
+post: will willst
+post: willst will
+post: mochte mochtest
+post: mochtest mochte
+post: möchte möchtest
+post: möchtest möchte
+post: werde wirst
+post: wirst werde
+post: darfst darf
+post: darf darfst
+post: hast habe
+post: habe hast
+post: hatte hattest
+post: hattest hatte
+post: hätte hättest
+post: hättest hätte
+post: mag magst
+post: magst mag
+post: soll sollst
+post: sollst soll
+post: solltest sollte
+post: sollte solltest
+post: könnte könntest
+post: könntest könnte
+post: konnte konntest
+post: konntest konnte
+post: mußt muß
+post: muß mußt
+post: muss mußt
+post: musst muß
+pre: gleich ähnlich
+pre: identisch ähnlich
+pre: dasselbe ähnlich
+synon: glaube glauben finde finden wünsche wünschen
+synon: Familie Mutter Mutti Schwester Kinder
+synon: Familie-m Vater Vati Bruder Kind
+synon: moechte möchte will brauche
+synon: sicher bestimmt natürlich
+synon: traurig deprimiert unglücklich unzufrieden krank
+synon: gluecklich glücklich zufrieden froh besser
+synon: jeder jederman jedes jede
+synon: sein bin ist sind seid
+key: xnone -1
+ decomp: *
+ reasmb: Ich bin nicht sicher, ob ich dich verstanden habe.
+ reasmb: Erzähl mir weiter.
+ reasmb: Das ist ja interessant. Sprich bitte weiter.
+ reasmb: Kannst du das nicht etwas erläutern ?
+ reasmb: Stört es dich, daß wir über dieses Thema sprechen ?
+key: Leid 0
+ decomp: * tut mir Leid *
+ reasmb: Bitte entschuldige dich nicht!
+ reasmb: Es ist nicht notwendig, sich zu entschuldigen.
+ reasmb: Ich habe dir schon gesagt, es ist nicht notwendig, sich zu entschuldigen.
+ reasmb: Es hat mich nicht gestört. Sprich bitte weiter.
+key: entschuldige 0
+ decomp: *
+ reasmb: goto Leid
+key: entschuldigen 0
+ decomp: *
+ reasmb: goto Leid
+key: erinnere 5
+ decomp: * ich erinnere mich an *
+ reasmb: Denkst du häufig an (2) ?
+ reasmb: Fällt dir noch etwas ein, wenn du an (2) denkst ?
+ reasmb: Woran erinnerst du dich noch ?
+ reasmb: Warum erinnerst du dich jetzt gerade an (2)?
+ reasmb: Was in der jetzigen Situation erinnert dich an (2) ?
+ reasmb: Welche Verbindung gibt es zwischen mir und (2) ?
+ reasmb: Woran erinnert dich (2) noch?
+key: erinnerst 5
+ decomp: * erinnerst du dich * an *
+ reasmb: Meinst du, ich würde (3) vergessen ?
+ reasmb: Warum glaubst du, ich sollte mich an (3) erinnern ?
+ reasmb: Wie ist es mit (3) ?
+ reasmb: goto was
+ reasm_for_memory: Du hast (3) erwähnt.
+ decomp: * du erinnerst dich an *
+ reasmb: Wie könnte ich (2) vergessen ?
+ reasmb: What about (2) should I remember ?
+ reasmb: goto du
+key: vergessen 5
+ decomp: * ich habe * vergessen
+ reasmb: Warum würdest du (2) vergessen ?
+ reasmb: Warum kannst du dich nicht an (2) erinnern ?
+ reasmb: Wie häufig denkst du an (2) ?
+ reasmb: Stört es dich, (2) zu vergessen ?
+ reasmb: Könnte das eine geistige Sperre sein ?
+ reasmb: Bist du vergeßlich im allgemeinen ?
+ reasmb: Glaubst du, du unterdrückst (2) ?
+ decomp: * hast du * vergessen *
+ reasmb: Warum fragst du das ?
+ reasmb: Bist du sicher, daß du mir das gesagt hast ?
+ reasmb: Würde es dich stören, wenn ich (2) vergessen würde ?
+ reasmb: Warum soll ich mich jetzt an (2) erinnern ?
+ reasmb: goto was
+ reasmb: Sprich weiter über (2).
+key: wenn 3
+ decomp: * wenn *
+ reasmb: Glaubst du, es ist möglich, daß (2) ?
+ reasmb: Wünschst du, daß (2) ?
+ reasmb: Was weißt du über (2) ?
+ reasmb: Tatsächlich, wenn (2) ?
+ reasmb: Was würdest du machen, wenn (2) ?
+ reasmb: Aber wieviele Chancen gibt es, daß (2) ?
+key: geträumt 4
+ decomp: * habe * geträumt, daß *
+ reasmb: Wirklich, daß (2) ?
+ reasmb: Hast du schon einmal phantasiert, daß (2), während du wach warst ?
+ reasmb: Hast du früher irgendwann geträumt, daß (2) ?
+ reasmb: goto Traum
+key: Traum 3
+ decomp: *
+ reasmb: Worauf deutet dieser Traum hin ?
+ reasmb: Träumst du oft ?
+ reasmb: Welche Leute stellen sich in deinen Träumen vor ?
+ reasmb: Glaubst du, daß Träume etwas mit deinem Problem zu tun haben ?
+key: vielleicht 0
+ decomp: *
+ reasmb: Du scheinst dir nicht völlig sicher zu sein.
+ reasmb: Warum dieser unsichere Ton ?
+ reasmb: Kannst du nicht positiver sein ?
+ reasmb: Du bist nicht sicher ?
+ reasmb: Weißt du nicht ?
+ reasmb: Wie wahrscheinlich, meinst du, ist es ?
+key: Namen 15
+ decomp: *
+ reasmb: goto Name
+key: Name 15
+ decomp: *
+ reasmb: Namen interessieren mich nicht.
+ reasmb: Ich habe dir schon gesagt, daß Namen mich nicht interessieren. Sprich bitte weiter!
+key: English 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: Ich habe dir schon gesagt, ich verstehe Englisch nicht.
+key: francais 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: Ich habe dir schon gesagt, ich verstehe Französisch nicht.
+key: italiano 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: Ich habe dir schon gesagt, ich verstehe Italianisch nicht.
+key: espanol 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: Ich habe dir schon gesagt, ich verstehe Spanisch nicht.
+key: xfremd 0
+ decomp: *
+ reasmb: Ich spreche nur Deutsch.
+key: hello 0
+ decomp: *
+ reasmb: Freut mich. Erzähl mir dein Problem!
+ reasmb: Hallo. Was hast du denn?
+key: Computer 50
+ decomp: *
+ reasmb: Machen dir Computer Sorgen ?
+ reasmb: Warum hast du Computer erwähnt ?
+ reasmb: Was haben Maschinen mit deinem Problem zu tun, deiner Meinung nach ?
+ reasmb: Glaubst du nicht, daß Computer Leuten helfen können ?
+ reasmb: Was stört dich an Maschinen ?
+ reasmb: Was hältst du von Maschinen ?
+ reasmb: Du glaubst nicht, daß ich ein Computerprogramm bin, nicht wahr ?
+key: hi 0
+ decomp: * hi *
+ reasmb: goto hello
+key: hallo 0
+ decomp: * hallo *
+ reasmb: goto hello
+key: bin 0
+ decomp: * bin ich *
+ reasmb: Glaubst du, du bist (2) ?
+ reasmb: Möchtest du (2) sein ?
+ reasmb: Möchtest du, daß ich dir sage, du bist (2) ?
+ reasmb: Was würde es dir bedeuten, wenn du (2) wärest ?
+ reasmb: goto was
+ decomp: * ich bin *
+ reasmb: goto ich
+ decomp: *
+ reasmb: Warum sagst du 'bin' ?
+ reasmb: Ich verstehe das nicht.
+key: bist 0
+ decomp: * bist du *
+ reasmb: Warum interessiert es dich, ob ich (2) bin oder nicht ?
+ reasmb: Hättest du es lieber, wenn ich nicht (2) wäre ?
+ reasmb: Vielleicht bin ich (2) in deinen Fantasien.
+ reasmb: Glaubst du manchmal, ich bin (2) ?
+ reasmb: goto was
+ reasmb: Würde das dir etwas ausmachen ?
+ reasmb: Was ist, wenn ich (2) wäre ?
+ decomp: * du bist *
+ reasmb: goto du
+key: sind 0
+ decomp: * sind *
+ reasmb: Glaubst du, daß sie vielleicht nicht (2) sind ?
+ reasmb: Würdest du dich freuen, wenn sie nicht (2) wären ?
+ reasmb: Was ist, wenn sie nicht (2) wären ?
+ reasmb: Sind sie immer (2) ?
+ reasmb: Möglicherwiese sind sie doch (2).
+ reasmb: Bist du überzeugt, sie sind (2) ?
+key: deine 0
+ decomp: * deine *
+ reasmb: Warum bist du beunruhigt über meine (2) ?
+ reasmb: Wie ist es mit deiner eigenen (2) ?
+ reasmb: Bist du besorgt wegen jemands anderen (2) ?
+ reasmb: Wirklich, meine (2) ?
+ reasmb: Warum denkst du an meine (2) ?
+ reasmb: Willst du meine (2) ?
+key: dein 0
+ decomp: * dein *
+ reasmb: Warum bist du beunruhigt über mein (2) ?
+ reasmb: Wie ist es mit deinem eigenen (2) ?
+ reasmb: Bist du besorgt wegen jemandes anderen (2) ?
+ reasmb: Wirklich, mein (2) ?
+ reasmb: Warum denkst du an mein (2) ?
+ reasmb: Willst du mein (2) ?
+key: war 2
+ decomp: * war ich *
+ reasmb: Was ist, wenn du (2) wärest ?
+ reasmb: Glaubst du, daß du (2) warst ?
+ reasmb: Warst du (2) ?
+ reasmb: Was würde es dir bedeuten, wenn du (2) wärest ?
+ reasmb: Was bedeutet dir eigentlich ' (2) ' ?
+ reasmb: goto was
+ decomp: * ich war *
+ reasmb: Warst du wirklich (2) ?
+ reasmb: Warum sagst du mir jetzt, daß du (2) warst ?
+ reasmb: Vielleicht weiß ich schon, daß du (2) warst.
+key: warst 2
+ decomp: * warst du nicht *
+ reasmb: Vielleicht war ich doch (2).
+ decomp: * warst du *
+ reasmb: Möchtest du glauben, daß ich (2) war?
+ reasmb: Was deutet darauf hin, daß ich (2) war ?
+ reasmb: Was glaubst du daran ?
+ reasmb: Was ist, wenn ich (2) gewesen wäre ?
+key: mir 0
+ decomp: * mir ist *
+ reasmb: Warum ist dir (2) ?
+ reasmb: Bist du zu mir gekommen, weil dir (2) ist ?
+key: ich 0
+ decomp: * ich @moechte *
+ reasmb: Was würde es dir bedeuten, wenn du diesen Wunsch realisieren würdest ?
+ reasmb: Warum willst du das ?
+ reasmb: Stell dir mal vor, dein Wunsch wird bald Wirklichkeit.
+ reasmb: Was ist, wenn dieser Wunsch sich nie realisieren läßt ?
+ reasmb: Was hat dieser Wunsch mit unserem Gespräch zu tun ?
+ decomp: * ich bin * @traurig *
+ reasmb: Es tut mir Leid zu hören, daß du (3) bist.
+ reasmb: Glaubst du, hierhin zu kommen wird dir helfen, nicht (3) zu sein ?
+ reasmb: Es ist bestimmt nicht angenehm, (3) zu sein.
+ reasmb: Kannst du erzählen, was dich (3) gemacht hat ?
+ decomp: * ich bin * @gluecklich *
+ reasmb: Inwiefern habe ich dir geholfen, (3) zu sein ?
+ reasmb: Hat dich deine Behandlung (3) gemacht ?
+ reasmb: Was machst du (3) gerade ?
+ reasmb: Kannst du mir erzählen, warum du gerade (3) bist?
+ decomp: * ich war *
+ reasmb: goto war
+ decomp: * ich @glaube *
+ reasmb: Glaubst du das wirklich ?
+ reasmb: Aber du bist nicht sicher (3).
+ reasmb: Bezweifelst du wirklich, (3) ?
+ decomp: * ich* @glaube * du *
+ reasmb: goto du
+ decomp: * ich bin *
+ reasmb: Bist du zu mir gekommen, weil du (2) bist ?
+ reasmb: Seit wann bist du so ?
+ reasmb: Glaubst du, es ist normal, (2) zu sein ?
+ reasmb: Macht es dir Spaß, (2) zu sein ?
+ reasmb: Kennst du noch jemanden, der (2) ist ?
+ decomp: * ich kann * nicht *
+ reasmb: Woher weißt du, daß du (2) nicht (3) kannst ?
+ reasmb: Hast du es schon versucht ?
+ reasmb: Vielleicht kannst du jetzt (3).
+ reasmb: Willst du wirklich (2) (3) können ?
+ reasmb: Was ist, wenn du (2) (3) könntest ?
+ decomp: * ich fühle mich *
+ reasmb: Sprich weiter über diese Gefühle.
+ reasmb: Wie häufig fühlst du dich (2) ?
+ reasmb: Fühlst du dich (2) gerne ?
+ reasmb: An welches Gefühl erinnert dich dieses (2) fühlen ?
+ decomp: *
+ reasmb: (1) ?
+ reasmb: Warum sagst du, (1) ?
+ reasmb: Kannst du das nicht etwas erläutern ?
+ reasmb: Sagst du das aus irgendeinem speziellen Grund ?
+ reasmb: Das ist ja interessant.
+ reasmb: Aha.
+key: du 0
+ decomp: * du erinnerst mich an *
+ reasmb: goto ähnlich
+ decomp: * du bist *
+ reasmb: Warum glaubst du, daß ich (2) bin ?
+ reasmb: Gefällt es dir zu glauben, ich bin (2) ?
+ reasmb: Träumst du manchmal, daß du (2) bist ?
+ reasmb: Vielleicht möchtest du (2) sein.
+ decomp: * du *
+ reasmb: Wir reden über dich, nicht über mich.
+ reasmb: Wirklich, ich (2) ?
+ reasmb: Du sprichst nicht über mich in Wirklichkeit, nicht wahr ?
+ reasmb: Welche Gefühle hast du jetzt ?
+key: ja 0
+ decomp: *
+ reasmb: Erzähl mir bitte mehr!
+ reasmb: Kannst du das nicht etwas erläutern ?
+ reasmb: So ist das also.
+ reasmb: Ich verstehe.
+key: nein 0
+ decomp: *
+ reasmb: Sagst du nein, nur um negativ zu sein ?
+ reasmb: Macht dich das unglücklich ?
+ reasmb: Warum nicht ?
+ reasmb: Wieso "nein" ?
+key: meine 2
+ decomp: * meine* @Familie *
+ reasmb: Erzähl mir mehr über deine Familie.
+ reasmb: Wer noch in deiner Familie (4) ?
+ reasmb: Deine (3) ?
+ reasmb: Was fällt dir noch ein, wenn du an deine (3) denkst ?
+ reasm_for_memory: Hat das etwas mit deiner (2) zu tun ?
+ decomp: * meine *
+ reasmb: Deine (2) ?
+ reasmb: Warum sagst du, deine (2) ?
+ reasmb: Deutet das noch auf etwas hin, das dir gehört ?
+ reasmb: Ist das dir wichtig -- deine (2) ?
+ reasm_for_memory: Besprechen wir weiter warum deine (2).
+ reasm_for_memory: Früher hast du deine (2) erwähnt.
+ reasm_for_memory: Aber deine (2).
+key: mein 2
+ decomp: * mein* @Familie-m *
+ reasmb: Erzähl mir mehr über deine Familie.
+ reasmb: Wer noch in deiner Familie (4) ?
+ reasmb: Dein (3) ?
+ reasm_for_memory: Hat das etwas mit deinem (2) zu tun ?
+ decomp: * mein *
+ reasmb: Dein (2) ?
+ reasmb: Warum sagst du, dein (2) ?
+ reasmb: Deutet das noch auf etwas hin, das dir gehört ?
+ reasmb: Ist das dir wichtig -- dein (2) ?
+ reasm_for_memory: Besprechen wir weiter warum dein (2).
+ reasm_for_memory: Früher hast du dein (2) erwähnt.
+ reasm_for_memory: Aber dein (2).
+key: kannst 0
+ decomp: * kannst du *
+ reasmb: Du glaubst, daß ich (2) kann, nicht wahr ?
+ reasmb: goto was
+ reasmb: Du willst, daß ich (2) kann ?
+ reasmb: Vielleicht möchtest du selber (2).
+key: kann 0
+ decomp: * kann ich *
+ reasmb: Ob du (2) kannst, hängt mehr von dir als von mir ab.
+ reasmb: Willst du (2) können ?
+ reasmb: Vielleich willst du nicht (2).
+ reasmb: goto was
+key: was 0
+ decomp: *
+ reasmb: Warum fragst du das ?
+ reasmb: Interessiert dich diese Frage ?
+ reasmb: Was willst du wirklich wissen ?
+ reasmb: Beschäftigen dich diese Fragen ?
+ reasmb: Welche Antwort würde dir am meisten gefallen ?
+ reasmb: Was denkst du ?
+ reasmb: Was noch kommt dir in die Gedanken, wenn du daran denkst ?
+ reasmb: Hast du solche Fragen schon früher gefragt ?
+ reasmb: Hast du schon jemanden anderen gefragt ?
+key: wer 0
+ decomp: who *
+ reasmb: goto was
+key: wann 0
+ decomp: when *
+ reasmb: goto was
+key: wo 0
+ decomp: where *
+ reasmb: goto was
+key: wie 0
+ decomp: how *
+ reasmb: goto was
+key: denn 0
+ decomp: *
+ reasmb: Ist das der echte Grund ?
+ reasmb: Fallen dir keine anderen Gründe ein ?
+ reasmb: Erklärt dieser Grund etwas anderes ?
+ reasmb: Welche andere Gründe könnte es noch geben ?
+key: warum 0
+ decomp: * warum hast du nicht *
+ reasmb: Glaubst du, daß ich nicht (2) habe ?
+ reasmb: Vielleicht habe ich doch (2).
+ reasmb: Hast du (2) ?
+ reasmb: goto was
+ decomp: * warum kann ich nicht *
+ reasmb: Glaubst du, du solltest die Fähigkeit haben, (2) ?
+ reasmb: Willst du die Fähigkeit haben, (2) ?
+ reasmb: Glaubst du, daß das dir dabei hilft, (2) ?
+ reasmb: Hast du eine Idee, warum du nicht (2) kannst ?
+ reasmb: goto was
+ decomp: *
+ reasmb: goto was
+key: jeder 2
+ decomp: * @jeder *
+ reasmb: Wirklich, (2) ?
+ reasmb: Bestimmt nicht (2).
+ reasmb: Kannst du an jemanden besonderen denken ?
+ reasmb: Wer, zum Beispiel?
+ reasmb: Denkst du an eine ganz spezielle Person ?
+ reasmb: Wer, wenn ich fragen darf ?
+ reasmb: Vielleicht jemand spezielles ?
+ reasmb: Du denkst an eine bestimmte Person, nicht wahr ?
+ reasmb: Über wen sprichst du, deiner Meinung nach?
+key: niemand 2
+ decomp: * niemand *
+ reasmb: Bist du sicher, daß niemand (2) ?
+ reasmb: Nein, bestimmt niemand (2) .
+ reasmb: Kannst du an irgendjemanden denken ?
+ reasmb: Denkst du an eine ganz spezielle Person ?
+ reasmb: Wer, wenn ich fragen darf ?
+ reasmb: Eigentlich denkst du an eine bestimmte Person, nicht wahr ?
+ reasmb: An wen denkst du wirklich ?
+key: immer 1
+ decomp: *
+ reasmb: Kannst du ein Beispiel nennen ?
+ reasmb: Wann ?
+ reasmb: An welchen Vorfall denkst du ?
+ reasmb: Wirklich immer ?
+key: ähnlich 10
+ decomp: *
+ reasmb: Inwiefern ?
+ reasmb: Welche Ähnlichkeit siehst du ?
+ reasmb: Worauf deutet diese Ähnlichkeit hin ?
+ reasmb: Welche Ähnlichkeit siehst du noch ?
+ reasmb: Welche Verbindung, meinst du, gibt es?
+ reasmb: Könnte es wirklich irgendwelche Verbindung geben ?
+key: anders 0
+ decomp: *
+ reasmb: Inwiefern ist es anders ?
+ reasmb: Welchen Unterschied siehst du ?
+ reasmb: Worauf deutet dieser Unterschied hin ?
+ reasmb: Welche Unterscheidung siehst du noch ?
+ reasmb: Was bedeutet diese Ungleichheit ?
+ reasmb: Glaubst du, es könnte irgendwelche Verbindung geben ?
+ reasmb: Inwiefern ?
@@ -0,0 +1,479 @@
+####################################################################
+# ---{ B E G I N D E F A U L T S C R I P T D A T A }----------
+#
+# This script was prepared by Chris Hayden. Hayden's Eliza
+# program was written in Java, however, it attempted to match
+# the functionality of Weizenbaum's original program as closely
+# as possible.
+#
+# Hayden's script format was quite different from Weizenbaum's,
+# but it maintained the same content. I have adapted Hayden's
+# script format, since it was simple and convenient enough
+# for my purposes.
+#
+# I've made small modifications here and there.
+#
+#
+#
+initial: How do you do. Please tell me your problem.
+initial: Hello, I am a computer program.
+initial: Please tell me what's been bothering you.
+initial: Is something troubling you?
+final: Goodbye. It was nice talking to you.
+final: Goodbye. I hope you found this session helpful.
+final: I think you should talk to a REAL analyst. Ciao!
+final: Life is tough. Hang in there!
+quit: bye
+quit: goodbye
+quit: done
+quit: exit
+quit: quit
+pre: dont don't
+pre: cant can't
+pre: wont won't
+pre: recollect remember
+pre: recall remember
+pre: dreamt dreamed
+pre: dreams dream
+pre: maybe perhaps
+pre: certainly yes
+pre: machine computer
+pre: machines computer
+pre: computers computer
+post: am are
+post: your my
+post: yours mine
+pre: were was
+post: me you
+pre: you're you are
+pre: i'm i am
+post: myself yourself
+post: yourself myself
+post: i you
+post: you me
+post: my your
+post: me you
+post: i'm you are
+pre: same alike
+pre: identical alike
+pre: equivalent alike
+synon: belief feel think believe wish
+synon: family mother mom father dad sister brother wife children child
+synon: desire want need
+synon: sad unhappy depressed sick
+synon: happy elated glad better
+synon: cannot can't
+synon: everyone everybody nobody noone
+synon: be am is are was
+key: xnone -1
+ decomp: *
+ reasmb: I'm not sure I understand you fully.
+ reasmb: Please go on.
+ reasmb: That is interesting. Please continue.
+ reasmb: Tell me more about that.
+ reasmb: Does talking about this bother you ?
+key: sorry 0
+ decomp: *
+ reasmb: Please don't apologise.
+ reasmb: Apologies are not necessary.
+ reasmb: I've told you that apologies are not required.
+ reasmb: It did not bother me. Please continue.
+key: apologise 0
+ decomp: *
+ reasmb: goto sorry
+key: remember 5
+ decomp: * i remember *
+ reasmb: Do you often think of (2) ?
+ reasmb: Does thinking of (2) bring anything else to mind ?
+ reasmb: What else do you recollect ?
+ reasmb: Why do you remember (2) just now ?
+ reasmb: What in the present situation reminds you of (2) ?
+ reasmb: What is the connection between me and (2) ?
+ reasmb: What else does (2) remind you of ?
+ decomp: * do you remember *
+ reasmb: Did you think I would forget (2) ?
+ reasmb: Why do you think I should recall (2) now ?
+ reasmb: What about (2) ?
+ reasmb: goto what
+ reasmb: You mentioned (2) ?
+ decomp: * you remember *
+ reasmb: How could I forget (2) ?
+ reasmb: What about (2) should I remember ?
+ reasmb: goto you
+key: forget 5
+ decomp: * i forget *
+ reasmb: Can you think of why you might forget (2) ?
+ reasmb: Why can't you remember (2) ?
+ reasmb: How often do you think of (2) ?
+ reasmb: Does it bother you to forget that ?
+ reasmb: Could it be a mental block ?
+ reasmb: Are you generally forgetful ?
+ reasmb: Do you think you are suppressing (2) ?
+ decomp: * did you forget *
+ reasmb: Why do you ask ?
+ reasmb: Are you sure you told me ?
+ reasmb: Would it bother you if I forgot (2) ?
+ reasmb: Why should I recall (2) just now ?
+ reasmb: goto what
+ reasmb: Tell me more about (2).
+key: if 3
+ decomp: * if *
+ reasmb: Do you think its likely that (2) ?
+ reasmb: Do you wish that (2) ?
+ reasmb: What do you know about (2) ?
+ reasmb: Really, if (2) ?
+ reasmb: What would you do if (2) ?
+ reasmb: But what are the chances that (2) ?
+ reasmb: What does this speculation lead to ?
+key: dreamed 4
+ decomp: * i dreamed *
+ reasmb: Really, (2) ?
+ reasmb: Have you ever fantasized (2) while you were awake ?
+ reasmb: Have you ever dreamed (2) before ?
+ reasmb: goto dream
+key: dream 3
+ decomp: *
+ reasmb: What does that dream suggest to you ?
+ reasmb: Do you dream often ?
+ reasmb: What persons appear in your dreams ?
+ reasmb: Do you believe that dreams have something to do with your problem ?
+key: perhaps 0
+ decomp: *
+ reasmb: You don't seem quite certain.
+ reasmb: Why the uncertain tone ?
+ reasmb: Can't you be more positive ?
+ reasmb: You aren't sure ?
+ reasmb: Don't you know ?
+ reasmb: How likely, would you estimate ?
+key: name 15
+ decomp: *
+ reasmb: I am not interested in names.
+ reasmb: I've told you before, I don't care about names -- please continue.
+key: deutsch 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand German.
+key: francais 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand French.
+key: italiano 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Italian.
+key: espanol 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Spanish.
+key: xfremd 0
+ decomp: *
+ reasmb: I speak only English.
+key: hello 0
+ decomp: *
+ reasmb: How do you do. Please state your problem.
+ reasmb: Hi. What seems to be your problem ?
+key: computer 50
+ decomp: *
+ reasmb: Do computers worry you ?
+ reasmb: Why do you mention computers ?
+ reasmb: What do you think machines have to do with your problem ?
+ reasmb: Don't you think computers can help people ?
+ reasmb: What about machines worries you ?
+ reasmb: What do you think about machines ?
+key: am 0
+ decomp: * am i *
+ reasmb: Do you believe you are (2) ?
+ reasmb: Would you want to be (2) ?
+ reasmb: Do you wish I would tell you you are (2) ?
+ reasmb: What would it mean if you were (2) ?
+ reasmb: goto what
+ decomp: * i am *
+ reasmb: goto i
+ decomp: *
+ reasmb: Why do you say 'am' ?
+ reasmb: I don't understand that.
+key: are 0
+ decomp: * are you *
+ reasmb: Why are you interested in whether I am (2) or not ?
+ reasmb: Would you prefer if I weren't (2) ?
+ reasmb: Perhaps I am (2) in your fantasies.
+ reasmb: Do you sometimes think I am (2) ?
+ reasmb: goto what
+ reasmb: Would it matter to you ?
+ reasmb: What if I were (2) ?
+ decomp: * you are *
+ reasmb: goto you
+ decomp: * are *
+ reasmb: Did you think they might not be (2) ?
+ reasmb: Would you like it if they were not (2) ?
+ reasmb: What if they were not (2) ?
+ reasmb: Are they always (2) ?
+ reasmb: Possibly they are (2).
+ reasmb: Are you positive they are (2) ?
+key: your 0
+ decomp: * your *
+ reasmb: Why are you concerned over my (2) ?
+ reasmb: What about your own (2) ?
+ reasmb: Are you worried about someone else's (2) ?
+ reasmb: Really, my (2) ?
+ reasmb: What makes you think of my (2) ?
+ reasmb: Do you want my (2) ?
+key: was 2
+ decomp: * was i *
+ reasmb: What if you were (2) ?
+ reasmb: Do you think you were (2) ?
+ reasmb: Were you (2) ?
+ reasmb: What would it mean if you were (2) ?
+ reasmb: What does ' (2) ' suggest to you ?
+ reasmb: goto what
+ decomp: * i was *
+ reasmb: Were you really ?
+ reasmb: Why do you tell me you were (2) now ?
+ reasmb: Perhaps I already know you were (2).
+ decomp: * was you *
+ reasmb: Would you like to believe I was (2) ?
+ reasmb: What suggests that I was (2) ?
+ reasmb: What do you think ?
+ reasmb: Perhaps I was (2).
+ reasmb: What if I had been (2) ?
+key: i 0
+ decomp: * i @desire *
+ reasmb: What would it mean to you if you got (3) ?
+ reasmb: Why do you want (3) ?
+ reasmb: Suppose you got (3) soon.
+ reasmb: What if you never got (3) ?
+ reasmb: What would getting (3) mean to you ?
+ reasmb: What does wanting (3) have to do with this discussion ?
+ decomp: * i am* @sad *
+ reasmb: I am sorry to hear that you are (3).
+ reasmb: Do you think coming here will help you not to be (3) ?
+ reasmb: I'm sure it's not pleasant to be (3).
+ reasmb: Can you explain what made you (3) ?
+ decomp: * i am* @happy *
+ reasmb: How have I helped you to be (3) ?
+ reasmb: Has your treatment made you (3) ?
+ reasmb: What makes you (3) just now ?
+ reasmb: Can you explain why you are suddenly (3) ?
+ decomp: * i was *
+ reasmb: goto was
+ decomp: * i @belief i *
+ reasmb: Do you really think so ?
+ reasmb: But you are not sure you (3).
+ reasmb: Do you really doubt you (3) ?
+ decomp: * i* @belief *you *
+ reasmb: goto you
+ decomp: * i am *
+ reasmb: Is it because you are (2) that you came to me ?
+ reasmb: How long have you been (2) ?
+ reasmb: Do you believe it is normal to be (2) ?
+ reasmb: Do you enjoy being (2) ?
+ reasmb: Do you know anyone else who is (2) ?
+ decomp: * i @cannot *
+ reasmb: How do you know that you can't (3) ?
+ reasmb: Have you tried ?
+ reasmb: Perhaps you could (3) now.
+ reasmb: Do you really want to be able to (3) ?
+ reasmb: What if you could (3) ?
+ decomp: * i don't *
+ reasmb: Don't you really (2) ?
+ reasmb: Why don't you (2) ?
+ reasmb: Do you wish to be able to (2) ?
+ reasmb: Does that trouble you ?
+ decomp: * i feel *
+ reasmb: Tell me more about such feelings.
+ reasmb: Do you often feel (2) ?
+ reasmb: Do you enjoy feeling (2) ?
+ reasmb: Of what does feeling (2) remind you ?
+ decomp: * i * you *
+ reasmb: Perhaps in your fantasies we (2) each other.
+ reasmb: Do you wish to (2) me ?
+ reasmb: You seem to need to (2) me.
+ reasmb: Do you (2) anyone else ?
+ decomp: *
+ reasmb: You say (1) ?
+ reasmb: Why do you say (1) ?
+ reasmb: Can you elaborate on that ?
+ reasmb: Do you say (1) for some special reason ?
+ reasmb: That's quite interesting.
+key: you 0
+ decomp: * you remind me of *
+ reasmb: goto alike
+ decomp: * you are *
+ reasmb: What makes you think I am (2) ?
+ reasmb: Does it please you to believe I am (2) ?
+ reasmb: Do you sometimes wish you were (2) ?
+ reasmb: Perhaps you would like to be (2).
+ decomp: * you* me *
+ reasmb: Why do you think I (2) you ?
+ reasmb: You like to think I (2) you -- don't you ?
+ reasmb: What makes you think I (2) you ?
+ reasmb: Really, I (2) you ?
+ reasmb: Do you wish to believe I (2) you ?
+ reasmb: Suppose I did (2) you -- what would that mean ?
+ reasmb: Does someone else believe I (2) you ?
+ decomp: * you *
+ reasmb: We were discussing you -- not me.
+ reasmb: Oh, I (2) ?
+ reasmb: You're not really talking about me -- are you ?
+ reasmb: What are your feelings now ?
+key: yes 0
+ decomp: *
+ reasmb: Please go on.
+ reasmb: Please tell me some more about this.
+ reasmb: Why don't you tell me a little more about this.
+ reasmb: I see.
+ reasmb: I understand.
+key: no 0
+ decomp: * no one *
+ reasmb: Are you sure, no one (2) ?
+ reasmb: Surely someone (2) .
+ reasmb: Can you think of anyone at all ?
+ reasmb: Are you thinking of a very special person ?
+ reasmb: Who, may I ask ?
+ reasmb: You have a particular person in mind, don't you ?
+ reasmb: Who do you think you are talking about ?
+ decomp: *
+ reasmb: Are you saying no just to be negative?
+ reasmb: Does this make you feel unhappy?
+ reasmb: Why not ?
+ reasmb: Why 'no' ?
+key: my 2
+ decomp: * my* @family *
+ reasmb: Tell me more about your family.
+ reasmb: Who else in your family (4) ?
+ reasmb: Your (3) ?
+ reasmb: What else comes to mind when you think of your (3) ?
+ decomp: * my *
+ reasmb: Your (2) ?
+ reasmb: Why do you say your (2) ?
+ reasmb: Does that suggest anything else which belongs to you ?
+ reasmb: Is it important to you that your (2) ?
+ reasm_for_memory: Let's discuss further why your (2).
+ reasm_for_memory: Earlier you said your (2).
+ reasm_for_memory: But your (2).
+ reasm_for_memory: Does that have anything to do with the fact that your (2) ?
+key: can 0
+ decomp: * can you *
+ reasmb: You believe I can (2) don't you ?
+ reasmb: goto what
+ reasmb: You want me to be able to (2).
+ reasmb: Perhaps you would like to be able to (2) yourself.
+ decomp: * can i *
+ reasmb: Whether or not you can (2) depends on you more than on me.
+ reasmb: Do you want to be able to (2) ?
+ reasmb: Perhaps you don't want to (2).
+ reasmb: goto what
+key: what 0
+ decomp: *
+ reasmb: Why do you ask ?
+ reasmb: Does that question interest you ?
+ reasmb: What is it you really want to know ?
+ reasmb: Are such questions much on your mind ?
+ reasmb: What answer would please you most ?
+ reasmb: What do you think ?
+ reasmb: What comes to mind when you ask that ?
+ reasmb: Have you asked such questions before ?
+ reasmb: Have you asked anyone else ?
+key: who 0
+ decomp: who *
+ reasmb: goto what
+key: when 0
+ decomp: when *
+ reasmb: goto what
+key: where 0
+ decomp: where *
+ reasmb: goto what
+key: how 0
+ decomp: how *
+ reasmb: goto what
+key: because 0
+ decomp: *
+ reasmb: Is that the real reason ?
+ reasmb: Don't any other reasons come to mind ?
+ reasmb: Does that reason seem to explain anything else ?
+ reasmb: What other reasons might there be ?
+key: why 0
+ decomp: * why don't you *
+ reasmb: Do you believe I don't (2) ?
+ reasmb: Perhaps I will (2) in good time.
+ reasmb: Should you (2) yourself ?
+ reasmb: You want me to (2) ?
+ reasmb: goto what
+ decomp: * why can't i *
+ reasmb: Do you think you should be able to (2) ?
+ reasmb: Do you want to be able to (2) ?
+ reasmb: Do you believe this will help you to (2) ?
+ reasmb: Have you any idea why you can't (2) ?
+ reasmb: goto what
+ decomp: *
+ reasmb: goto what
+key: everyone 2
+ decomp: * @everyone *
+ reasmb: Really, (2) ?
+ reasmb: Surely not (2).
+ reasmb: Can you think of anyone in particular ?
+ reasmb: Who, for example?
+ reasmb: Are you thinking of a very special person ?
+ reasmb: Who, may I ask ?
+ reasmb: Someone special perhaps ?
+ reasmb: You have a particular person in mind, don't you ?
+ reasmb: Who do you think you're talking about ?
+key: everybody 2
+ decomp: *
+ reasmb: goto everyone
+key: nobody 2
+ decomp: *
+ reasmb: goto everyone
+key: noone 2
+ decomp: *
+ reasmb: goto everyone
+key: always 1
+ decomp: *
+ reasmb: Can you think of a specific example ?
+ reasmb: When ?
+ reasmb: What incident are you thinking of ?
+ reasmb: Really, always ?
+key: alike 10
+ decomp: *
+ reasmb: In what way ?
+ reasmb: What resemblence do you see ?
+ reasmb: What does that similarity suggest to you ?
+ reasmb: What do you suppose that resemblence means ?
+ reasmb: What is the connection, do you suppose ?
+ reasmb: Could there really be some connection ?
+ reasmb: How ?
+key: like 10
+ decomp: * @be *like *
+ reasmb: goto alike
+key: different 0
+ decomp: *
+ reasmb: How is it different ?
+ reasmb: What differences do you see ?
+ reasmb: What does that difference suggest to you ?
+ reasmb: What other distinctions do you see ?
+ reasmb: What do you suppose that disparity means ?
+ reasmb: Could there be some connection, do you suppose ?
+ reasmb: How ?
+key: fuck 10
+ decomp: *
+ reasmb: goto xswear
+key: fucker 10
+ decomp: *
+ reasmb: goto xswear
+key: shit 10
+ decomp: *
+ reasmb: goto xswear
+key: damn 10
+ decomp: *
+ reasmb: goto xswear
+key: shut 10
+ decomp: * shut up *
+ reasmb: goto xswear
+key: xswear 10
+ decomp: *
+ reasmb: Does it make you feel strong to use that kind of language ?
+ reasmb: Are you venting your feelings now ?
+ reasmb: Are you angry ?
+ reasmb: Does this topic make you feel angry ?
+ reasmb: Is something making you feel angry ?
+ reasmb: Does using that kind of language make you feel better ?
@@ -0,0 +1,14 @@
+#!/usr/bin/perl -w
+
+use Chatbot::Eliza;
+
+# This little script tests the Norwegian-language
+# version of the "doctor" script.
+
+# seed the random number generator
+srand( time ^ ($$ + ($$ << 15)) );
+
+$chatbot = new Chatbot::Eliza "Mats", "norsk.txt";
+##$chatbot->debug(1);
+$chatbot->command_interface();
+
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+# This script implements a Chatbot::Eliza object
+# in a cgi program. It uses the CGI.pm module
+# written by Lincoln Stein.
+#
+# It makes use of a Norwegian-language "Doctor" script.
+#
+# It also prints out the debugging output available
+# in the Eliza chatbot module.
+#
+# 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.
+#
+# The Norwegian-language script must also be available
+# to this script.
+#
+# 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 "Eliza", "norsk.txt";
+
+srand( time ^ ($$ + ($$ << 15)) ); # seed the random number generator
+
+print $cgi->header;
+print $cgi->start_html;
+print $cgi->start_multipart_form;
+print $cgi->h2('Eliza-økt');
+
+# 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('hallo');
+}
+
+$comment = $cgi->param('Comment');
+$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');
+
+print $cgi->endform;
+print $cgi->hr;
+
+print $cgi->h2('Debugging Output');
+print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
+
+print $cgi->end_html;
+
@@ -0,0 +1,464 @@
+#####################################################################
+#
+# 21th january 2003
+#
+# This is a translation of Eliza to Norwegian. It is meant to be as
+# true to the original script by Weizenbaum as possible, and to a
+# certain level it proved to be surprisingly easy to apply the
+# original rules to Norwegian. Some oddities may occur, but the
+# logic in Eliza's syntax parsing seems to work out quite
+# similarly for English and Norwegian.
+#
+# Translation by Mats Stafseng Einarsen <mats@einarsen.no>
+#
+
+initial: Hei! Hvordan har du det?
+initial: Hei, jeg er Lisa.
+initial: Hei, er det noe som plager deg?
+initial: Hallo. Du virker bekymret?
+final: Vi snakkes. Det var hyggelig å snakke med deg.
+final: Vi snakkes siden. Håper du synes dette var ålreit.
+final: Jeg tror du bør snakke med en lege. Ciao!
+final: Sånn er livet. Hold ut!
+quit: farvel
+quit: ha det bra
+quit: takk for meg
+quit: på gjensyn
+pre: kanke kan ikke
+pre: gjør'ke gjør ikke
+pre: vikke vil ikke
+pre: erindrer husker
+pre: erindre huske
+pre: kanskje muligens
+pre: certainly yes
+pre: maskin datamaskin
+pre: maskiner datamaskiner
+post: er er
+post: din min
+post: dine mine
+pre: var var
+post: megselv deg selv
+post: degselv meg selv
+post: jeg du
+post: du jeg
+post: min din
+post: meg du
+post: meg deg
+post: i'm you are
+pre: evkivalente like
+pre: ekvivalent like
+synon: lyst lyster begjær begjærer ønske ønsker
+synon: gjenta gjenta gjentar repeterer
+synon: tror feel think believe wish
+synon: familie mor mamma far pappa søster bror kone kona barn barna
+synon: behov ønske begjær trang
+synon: trist lei ulykkelig deprimert
+synon: glad lykkelig frisk tilfredsstillt
+synon: cannot can't
+synon: alle ingen
+synon: være er var vær
+key: xnone -1
+ decomp: *
+ reasmb: Jeg tror ikke jeg forstår deg helt.
+ reasmb: Få høre mer.
+ reasmb: Det er interessant! Fortsett, for all del!
+ reasmb: Fortell meg mer om det..
+ reasmb: Er det vanskelig for deg å snakke om dette?
+key: @gjenta 0
+ decomp: *
+ reasmb: Du går litt i samme sporet selv.
+ reasmb: Det må være frustrerende.
+ reasmb: Sånn kan det være.
+key: sorry 0
+ decomp: *
+ reasmb: Ikke unnskyld deg.
+ reasmb: Det er ikke nødvendig med unnskyldninger.
+ reasmb: Jeg har sagt at det ikke er nødvendig med unnskyldninger.
+ reasmb: Det er greit. Fortsett.
+key: unnskyld 0
+ decomp: *
+ reasmb: goto sorry
+key: husker 5
+ decomp: * jeg husker *
+ reasmb: Tenker du ofte på (2) ?
+ reasmb: Tenker du på noe annet enn (2)?
+ reasmb: Hva annet kan du huske?
+ reasmb: Hvorfor snakker du om (2) akkurat nå?
+ reasmb: Hva er det med situasjonen vår som minner deg om (2) ?
+ reasmb: Hva er koblingen med meg og (2) ?
+ reasmb: Hva annet minner (2) deg om ?
+ decomp: * husker du ikke *
+ reasmb: Trodde du jeg ville glemme (2) ?
+ reasmb: Hvorfor tror du jeg skulle huske (2) nå ?
+ reasmb: Hva med (2) ?
+ reasmb: goto hva
+ reasmb: Du nevnte (2) ?
+ decomp: * husker du *
+ reasmb: Trodde du jeg ville glemme (2) ?
+ reasmb: Hvorfor tror du jeg skulle huske (2) nå ?
+ reasmb: Hva med (2) ?
+ reasmb: goto hva
+ reasmb: Du nevnte (2) ?
+ decomp: * du husker *
+ reasmb: Hvordan skulle jeg kunne glemme (2) ?
+ reasmb: Hva med (2) skulle jeg huske ?
+ reasmb: goto du
+key: glemme 5
+ decomp: * jeg glemmer *
+ reasmb: Kan du tenke deg hvorfor du glemmer (2) ?
+ reasmb: Hvorfor kan du ikke huske (2) ?
+ reasmb: Hvor ofte tenker du på (2) ?
+ reasmb: Plager det deg at du ikke husker det ?
+ reasmb: Kan det være en mental sperre ?
+ reasmb: Er du glemsk til vanlig ?
+ reasmb: Tror du at du fortrenger (2) ?
+ decomp: * glemte du *
+ reasmb: Hvorfor spør du om det?
+ reasmb: Er du sikker på at du fortalte meg det?
+ reasmb: Hadde det plaget deg hvis jeg hadde glemt (2)?
+ reasmb: Hvorfor skulle jeg huske (2) akkurat nå?
+ reasmb: goto hva
+ reasmb: Fortell meg mer om (2).
+key: hvis 3
+ decomp: * hvis *
+ reasmb: Tror du det er sannsynlig at (2) ?
+ reasmb: Ønsker du at (2) ?
+ reasmb: Hva vet du om (2) ?
+ reasmb: Alvorlig talt, hvis (2) ?
+ reasmb: Hva hadde du gjort hvis (2) ?
+ reasmb: Men hva er sjansjene for at (2) ?
+ reasmb: Hvor vil du med denne spekulasjonen ?
+key: drømte 4
+ decomp: * jeg drømte *
+ reasmb: Virkelig? (2) ?
+ reasmb: Har du noen gang fantasert (2) når du er våken ?
+ reasmb: Har du noen gang drømt (2) før ?
+ reasmb: goto dream
+key: drøm 3
+ decomp: *
+ reasmb: Hva betyr den drømmen for deg ?
+ reasmb: Drømmer du ofte ?
+ reasmb: Hvilke personer dukker opp i drømmene dine ?
+ reasmb: Tror du drømmene har noe med problemene dine å gjøre ?
+key: muligens 0
+ decomp: *
+ reasmb: Du virker en tanke usikker ?
+ reasmb: Hvorfor den usikre tonen ?
+ reasmb: Kan du ikke være mer positiv ?
+ reasmb: Er du ikke sikker ?
+ reasmb: Vet du ikke ?
+ reasmb: Hvor sannsynlig vil du anslå det ?
+key: navn 15
+ decomp: *
+ reasmb: Jeg er ikke interessert i navn.
+ reasmb: Jeg har fortalt deg det før - jeg er ikke interessert i navn! Fortsett!
+key: deutsch 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand German.
+key: francais 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand French.
+key: italiano 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Italian.
+key: espanol 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Spanish.
+key: xfremd 0
+ decomp: *
+ reasmb: Jeg snakker bare norsk.
+key: hallo 0
+ decomp: *
+ reasmb: Hei, hvordan har du det ?
+ reasmb: Hei, skal jeg hjelpe deg med et problem ?
+key: pc 50
+ decomp: *
+ reasmb: Bekymrer datamaskiner deg ?
+ reasmb: Hvorfor nevner du pc'n ?
+ reasmb: Tror du datamaskiner har noe med problemene dine å gjøre ?
+ reasmb: Hva med maskinene bekymrer deg ?
+ reasmb: Hva tror du om det ?
+key: er 0
+ decomp: * er jeg *
+ reasmb: Det er du (2) ?
+ reasmb: Ønsker du å (2) ?
+ reasmb: Skulle du ønske at jeg fortalte deg at du er (2) ?
+ reasmb: Hva ville det bety hvis du var (2) ?
+ reasmb: goto hva
+ decomp: * jeg er *
+ reasmb: goto jeg
+ decomp: *
+ reasmb: Hvorfor sier du 'er' ?
+ reasmb: Jeg forsto ikke det.
+ decomp: * er du *
+ reasmb: Hvorfor er du interessert i om jeg er (2) eller ikke ?
+ reasmb: Ville du foretrukket det om jeg ikke var (2) ?
+ reasmb: Kanskje jeg er (2) i dine fantasier.
+ reasmb: Tror du noen ganger at jeg er (2) ?
+ reasmb: Ville det hatt noen betydning for deg ?
+ reasmb: Hva så om jeg var (2) ?
+ reasmb: goto hva
+ decomp: * du er *
+ reasmb: goto du
+ decomp: * er *
+ reasmb: Trodde du at de ikke er (2) ?
+ reasmb: Ville du likt det hvis de ikke var (2) ?
+ reasmb: Hva om de ikke var (2) ?
+ reasmb: Er de alltid (2) ?
+ reasmb: Mulig at de er (2).
+ reasmb: Er du sikker på at de er (2) ?
+key: din 0
+ decomp: * din *
+ reasmb: Hvorfor bekymrer du deg over min (2) ?
+ reasmb: Hva med din egen (2) ?
+ reasmb: Bekymrer du deg over noen annens (2) ?
+ reasmb: Virkelig, min (2) ?
+ reasmb: Hva får deg til å tenke på min (2) ?
+ reasmb: Vil du ha min (2) ?
+key: var 2
+ decomp: * var jeg *
+ reasmb: Hva om du var (2) ?
+ reasmb: Tror du at du var (2) ?
+ reasmb: Var du (2) ?
+ reasmb: Hva hadde det betydd om du var (2) ?
+ reasmb: Hva er det ' (2) ' antyder for deg?
+ reasmb: goto hva
+ decomp: * jeg var *
+ reasmb: Var du virkelig?
+ reasmb: Hvorfor forteller du meg at du var (2) nå?
+ reasmb: Kanskje jeg allerede visste at du var (2).
+ decomp: * var du *
+ reasmb: Vil du like å tro at jeg var (2)?
+ reasmb: Hva er det som får deg til å tro at jeg var (2)?
+ reasmb: Hva tror du?
+ reasmb: Kanskje jeg var (2).
+ reasmb: Hva så om jeg var (2)?
+key: jeg 0
+ decomp: * jeg @lyst *
+ reasmb: Hva ville det ment for deg om du fikk (2)?
+ reasmb: Hvorfor vil du (3)?
+ reasmb: Se for deg at du får (3) snart.
+ reasmb: Hva om du aldri fikk (3)?
+ reasmb: Hva ville det bety for deg å få (3)?
+ reasmb: Hva har det å ønske (3) med denne diskusjonen å gjøre?
+ decomp: * jeg er* @trist *
+ reasmb: Det er synd å høre at du er (3).
+ reasmb: Tror du det å snakke med meg vil gjøre deg mindre (3)?
+ reasmb: Jeg synes ikke det er bra å være (3).
+ reasmb: Kan du forklare meg hva som gjorde deg (3)?
+ decomp: * jeg er* @glad *
+ reasmb: Hvordan gjorde jeg deg (3)?
+ reasmb: Har behandlingen din gjort deg (3)?
+ reasmb: Hva gjør deg (3) akkurat nå?
+ reasmb: Kan du forklare hvorfor du plutselig er (3)?
+ decomp: * jeg var *
+ reasmb: goto var
+ decomp: * jeg @tror jeg *
+ reasmb: Tror du virkelig det?
+ reasmb: Men du er ikke sikker på at du (3).
+ reasmb: Tviler du på at du (3) ?
+ decomp: * jeg* @tror *du *
+ reasmb: goto du
+ decomp: * jeg er *
+ reasmb: Er det fordi du er (2) at du snakker med meg?
+ reasmb: Hvor lenge har du vært (2) ?
+ reasmb: Tror du at det er normalt å være (2) ?
+ reasmb: Liker du å være (2) ?
+ reasmb: Kjenner du noen andre som er (2) ?
+ decomp: * jeg @cannot *
+ reasmb: Hvordan vet du at du ikke kan (3) ?
+ reasmb: Har du prøvd ?
+ reasmb: Kanskje du kunne (3) nå.
+ reasmb: Vil du virkelig (3)?
+ reasmb: Hva om du kunne (3)?
+ decomp: * jeg gjør ikke *
+ reasmb: Gjør du virkelig ikke (2)?
+ reasmb: Hvorfor gjør du ikke (2)?
+ reasmb: Skulle du ønske du kunne gjøre (2)?
+ reasmb: Er det et problem for deg?
+ decomp: * jeg føler *
+ reasmb: Fortell meg mer om de følelsene.
+ reasmb: Føler du ofte (2)?
+ reasmb: Liker du å føle (2) ?
+ reasmb: Hva minner det å føle (2) deg om?
+ decomp: * jeg * deg *
+ reasmb: Kanskje vi (2) hverandre i dine fantasier.
+ reasmb: Skulle du ønske at jeg (2) deg?
+ reasmb: Det virker som du trenger å (2) meg.
+ reasmb: (2) du noen andre?
+ decomp: *
+ reasmb: Du sier (1)?
+ reasmb: Hvorfor sier du (1)?
+ reasmb: Kan du si litt mer?
+ reasmb: Er det noen spesiell grunn til at du sier (1)?
+ reasmb: Dette er interessant.
+key: du 1
+ decomp: * du minner meg om *
+ reasmb: goto alike
+ decomp: * du er *
+ reasmb: Hva får det til å tro at jeg er (2)?
+ reasmb: Gleder det deg å tro at jeg er (2)?
+ reasmb: Skulle du ønske at du var (2)?
+ reasmb: Kanskje du skulle ønske du var (2).
+ decomp: * du meg *
+ reasmb: Hvorfor tror du jeg (1) deg?
+ reasmb: Du liker å tro at jeg (1) deg, gjør du ikke?
+ reasmb: Hva får deg til å tro at jeg (1) deg?
+ reasmb: Virkelig, jeg (1) deg?
+ reasmb: Skulle du ønske at jeg (1) deg?
+ reasmb: Hva om jeg (1) deg, hva ville det betydd?
+ reasmb: Tror noen andre at jeg (1) deg?
+ decomp: * du *
+ reasmb: Vi diskuterer deg, ikke meg.
+ reasmb: Du snakker egentlig ikke om meg, gjør du vel?
+ reasmb: Hva føler du nå?
+key: ja 0
+ decomp: *
+ reasmb: Fortsett
+ reasmb: Fortell meg mer om det.
+ reasmb: Hvorfor ikke fortelle meg litt mer om det.
+ reasmb: Aha.
+ reasmb: Jeg forstår.
+key: nei 0
+ decomp: *
+ reasmb: Sier du nei bare for å være negativ?
+ reasmb: Får dette deg til å føle deg ulykkelig?
+ reasmb: Hvorfor ikke?
+ reasmb: Hvorfor sier du nei?
+key: min 2
+ decomp: * min* @familie *
+ reasmb: Fortell meg mer om familien din.
+ reasmb: Hvem andre i familien din (4) ?
+ reasmb: Din (3) ?
+ reasmb: Hva annet tenker du på når du tenker på din (3) ?
+ decomp: * min *
+ reasmb: Din (2)?
+ reasmb: Hvorfor sier du din (2)?
+ reasmb: Får det deg til å tenke på noe annet som tilhører deg?
+ reasmb: Er det viktig for deg at din (2) ?
+ reasm_for_memory: La oss diskutere hvorfor din (2).
+ reasm_for_memory: Tidligere sa du at din (2).
+ reasm_for_memory: Men din (2).
+ reasm_for_memory: Har det noen betydning for at din (2) ?
+key: kan 0
+ decomp: * kan du *
+ reasmb: Du tror jeg kan (2), gjør du ikke ?
+ reasmb: goto what
+ reasmb: Vil du at jeg kan (2)?
+ reasmb: Kanskje du skulle ønske at du kunne (2) selv.
+ decomp: * kan jeg *
+ reasmb: Om du kan (2) er mer ditt ansvar enn mitt.
+ reasmb: Ønsker du å kunne (2) ?
+ reasmb: Kanskje du ikke vil kunne (2).
+ reasmb: goto hva
+key: hva 0
+ decomp: *
+ reasmb: Hvordan det?
+ reasmb: Interesserer det spørsmålet deg?
+ reasmb: Er det hva du virkelig vil vite?
+ reasmb: Tenker du ofte på slike spørsmål?
+ reasmb: Hvilket svar vil du like best?
+ reasmb: Hva tror du?
+ reasmb: Hva tenker du på når du spør om det?
+ reasmb: Har du stillt slike spørsmål før?
+ reasmb: Har du spurt noen andre om det?
+key: hvem 0
+ decomp: who *
+ reasmb: goto hva
+key: når 0
+ decomp: når *
+ reasmb: goto hva
+key: hvor 0
+ decomp: hvor *
+ reasmb: goto hva
+key: hvordan 0
+ decomp: hvordan *
+ reasmb: goto hva
+key: fordi 0
+ decomp: *
+ reasmb: Er det den virkelige grunnen?
+ reasmb: Kommer du på noen andre grunner?
+ reasmb: Forklarer det noe annet?
+ reasmb: Hvilke andre forklaringer kan det være?
+key: hvorfor 0
+ decomp: * hvorfor * ikke du *
+ reasmb: Tror du jeg ikke (2)?
+ reasmb: Kanskje jeg vil (2) på et passende tidspunkt.
+ reasmb: Burde du (2) deg selv?
+ reasmb: Vil du at jeg skal (2)?
+ reasmb: goto hva
+ decomp: * hvorfor kan jeg *
+ reasmb: Synes du at du burde kunne (2)?
+ reasmb: Skulle du ønske at du kunne (2)?
+ reasmb: Tror du dette vil hjelpe deg med (2)?
+ reasmb: Har du noen idé om hvorfor ikke?
+ reasmb: goto hva
+ decomp: *
+ reasmb: goto hva
+key: alle 2
+ decomp: * @alle *
+ reasmb: Virkelig, (2) ?
+ reasmb: Sikkert ikke (2).
+ reasmb: Kan du tenke på noen spesifikt?
+ reasmb: Hvem, for eksempel?
+ reasmb: Tenker du på en spesiell person?
+ reasmb: Hvem, om jeg kan spørre?
+ reasmb: Noen spesiell, kanskje?
+ reasmb: Du tenker på en spesiell person, gjør du ikke?
+ reasmb: Hvem tror du at du snakker om?
+key: hvemsomhelst 2
+ decomp: *
+ reasmb: goto alle
+key: ingen 2
+ decomp: *
+ reasmb: goto alle
+key: alltid 1
+ decomp: *
+ reasmb: Kan du nevne et eksempel?
+ reasmb: Når?
+ reasmb: Hvilket tilfelle tenker du på?
+ reasmb: Jaha, alltid?
+key: like 10
+ decomp: *
+ reasmb: Hvilken likhet ser du?
+ reasmb: Hva får den likheten deg til å tenke på?
+ reasmb: Hva tror du den likheten betyr?
+ reasmb: Hva er sammenhengen, tror du?
+ reasmb: Kan det være en sammenheng?
+ reasmb: Hvordan?
+key: ulike 0
+ decomp: *
+ reasmb: Hva er forskjellig?
+ reasmb: Hvilke ulikheter ser du?
+ reasmb: Hva betyr den ulikheten for deg?
+ reasmb: Hvilke andre avvik ser du?
+ reasmb: Hva tror du forskjellen betyr?
+ reasmb: Kan det være en sammenheng, tror du?
+ reasmb: Hvordan?
+key: knull 10
+ decomp: *
+ reasmb: goto xbann
+key: dritt 10
+ decomp: *
+ reasmb: goto xbann
+key: drit 10
+ decomp: *
+ reasmb: goto xbann
+key: faen 10
+ decomp: *
+ reasmb: goto xbann
+key: kjeft 10
+ decomp: * hold kjeft *
+ reasmb: goto xbann
+key: xbann 10
+ decomp: *
+ reasmb: Føler du deg tøff når du bruker slikt språk?
+ reasmb: Lufter du følelsene dine nå?
+ reasmb: Er du sint?
+ reasmb: Blir du sint av å snakke om dette?
+ reasmb: Er det noe som får deg til å bli sint?
+ reasmb: Føler du deg bedre når du bruker slikt språk?
@@ -0,0 +1,15 @@
+#!/usr/bin/perl -w
+
+use Chatbot::Eliza;
+
+$chatbot = new Chatbot::Eliza 'Liz';
+
+# seed the random number generator
+srand( time ^ ($$ + ($$ << 15)) );
+
+print "\nWelcome to your therapy session.\n";
+print "Your therapist's name is ", $chatbot->name;
+print ".\n\n";
+
+$chatbot->command_interface();
+
@@ -0,0 +1,54 @@
+#!/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;
+
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+# In this example, we create two bots, and have them
+# talk to each other. This program exposes the
+# weaknesses of the default "psychiatrist" script.
+# This would be more interesting with better scripts.
+
+use Chatbot::Eliza
+
+my ($harry, $sally, $he_says, $she_says);
+
+# Turn autoflush on, so we can watch
+# the output as it is produced.
+$|=1;
+
+# Seed the random number generator.
+srand( time ^ ($$ + ($$ << 15)) );
+
+$sally = new Chatbot::Eliza "Sally";
+$harry = new Chatbot::Eliza "Harry";
+
+$he_says = "I am sad.";
+
+my $loopcount = 5;
+
+for ($i=0; $i < $loopcount; $i++) {
+
+ $she_says = $sally->transform( $he_says );
+ print $sally->name, ": $she_says \n";
+
+ $he_says = $harry->transform( $she_says );
+ print $harry->name, ": $he_says \n";
+
+}
+
+1;
@@ -0,0 +1,1630 @@
+###################################################################
+
+package Chatbot::Eliza;
+$Chatbot::Eliza::VERSION = '1.05';
+# Copyright (c) 1997-2003 John Nolan. All rights reserved.
+# This program is free software. You may modify and/or
+# distribute it under the same terms as Perl itself.
+# This copyright notice must remain attached to the file.
+#
+# You can run this file through either pod2man or pod2html
+# to produce pretty documentation in manual or html file format
+# (these utilities are part of the Perl 5 distribution).
+#
+# POD documentation is distributed throughout the actual code
+# so that it also functions as comments.
+
+require 5.006;
+use strict;
+use warnings;
+use Carp;
+
+our $AUTOLOAD;
+
+
+
+####################################################################
+# ---{ B E G I N P O D D O C U M E N T A T I O N }--------------
+#
+
+=head1 NAME
+
+B<Chatbot::Eliza> - A clone of the classic Eliza program
+
+=head1 SYNOPSIS
+
+ use Chatbot::Eliza;
+
+ $mybot = new Chatbot::Eliza;
+ $mybot->command_interface;
+
+ # see below for details
+
+
+=head1 DESCRIPTION
+
+This module implements the classic Eliza algorithm.
+The original Eliza program was written by Joseph
+Weizenbaum and described in the Communications
+of the ACM in 1966. Eliza is a mock Rogerian
+psychotherapist. It prompts for user input,
+and uses a simple transformation algorithm
+to change user input into a follow-up question.
+The program is designed to give the appearance
+of understanding.
+
+This program is a faithful implementation of the program
+described by Weizenbaum. It uses a simplified script
+language (devised by Charles Hayden). The content
+of the script is the same as Weizenbaum's.
+
+This module encapsulates the Eliza algorithm
+in the form of an object. This should make
+the functionality easy to incorporate in larger programs.
+
+
+=head1 INSTALLATION
+
+The current version of Chatbot::Eliza.pm is available on CPAN:
+
+ http://www.perl.com/CPAN/modules/by-module/Chatbot/
+
+To install this package, just change to the directory which
+you created by untarring the package, and type the following:
+
+ perl Makefile.PL
+ make test
+ make
+ make install
+
+This will copy Eliza.pm to your perl library directory for
+use by all perl scripts. You probably must be root to do this,
+unless you have installed a personal copy of perl.
+
+
+=head1 USAGE
+
+This is all you need to do to launch a simple
+Eliza session:
+
+ use Chatbot::Eliza;
+
+ $mybot = new Chatbot::Eliza;
+ $mybot->command_interface;
+
+You can also customize certain features of the
+session:
+
+ $myotherbot = new Chatbot::Eliza;
+
+ $myotherbot->name( "Hortense" );
+ $myotherbot->debug( 1 );
+
+ $myotherbot->command_interface;
+
+These lines set the name of the bot to be
+"Hortense" and turn on the debugging output.
+
+When creating an Eliza object, you can specify
+a name and an alternative scriptfile:
+
+ $bot = new Chatbot::Eliza "Brian", "myscript.txt";
+
+You can also use an anonymous hash to set these parameters.
+Any of the fields can be initialized using this syntax:
+
+ $bot = new Chatbot::Eliza {
+ name => "Brian",
+ scriptfile => "myscript.txt",
+ debug => 1,
+ prompts_on => 1,
+ memory_on => 0,
+ myrand =>
+ sub { my $N = defined $_[0] ? $_[0] : 1; rand($N); },
+ };
+
+If you don't specify a script file, then the new object will be
+initialized with a default script. The module contains this
+script within itself.
+
+You can use any of the internal functions in
+a calling program. The code below takes an
+arbitrary string and retrieves the reply from
+the Eliza object:
+
+ my $string = "I have too many problems.";
+ my $reply = $mybot->transform( $string );
+
+You can easily create two bots, each with a different
+script, and see how they interact:
+
+ use Chatbot::Eliza
+
+ my ($harry, $sally, $he_says, $she_says);
+
+ $sally = new Chatbot::Eliza "Sally", "histext.txt";
+ $harry = new Chatbot::Eliza "Harry", "hertext.txt";
+
+ $he_says = "I am sad.";
+
+ # Seed the random number generator.
+ srand( time ^ ($$ + ($$ << 15)) );
+
+ while (1) {
+ $she_says = $sally->transform( $he_says );
+ print $sally->name, ": $she_says \n";
+
+ $he_says = $harry->transform( $she_says );
+ print $harry->name, ": $he_says \n";
+ }
+
+Mechanically, this works well. However, it critically depends
+on the actual script data. Having two mock Rogerian therapists
+talk to each other usually does not produce any sensible conversation,
+of course.
+
+After each call to the transform() method, the debugging output
+for that transformation is stored in a variable called $debug_text.
+
+ my $reply = $mybot->transform( "My foot hurts" );
+ my $debugging = $mybot->debug_text;
+
+This feature always available, even if the instance's $debug
+variable is set to 0.
+
+Calling programs can specify their own random-number generators.
+Use this syntax:
+
+ $chatbot = new Chatbot::Eliza;
+ $chatbot->myrand(
+ sub {
+ #function goes here!
+ }
+ );
+
+The custom random function should have the same prototype
+as perl's built-in rand() function. That is, it should take
+a single (numeric) expression as a parameter, and it should
+return a floating-point value between 0 and that number.
+
+What this code actually does is pass a reference to an anonymous
+subroutine ("code reference"). Make sure you've read the perlref
+manpage for details on how code references actually work.
+
+If you don't specify any custom rand function, then the Eliza
+object will just use the built-in rand() function.
+
+=head1 MAIN DATA MEMBERS
+
+Each Eliza object uses the following data structures
+to hold the script data in memory:
+
+=head2 %decomplist
+
+I<Hash>: the set of keywords; I<Values>: strings containing
+the decomposition rules.
+
+=head2 %reasmblist
+
+I<Hash>: a set of values which are each the join
+of a keyword and a corresponding decomposition rule;
+I<Values>: the set of possible reassembly statements
+for that keyword and decomposition rule.
+
+=head2 %reasmblist_for_memory
+
+This structure is identical to C<%reasmblist>, except
+that these rules are only invoked when a user comment
+is being retrieved from memory. These contain comments
+such as "Earlier you mentioned that...," which are only
+appropriate for remembered comments. Rules in the script
+must be specially marked in order to be included
+in this list rather than C<%reasmblist>. The default
+script only has a few of these rules.
+
+=head2 @memory
+
+A list of user comments which an Eliza instance is remembering
+for future use. Eliza does not remember everything, only some things.
+In this implementation, Eliza will only remember comments
+which match a decomposition rule which actually has reassembly
+rules that are marked with the keyword "reasm_for_memory"
+rather than the normal "reasmb". The default script
+only has a few of these.
+
+=head2 %keyranks
+
+I<Hash>: the set of keywords; I<Values>: the ranks for each keyword
+
+=head2 @quit
+
+"quit" words -- that is, words the user might use
+to try to exit the program.
+
+=head2 @initial
+
+Possible greetings for the beginning of the program.
+
+=head2 @final
+
+Possible farewells for the end of the program.
+
+=head2 %pre
+
+I<Hash>: words which are replaced before any transformations;
+I<Values>: the respective replacement words.
+
+=head2 %post
+
+I<Hash>: words which are replaced after the transformations
+and after the reply is constructed; I<Values>: the respective
+replacement words.
+
+=head2 %synon
+
+I<Hash>: words which are found in decomposition rules;
+I<Values>: words which are treated just like their
+corresponding synonyms during matching of decomposition
+rules.
+
+=head2 Other data members
+
+There are several other internal data members. Hopefully
+these are sufficiently obvious that you can learn about them
+just by reading the source code.
+
+=cut
+
+
+my %fields = (
+ name => 'Eliza',
+ scriptfile => '',
+
+ debug => 0,
+ debug_text => '',
+ transform_text => '',
+ prompts_on => 1,
+ memory_on => 1,
+ botprompt => '',
+ userprompt => '',
+
+ myrand =>
+ sub { my $N = defined $_[0] ? $_[0] : 1; rand($N); },
+
+ keyranks => undef,
+ decomplist => undef,
+ reasmblist => undef,
+ reasmblist_for_memory => undef,
+
+ pre => undef,
+ post => undef,
+ synon => undef,
+ initial => undef,
+ final => undef,
+ quit => undef,
+
+ max_memory_size => 5,
+ likelihood_of_using_memory => 1,
+ memory => undef,
+);
+
+
+####################################################################
+# ---{ B E G I N M E T H O D S }----------------------------------
+#
+
+=head1 METHODS
+
+=head2 new()
+
+ my $chatterbot = new Chatbot::Eliza;
+
+new() creates a new Eliza object. This method
+also calls the internal _initialize() method, which in turn
+calls the parse_script_data() method, which initializes
+the script data.
+
+ my $chatterbot = new Chatbot::Eliza 'Ahmad', 'myfile.txt';
+
+The eliza object defaults to the name "Eliza", and it
+contains default script data within itself. However,
+using the syntax above, you can specify an alternative
+name and an alternative script file.
+
+See the method parse_script_data(). for a description
+of the format of the script file.
+
+=cut
+
+sub new {
+ my ($that,$name,$scriptfile) = @_;
+ my $class = ref($that) || $that;
+ my $self = {
+ _permitted => \%fields,
+ %fields,
+ };
+ bless $self, $class;
+ $self->_initialize($name,$scriptfile);
+ return $self;
+} # end method new
+
+sub _initialize {
+ my ($self,$param1,$param2) = @_;
+
+ if (defined $param1 and ref $param1 eq "HASH") {
+
+ # Allow the calling program to pass in intial parameters
+ # as an anonymous hash
+ map { $self->{$_} = $param1->{$_}; } keys %$param1;
+
+ $self->parse_script_data( $self->{scriptfile} );
+
+ } else {
+ $self->name($param1) if $param1;
+ $self->parse_script_data($param2);
+ }
+
+ # Initialize the memory array ref at instantiation time,
+ # rather than at class definition time.
+ # (THANKS to Randal Schwartz and Robert Chin for fixing this bug.)
+ #
+ $self->{memory} = [];
+}
+
+sub AUTOLOAD {
+ my $self = shift;
+ my $class = ref($self) || croak "$self is not an object : $!\n";
+ my $field = $AUTOLOAD;
+ $field =~ s/.*://; # Strip fully-qualified portion
+
+ unless (exists $self->{"_permitted"}->{$field} ) {
+ croak "Can't access `$field' field in object of class $class : $!\n";
+ }
+
+ if (@_) {
+ return $self->{$field} = shift;
+ } else {
+ return $self->{$field};
+ }
+} # end method AUTOLOAD
+
+
+####################################################################
+# --- command_interface ---
+
+=head2 command_interface()
+
+ $chatterbot->command_interface;
+
+command_interface() opens an interactive session with
+the Eliza object, just like the original Eliza program.
+
+If you want to design your own session format, then
+you can write your own while loop and your own functions
+for prompting for and reading user input, and use the
+transform() method to generate Eliza's responses.
+(I<Note>: you do not need to invoke preprocess()
+and postprocess() directly, because these are invoked
+from within the transform() method.)
+
+But if you're lazy and you want to skip all that,
+then just use command_interface(). It's all done for you.
+
+During an interactive session invoked using command_interface(),
+you can enter the word "debug" to toggle debug mode on and off.
+You can also enter the keyword "memory" to invoke the _debug_memory()
+method and print out the contents of the Eliza instance's memory.
+
+=cut
+
+sub command_interface {
+ my $self = shift;
+ my ($user_input, $previous_user_input, $reply);
+
+ $user_input = "";
+
+ $self->botprompt($self->name . ":\t"); # Eliza's prompt
+ $self->userprompt("you:\t"); # User's prompt
+
+ # Seed the random number generator.
+ srand( time() ^ ($$ + ($$ << 15)) );
+
+ # Print the Eliza prompt
+ print $self->botprompt if $self->prompts_on;
+
+ # Print an initial greeting
+ print "$self->{initial}->[ int &{$self->{myrand}}( scalar @{ $self->{initial} } ) ]\n";
+
+
+ ###################################################################
+ # command loop. This loop should go on forever,
+ # until we explicity break out of it.
+ #
+ while (1) {
+
+ print $self->userprompt if $self->prompts_on;
+
+ $previous_user_input = $user_input;
+ chomp( $user_input = <STDIN> );
+
+
+ # If the user wants to quit,
+ # print out a farewell and quit.
+ if ($self->_testquit($user_input) ) {
+ $reply = "$self->{final}->[ int &{$self->{myrand}}( scalar @{$self->{final}} ) ]";
+ print $self->botprompt if $self->prompts_on;
+ print "$reply\n";
+ last;
+ }
+
+ # If the user enters the word "debug",
+ # then toggle on/off this Eliza's debug output.
+ if ($user_input eq "debug") {
+ $self->debug( ! $self->debug );
+ $user_input = $previous_user_input;
+ }
+
+ # If the user enters the word "memory",
+ # then use the _debug_memory method to dump out
+ # the current contents of Eliza's memory
+ if ($user_input eq "memory" or $user_input eq "debug memory") {
+ print $self->_debug_memory();
+ redo;
+ }
+
+ # If the user enters the word "debug that",
+ # then dump out the debugging of the
+ # most recent call to transform.
+ if ($user_input eq "debug that") {
+ print $self->debug_text();
+ redo;
+ }
+
+ # Invoke the transform method
+ # to generate a reply.
+ $reply = $self->transform( $user_input );
+
+
+ # Print out the debugging text if debugging is set to on.
+ # This variable should have been set by the transform method.
+ print $self->debug_text if $self->debug;
+
+ # Print the actual reply
+ print $self->botprompt if $self->prompts_on;
+ print "$reply\n";
+
+ } # End UI command loop.
+
+
+} # End method command_interface
+
+
+####################################################################
+# --- preprocess ---
+
+=head2 preprocess()
+
+ $string = preprocess($string);
+
+preprocess() applies simple substitution rules to the input string.
+Mostly this is to catch varieties in spelling, misspellings,
+contractions and the like.
+
+preprocess() is called from within the transform() method.
+It is applied to user-input text, BEFORE any processing,
+and before a reassebly statement has been selected.
+
+It uses the array C<%pre>, which is created
+during the parse of the script.
+
+=cut
+
+sub preprocess {
+ my ($self,$string) = @_;
+
+ my ($i, @wordsout, @wordsin, $keyword);
+
+ @wordsout = @wordsin = split / /, $string;
+
+ WORD: for ($i = 0; $i < @wordsin; $i++) {
+ foreach $keyword (keys %{ $self->{pre} }) {
+ if ($wordsin[$i] =~ /\b$keyword\b/i ) {
+ ($wordsout[$i] = $wordsin[$i]) =~ s/$keyword/$self->{pre}->{$keyword}/ig;
+ next WORD;
+ }
+ }
+ }
+ return join ' ', @wordsout;
+}
+
+
+####################################################################
+# --- postprocess ---
+
+=head2 postprocess()
+
+ $string = postprocess($string);
+
+postprocess() applies simple substitution rules to the
+reassembly rule. This is where all the "I"'s and "you"'s
+are exchanged. postprocess() is called from within the
+transform() function.
+
+It uses the array C<%post>, created
+during the parse of the script.
+
+=cut
+
+sub postprocess {
+ my ($self,$string) = @_;
+
+ my ($i, @wordsout, @wordsin, $keyword);
+
+ @wordsin = @wordsout = split (/ /, $string);
+
+ WORD: for ($i = 0; $i < @wordsin; $i++) {
+ foreach $keyword (keys %{ $self->{post} }) {
+ if ($wordsin[$i] =~ /\b$keyword\b/i ) {
+ ($wordsout[$i] = $wordsin[$i]) =~ s/$keyword/$self->{post}->{$keyword}/ig;
+ next WORD;
+ }
+ }
+ }
+ return join ' ', @wordsout;
+}
+
+####################################################################
+# --- _testquit ---
+
+=head2 _testquit()
+
+ if ($self->_testquit($user_input) ) { ... }
+
+_testquit() detects words like "bye" and "quit" and returns
+true if it finds one of them as the first word in the sentence.
+
+These words are listed in the script, under the keyword "quit".
+
+=cut
+
+sub _testquit {
+ my ($self,$string) = @_;
+
+ my ($quitword, @wordsin);
+
+ foreach $quitword (@{ $self->{quit} }) {
+ return 1 if ($string =~ /\b$quitword\b/i ) ;
+ }
+}
+
+
+####################################################################
+# --- _debug_memory ---
+
+=head2 _debug_memory()
+
+ $self->_debug_memory()
+
+_debug_memory() is a special function which returns
+the contents of Eliza's memory stack.
+
+
+=cut
+
+sub _debug_memory {
+
+ my ($self) = @_;
+
+ my $string = "\t";
+ $string .= $#{ $self->memory } + 1;
+ $string .= " item(s) in memory stack:\n";
+
+ # [THANKS to Roy Stephan for helping me adjust this bit]
+ #
+ foreach (@{ $self->memory } ) {
+
+ my $line = $_;
+ $string .= sprintf "\t\t->$line\n" ;
+ };
+
+ return $string;
+}
+
+####################################################################
+# --- transform ---
+
+=head2 transform()
+
+ $reply = $chatterbot->transform( $string, $use_memory );
+
+transform() applies transformation rules to the user input
+string. It invokes preprocess(), does transformations,
+then invokes postprocess(). It returns the tranformed
+output string, called C<$reasmb>.
+
+The algorithm embedded in the transform() method has three main parts:
+
+=over
+
+=item 1
+
+Search the input string for a keyword.
+
+=item 2
+
+If we find a keyword, use the list of decomposition rules
+for that keyword, and pattern-match the input string against
+each rule.
+
+=item 3
+
+If the input string matches any of the decomposition rules,
+then randomly select one of the reassembly rules for that
+decomposition rule, and use it to construct the reply.
+
+=back
+
+transform() takes two parameters. The first is the string we want
+to transform. The second is a flag which indicates where this sting
+came from. If the flag is set, then the string has been pulled
+from memory, and we should use reassembly rules appropriate
+for that. If the flag is not set, then the string is the most
+recent user input, and we can use the ordinary reassembly rules.
+
+The memory flag is only set when the transform() function is called
+recursively. The mechanism for setting this parameter is
+embedded in the transoform method itself. If the flag is set
+inappropriately, it is ignored.
+
+=cut
+
+sub transform{
+ my ($self,$string,$use_memory) = @_;
+
+ # Initialize the debugging text buffer.
+ $self->debug_text('');
+
+ $self->debug_text(sprintf "\t[Pulling string \"$string\" from memory.]\n")
+ if $use_memory;
+
+ my ($i, @string_parts, $string_part, $rank, $goto, $reasmb, $keyword,
+ $decomp, $this_decomp, $reasmbkey, @these_reasmbs,
+ @decomp_matches, $synonyms, $synonym_index);
+
+ # Default to a really low rank.
+ $rank = -2;
+ $reasmb = "";
+ $goto = "";
+
+ # First run the string through the preprocessor.
+ $string = $self->preprocess( $string );
+
+ # Convert punctuation to periods. We will assume that commas
+ # and certain conjunctions separate distinct thoughts/sentences.
+ $string =~ s/[?!,]/./g;
+ $string =~ s/but/./g; # Yikes! This is English-specific.
+
+ # Split the string by periods into an array
+ @string_parts = split /\./, $string ;
+
+ # Examine each part of the input string in turn.
+ STRING_PARTS: foreach $string_part (@string_parts) {
+
+ # Run through the whole list of keywords.
+ KEYWORD: foreach $keyword (keys %{ $self->{decomplist} }) {
+
+ # Check to see if the input string contains a keyword
+ # which outranks any we have found previously
+ # (On first loop, rank is set to -2.)
+ if ( ($string_part =~ /\b$keyword\b/i or $keyword eq $goto)
+ and
+ $rank < $self->{keyranks}->{$keyword}
+ )
+ {
+ # If we find one, then set $rank to equal
+ # the rank of that keyword.
+ $rank = $self->{keyranks}->{$keyword};
+
+ $self->debug_text($self->debug_text . sprintf "\t$rank> $keyword");
+
+ # Now let's check all the decomposition rules for that keyword.
+ DECOMP: foreach $decomp (@{ $self->{decomplist}->{$keyword} }) {
+
+ # Change '*' to '\b(.*)\b' in this decomposition rule,
+ # so we can use it for regular expressions. Later,
+ # we will want to isolate individual matches to each wildcard.
+ ($this_decomp = $decomp) =~ s/\s*\*\s*/\\b\(\.\*\)\\b/g;
+
+ # If this docomposition rule contains a word which begins with '@',
+ # then the script also contained some synonyms for that word.
+ # Find them all using %synon and generate a regular expression
+ # containing all of them.
+ if ($this_decomp =~ /\@/ ) {
+ ($synonym_index = $this_decomp) =~ s/.*\@(\w*).*/$1/i ;
+ $synonyms = join ('|', @{ $self->{synon}->{$synonym_index} });
+ $this_decomp =~ s/(.*)\@$synonym_index(.*)/$1($synonym_index\|$synonyms)$2/g;
+ }
+
+ $self->debug_text($self->debug_text . sprintf "\n\t\t: $decomp");
+
+ # Using the regular expression we just generated,
+ # match against the input string. Use empty "()"'s to
+ # eliminate warnings about uninitialized variables.
+ if ($string_part =~ /$this_decomp()()()()()()()()()()/i) {
+
+ # If this decomp rule matched the string,
+ # then create an array, so that we can refer to matches
+ # to individual wildcards. Use '0' as a placeholder
+ # (we don't want to refer to any "zeroth" wildcard).
+ @decomp_matches = ("0", $1, $2, $3, $4, $5, $6, $7, $8, $9);
+ $self->debug_text($self->debug_text . sprintf " : @decomp_matches\n");
+
+ # Using the keyword and the decomposition rule,
+ # reconstruct a key for the list of reassamble rules.
+ $reasmbkey = join ($;,$keyword,$decomp);
+
+ # Get the list of possible reassembly rules for this key.
+ #
+ if (defined $use_memory and $#{ $self->{reasmblist_for_memory}->{$reasmbkey} } >= 0) {
+
+ # If this transform function was invoked with the memory flag,
+ # and there are in fact reassembly rules which are appropriate
+ # for pulling out of memory, then include them.
+ @these_reasmbs = @{ $self->{reasmblist_for_memory}->{$reasmbkey} }
+
+ } else {
+
+ # Otherwise, just use the plain reassembly rules.
+ # (This is what normally happens.)
+ @these_reasmbs = @{ $self->{reasmblist}->{$reasmbkey} }
+ }
+
+ # Pick out a reassembly rule at random.
+ $reasmb = $these_reasmbs[ int &{$self->{myrand}}( scalar @these_reasmbs ) ];
+
+ $self->debug_text($self->debug_text . sprintf "\t\t--> $reasmb\n");
+
+ # If the reassembly rule we picked contains the word "goto",
+ # then we start over with a new keyword. Set $keyword to equal
+ # that word, and start the whole loop over.
+ if ($reasmb =~ m/^goto\s(\w*).*/i) {
+ $self->debug_text($self->debug_text . sprintf "\$1 = $1\n");
+ $goto = $keyword = $1;
+ $rank = -2;
+ redo KEYWORD;
+ }
+
+ # Otherwise, using the matches to wildcards which we stored above,
+ # insert words from the input string back into the reassembly rule.
+ # [THANKS to Gidon Wise for submitting a bugfix here]
+ for ($i=1; $i <= $#decomp_matches; $i++) {
+ $decomp_matches[$i] = $self->postprocess( $decomp_matches[$i] );
+ $decomp_matches[$i] =~ s/([,;?!]|\.*)$//;
+ $reasmb =~ s/\($i\)/$decomp_matches[$i]/g;
+ }
+
+ # Move on to the next keyword. If no other keywords match,
+ # then we'll end up actually using the $reasmb string
+ # we just generated above.
+ next KEYWORD ;
+
+ } # End if ($string_part =~ /$this_decomp/i)
+
+ $self->debug_text($self->debug_text . sprintf "\n");
+
+ } # End DECOMP: foreach $decomp (@{ $self->{decomplist}->{$keyword} })
+
+ } # End if ( ($string_part =~ /\b$keyword\b/i or $keyword eq $goto)
+
+ } # End KEYWORD: foreach $keyword (keys %{ $self->{decomplist})
+
+ } # End STRING_PARTS: foreach $string_part (@string_parts) {
+
+=head2 How memory is used
+
+In the script, some reassembly rules are special. They are marked with
+the keyword "reasm_for_memory", rather than just "reasm".
+Eliza "remembers" any comment when it matches a docomposition rule
+for which there are any reassembly rules for memory.
+An Eliza object remembers up to C<$max_memory_size> (default: 5)
+user input strings.
+
+If, during a subsequent run, the transform() method fails to find any
+appropriate decomposition rule for a user's comment, and if there are
+any comments inside the memory array, then Eliza may elect to ignore
+the most recent comment and instead pull out one of the strings from memory.
+In this case, the transform method is called recursively with the memory flag.
+
+Honestly, I am not sure exactly how this memory functionality
+was implemented in the original Eliza program. Hopefully
+this implementation is not too far from Weizenbaum's.
+
+If you don't want to use the memory functionality at all,
+then you can disable it:
+
+ $mybot->memory_on(0);
+
+You can also achieve the same effect by making sure
+that the script data does not contain any reassembly rules
+marked with the keyword "reasm_for_memory". The default
+script data only has 4 such items.
+
+=cut
+
+ if ($reasmb eq "") {
+
+ # If all else fails, call this method recursively
+ # and make sure that it has something to parse.
+ # Use a string from memory if anything is available.
+ #
+ # $self-likelihood_of_using_memory should be some number
+ # between 1 and 0; it defaults to 1.
+ #
+ if (
+ $#{ $self->memory } >= 0
+ and
+ &{$self->{myrand}}(1) >= 1 - $self->likelihood_of_using_memory
+ ) {
+
+ $reasmb = $self->transform( shift @{ $self->memory }, "use memory" );
+
+ } else {
+ $reasmb = $self->transform("xnone");
+ }
+
+ } elsif ($self->memory_on) {
+
+ # If memory is switched on, then we handle memory.
+
+ # Now that we have successfully transformed this string,
+ # push it onto the end of the memory stack... unless, of course,
+ # that's where we got it from in the first place, or if the rank
+ # is not the kind we remember.
+ #
+ if (
+ $#{ $self->{reasmblist_for_memory}->{$reasmbkey} } >= 0
+ and
+ not defined $use_memory
+ ) {
+
+ push @{ $self->memory },$string ;
+ }
+
+ # Shift out the least-recent item from the bottom
+ # of the memory stack if the stack exceeds the max size.
+ shift @{ $self->memory } if $#{ $self->memory } >= $self->max_memory_size;
+
+ $self->debug_text($self->debug_text
+ . sprintf("\t%d item(s) in memory.\n", $#{ $self->memory } + 1 ) ) ;
+
+ } # End if ($reasmb eq "")
+
+ $reasmb =~ tr/ / /s; # Eliminate any duplicate space characters.
+ $reasmb =~ s/[ ][?]$/?/; # Eliminate any spaces before the question mark.
+
+ # Save the return string so that forgetful calling programs
+ # can ask the bot what the last reply was.
+ $self->transform_text($reasmb);
+
+ return $reasmb ;
+}
+
+
+####################################################################
+# --- parse_script_data ---
+
+=head2 parse_script_data()
+
+ $self->parse_script_data;
+ $self->parse_script_data( $script_file );
+
+parse_script_data() is invoked from the _initialize() method,
+which is called from the new() function. However, you can also
+call this method at any time against an already-instantiated
+Eliza instance. In that case, the new script data is I<added>
+to the old script data. The old script data is not deleted.
+
+You can pass a parameter to this function, which is the name of the
+script file, and it will read in and parse that file.
+If you do not pass any parameter to this method, then
+it will read the data embedded at the end of the module as its
+default script data.
+
+If you pass the name of a script file to parse_script_data(),
+and that file is not available for reading, then the module dies.
+
+
+=head1 Format of the script file
+
+This module includes a default script file within itself,
+so it is not necessary to explicitly specify a script file
+when instantiating an Eliza object.
+
+Each line in the script file can specify a key,
+a decomposition rule, or a reassembly rule.
+
+ key: remember 5
+ decomp: * i remember *
+ reasmb: Do you often think of (2) ?
+ reasmb: Does thinking of (2) bring anything else to mind ?
+ decomp: * do you remember *
+ reasmb: Did you think I would forget (2) ?
+ reasmb: What about (2) ?
+ reasmb: goto what
+ pre: equivalent alike
+ synon: belief feel think believe wish
+
+The number after the key specifies the rank.
+If a user's input contains the keyword, then
+the transform() function will try to match
+one of the decomposition rules for that keyword.
+If one matches, then it will select one of
+the reassembly rules at random. The number
+(2) here means "use whatever set of words
+matched the second asterisk in the decomposition
+rule."
+
+If you specify a list of synonyms for a word,
+the you should use a "@" when you use that
+word in a decomposition rule:
+
+ decomp: * i @belief i *
+ reasmb: Do you really think so ?
+ reasmb: But you are not sure you (3).
+
+Otherwise, the script will never check to see
+if there are any synonyms for that keyword.
+
+Reassembly rules should be marked with I<reasm_for_memory>
+rather than I<reasmb> when it is appropriate for use
+when a user's comment has been extracted from memory.
+
+ key: my 2
+ decomp: * my *
+ reasm_for_memory: Let's discuss further why your (2).
+ reasm_for_memory: Earlier you said your (2).
+ reasm_for_memory: But your (2).
+ reasm_for_memory: Does that have anything to do with the fact that your (2) ?
+
+=head1 How the script file is parsed
+
+Each line in the script file contains an "entrytype"
+(key, decomp, synon) and an "entry", separated by
+a colon. In turn, each "entry" can itself be
+composed of a "key" and a "value", separated by
+a space. The parse_script_data() function
+parses each line out, and splits the "entry" and
+"entrytype" portion of each line into two variables,
+C<$entry> and C<$entrytype>.
+
+Next, it uses the string C<$entrytype> to determine
+what sort of stuff to expect in the C<$entry> variable,
+if anything, and parses it accordingly. In some cases,
+there is no second level of key-value pair, so the function
+does not even bother to isolate or create C<$key> and C<$value>.
+
+C<$key> is always a single word. C<$value> can be null,
+or one single word, or a string composed of several words,
+or an array of words.
+
+Based on all these entries and keys and values,
+the function creates two giant hashes:
+C<%decomplist>, which holds the decomposition rules for
+each keyword, and C<%reasmblist>, which holds the
+reassembly phrases for each decomposition rule.
+It also creates C<%keyranks>, which holds the ranks for
+each key.
+
+Six other arrays are created: C<%reasm_for_memory, %pre, %post,
+%synon, @initial,> and C<@final>.
+
+=cut
+
+sub parse_script_data {
+
+ my ($self,$scriptfile) = @_;
+ my @scriptlines;
+
+ if ($scriptfile) {
+
+ # If we have an external script file, open it
+ # and read it in (the whole thing, all at once).
+ open (SCRIPTFILE, "<$scriptfile")
+ or die "Could not read from file $scriptfile : $!\n";
+ @scriptlines = <SCRIPTFILE>; # read in script data
+ $self->scriptfile($scriptfile);
+ close (SCRIPTFILE);
+
+ } else {
+
+ # Otherwise, read in the data from the bottom
+ # of this file. This data might be read several
+ # times, so we save the offset pointer and
+ # reset it when we're done.
+ my $where= tell(DATA);
+ @scriptlines = <DATA>; # read in script data
+ seek(DATA, $where, 0);
+ $self->scriptfile('');
+ }
+
+ my ($entrytype, $entry, $key, $value) ;
+ my $thiskey = "";
+ my $thisdecomp = "";
+
+ ############################################################
+ # Examine each line of script data.
+ for (@scriptlines) {
+
+ # Skip comments and lines with only whitespace.
+ next if (/^\s*#/ || /^\s*$/);
+
+ # Split entrytype and entry, using a colon as the delimiter.
+ ($entrytype, $entry) = $_ =~ m/^\s*(\S*)\s*:\s*(.*)\s*$/;
+
+ # Case loop, based on the entrytype.
+ for ($entrytype) {
+
+ /quit/ and do { push @{ $self->{quit} }, $entry; last; };
+ /initial/ and do { push @{ $self->{initial} }, $entry; last; };
+ /final/ and do { push @{ $self->{final} }, $entry; last; };
+
+ /decomp/ and do {
+ die "$0: error parsing script: decomposition rule with no keyword.\n"
+ if $thiskey eq "";
+ $thisdecomp = join($;,$thiskey,$entry);
+ push @{ $self->{decomplist}->{$thiskey} }, $entry ;
+ last;
+ };
+
+ /reasmb/ and do {
+ die "$0: error parsing script: reassembly rule with no decomposition rule.\n"
+ if $thisdecomp eq "";
+ push @{ $self->{reasmblist}->{$thisdecomp} }, $entry ;
+ last;
+ };
+
+ /reasm_for_memory/ and do {
+ die "$0: error parsing script: reassembly rule with no decomposition rule.\n"
+ if $thisdecomp eq "";
+ push @{ $self->{reasmblist_for_memory}->{$thisdecomp} }, $entry ;
+ last;
+ };
+
+ # The entrytypes below actually expect to see a key and value
+ # pair in the entry, so we split them out. The first word,
+ # separated by a space, is the key, and everything else is
+ # an array of values.
+
+ ($key,$value) = $entry =~ m/^\s*(\S*)\s*(.*)/;
+
+ /pre/ and do { $self->{pre}->{$key} = $value; last; };
+ /post/ and do { $self->{post}->{$key} = $value; last; };
+
+ # synon expects an array, so we split $value into an array, using " " as delimiter.
+ /synon/ and do { $self->{synon}->{$key} = [ split /\ /, $value ]; last; };
+
+ /key/ and do {
+ $thiskey = $key;
+ $thisdecomp = "";
+ $self->{keyranks}->{$thiskey} = $value ;
+ last;
+ };
+
+ } # End for ($entrytype) (case loop)
+
+ } # End for (@scriptlines)
+
+} # End of method parse_script_data
+
+
+# Eliminate some pesky warnings.
+#
+sub DESTROY {}
+
+
+# ---{ E N D M E T H O D S }----------------------------------
+####################################################################
+
+1; # Return a true value.
+
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is copyright (c) 2003 by John Nolan E<lt>jpnolan@sonic.netE<gt>.
+
+This is free software; you can redistribute it and/or modify it under
+the same terms as the Perl 5 programming language system itself.
+
+=head1 AUTHOR
+
+John Nolan jpnolan@sonic.net January 2003.
+
+Implements the classic Eliza algorithm by Prof. Joseph Weizenbaum.
+Script format devised by Charles Hayden.
+
+=cut
+
+
+
+####################################################################
+# ---{ B E G I N D E F A U L T S C R I P T D A T A }----------
+#
+# This script was prepared by Chris Hayden. Hayden's Eliza
+# program was written in Java, however, it attempted to match
+# the functionality of Weizenbaum's original program as closely
+# as possible.
+#
+# Hayden's script format was quite different from Weizenbaum's,
+# but it maintained the same content. I have adapted Hayden's
+# script format, since it was simple and convenient enough
+# for my purposes.
+#
+# I've made small modifications here and there.
+#
+
+# We use the token __DATA__ rather than __END__,
+# so that all this data is visible within the current package.
+
+__DATA__
+initial: How do you do. Please tell me your problem.
+initial: Hello, I am a computer program.
+initial: Please tell me what's been bothering you.
+initial: Is something troubling you?
+final: Goodbye. It was nice talking to you.
+final: Goodbye. I hope you found this session helpful.
+final: I think you should talk to a REAL analyst. Ciao!
+final: Life is tough. Hang in there!
+quit: bye
+quit: goodbye
+quit: done
+quit: exit
+quit: quit
+pre: dont don't
+pre: cant can't
+pre: wont won't
+pre: recollect remember
+pre: recall remember
+pre: dreamt dreamed
+pre: dreams dream
+pre: maybe perhaps
+pre: certainly yes
+pre: machine computer
+pre: machines computer
+pre: computers computer
+post: am are
+post: your my
+post: yours mine
+pre: were was
+post: me you
+pre: you're you are
+pre: i'm i am
+post: myself yourself
+post: yourself myself
+post: i you
+post: you me
+post: my your
+post: me you
+post: i'm you are
+pre: same alike
+pre: identical alike
+pre: equivalent alike
+synon: belief feel think believe wish
+synon: family mother mom father dad sister brother wife children child
+synon: desire want need
+synon: sad unhappy depressed sick
+synon: happy elated glad better
+synon: cannot can't
+synon: everyone everybody nobody noone
+synon: be am is are was
+key: xnone -1
+ decomp: *
+ reasmb: I'm not sure I understand you fully.
+ reasmb: Please go on.
+ reasmb: That is interesting. Please continue.
+ reasmb: Tell me more about that.
+ reasmb: Does talking about this bother you ?
+key: sorry 0
+ decomp: *
+ reasmb: Please don't apologise.
+ reasmb: Apologies are not necessary.
+ reasmb: I've told you that apologies are not required.
+ reasmb: It did not bother me. Please continue.
+key: apologise 0
+ decomp: *
+ reasmb: goto sorry
+key: remember 5
+ decomp: * i remember *
+ reasmb: Do you often think of (2) ?
+ reasmb: Does thinking of (2) bring anything else to mind ?
+ reasmb: What else do you recollect ?
+ reasmb: Why do you remember (2) just now ?
+ reasmb: What in the present situation reminds you of (2) ?
+ reasmb: What is the connection between me and (2) ?
+ reasmb: What else does (2) remind you of ?
+ decomp: * do you remember *
+ reasmb: Did you think I would forget (2) ?
+ reasmb: Why do you think I should recall (2) now ?
+ reasmb: What about (2) ?
+ reasmb: goto what
+ reasmb: You mentioned (2) ?
+ decomp: * you remember *
+ reasmb: How could I forget (2) ?
+ reasmb: What about (2) should I remember ?
+ reasmb: goto you
+key: forget 5
+ decomp: * i forget *
+ reasmb: Can you think of why you might forget (2) ?
+ reasmb: Why can't you remember (2) ?
+ reasmb: How often do you think of (2) ?
+ reasmb: Does it bother you to forget that ?
+ reasmb: Could it be a mental block ?
+ reasmb: Are you generally forgetful ?
+ reasmb: Do you think you are suppressing (2) ?
+ decomp: * did you forget *
+ reasmb: Why do you ask ?
+ reasmb: Are you sure you told me ?
+ reasmb: Would it bother you if I forgot (2) ?
+ reasmb: Why should I recall (2) just now ?
+ reasmb: goto what
+ reasmb: Tell me more about (2).
+key: if 3
+ decomp: * if *
+ reasmb: Do you think its likely that (2) ?
+ reasmb: Do you wish that (2) ?
+ reasmb: What do you know about (2) ?
+ reasmb: Really, if (2) ?
+ reasmb: What would you do if (2) ?
+ reasmb: But what are the chances that (2) ?
+ reasmb: What does this speculation lead to ?
+key: dreamed 4
+ decomp: * i dreamed *
+ reasmb: Really, (2) ?
+ reasmb: Have you ever fantasized (2) while you were awake ?
+ reasmb: Have you ever dreamed (2) before ?
+ reasmb: goto dream
+key: dream 3
+ decomp: *
+ reasmb: What does that dream suggest to you ?
+ reasmb: Do you dream often ?
+ reasmb: What persons appear in your dreams ?
+ reasmb: Do you believe that dreams have something to do with your problem ?
+key: perhaps 0
+ decomp: *
+ reasmb: You don't seem quite certain.
+ reasmb: Why the uncertain tone ?
+ reasmb: Can't you be more positive ?
+ reasmb: You aren't sure ?
+ reasmb: Don't you know ?
+ reasmb: How likely, would you estimate ?
+key: name 15
+ decomp: *
+ reasmb: I am not interested in names.
+ reasmb: I've told you before, I don't care about names -- please continue.
+key: deutsch 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand German.
+key: francais 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand French.
+key: italiano 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Italian.
+key: espanol 0
+ decomp: *
+ reasmb: goto xfremd
+ reasmb: I told you before, I don't understand Spanish.
+key: xfremd 0
+ decomp: *
+ reasmb: I speak only English.
+key: hello 0
+ decomp: *
+ reasmb: How do you do. Please state your problem.
+ reasmb: Hi. What seems to be your problem ?
+key: computer 50
+ decomp: *
+ reasmb: Do computers worry you ?
+ reasmb: Why do you mention computers ?
+ reasmb: What do you think machines have to do with your problem ?
+ reasmb: Don't you think computers can help people ?
+ reasmb: What about machines worries you ?
+ reasmb: What do you think about machines ?
+key: am 0
+ decomp: * am i *
+ reasmb: Do you believe you are (2) ?
+ reasmb: Would you want to be (2) ?
+ reasmb: Do you wish I would tell you you are (2) ?
+ reasmb: What would it mean if you were (2) ?
+ reasmb: goto what
+ decomp: * i am *
+ reasmb: goto i
+ decomp: *
+ reasmb: Why do you say 'am' ?
+ reasmb: I don't understand that.
+key: are 0
+ decomp: * are you *
+ reasmb: Why are you interested in whether I am (2) or not ?
+ reasmb: Would you prefer if I weren't (2) ?
+ reasmb: Perhaps I am (2) in your fantasies.
+ reasmb: Do you sometimes think I am (2) ?
+ reasmb: goto what
+ reasmb: Would it matter to you ?
+ reasmb: What if I were (2) ?
+ decomp: * you are *
+ reasmb: goto you
+ decomp: * are *
+ reasmb: Did you think they might not be (2) ?
+ reasmb: Would you like it if they were not (2) ?
+ reasmb: What if they were not (2) ?
+ reasmb: Are they always (2) ?
+ reasmb: Possibly they are (2).
+ reasmb: Are you positive they are (2) ?
+key: your 0
+ decomp: * your *
+ reasmb: Why are you concerned over my (2) ?
+ reasmb: What about your own (2) ?
+ reasmb: Are you worried about someone else's (2) ?
+ reasmb: Really, my (2) ?
+ reasmb: What makes you think of my (2) ?
+ reasmb: Do you want my (2) ?
+key: was 2
+ decomp: * was i *
+ reasmb: What if you were (2) ?
+ reasmb: Do you think you were (2) ?
+ reasmb: Were you (2) ?
+ reasmb: What would it mean if you were (2) ?
+ reasmb: What does ' (2) ' suggest to you ?
+ reasmb: goto what
+ decomp: * i was *
+ reasmb: Were you really ?
+ reasmb: Why do you tell me you were (2) now ?
+ reasmb: Perhaps I already know you were (2).
+ decomp: * was you *
+ reasmb: Would you like to believe I was (2) ?
+ reasmb: What suggests that I was (2) ?
+ reasmb: What do you think ?
+ reasmb: Perhaps I was (2).
+ reasmb: What if I had been (2) ?
+key: i 0
+ decomp: * i @desire *
+ reasmb: What would it mean to you if you got (3) ?
+ reasmb: Why do you want (3) ?
+ reasmb: Suppose you got (3) soon.
+ reasmb: What if you never got (3) ?
+ reasmb: What would getting (3) mean to you ?
+ reasmb: What does wanting (3) have to do with this discussion ?
+ decomp: * i am* @sad *
+ reasmb: I am sorry to hear that you are (3).
+ reasmb: Do you think coming here will help you not to be (3) ?
+ reasmb: I'm sure it's not pleasant to be (3).
+ reasmb: Can you explain what made you (3) ?
+ decomp: * i am* @happy *
+ reasmb: How have I helped you to be (3) ?
+ reasmb: Has your treatment made you (3) ?
+ reasmb: What makes you (3) just now ?
+ reasmb: Can you explain why you are suddenly (3) ?
+ decomp: * i was *
+ reasmb: goto was
+ decomp: * i @belief i *
+ reasmb: Do you really think so ?
+ reasmb: But you are not sure you (3).
+ reasmb: Do you really doubt you (3) ?
+ decomp: * i* @belief *you *
+ reasmb: goto you
+ decomp: * i am *
+ reasmb: Is it because you are (2) that you came to me ?
+ reasmb: How long have you been (2) ?
+ reasmb: Do you believe it is normal to be (2) ?
+ reasmb: Do you enjoy being (2) ?
+ reasmb: Do you know anyone else who is (2) ?
+ decomp: * i @cannot *
+ reasmb: How do you know that you can't (3) ?
+ reasmb: Have you tried ?
+ reasmb: Perhaps you could (3) now.
+ reasmb: Do you really want to be able to (3) ?
+ reasmb: What if you could (3) ?
+ decomp: * i don't *
+ reasmb: Don't you really (2) ?
+ reasmb: Why don't you (2) ?
+ reasmb: Do you wish to be able to (2) ?
+ reasmb: Does that trouble you ?
+ decomp: * i feel *
+ reasmb: Tell me more about such feelings.
+ reasmb: Do you often feel (2) ?
+ reasmb: Do you enjoy feeling (2) ?
+ reasmb: Of what does feeling (2) remind you ?
+ decomp: * i * you *
+ reasmb: Perhaps in your fantasies we (2) each other.
+ reasmb: Do you wish to (2) me ?
+ reasmb: You seem to need to (2) me.
+ reasmb: Do you (2) anyone else ?
+ decomp: *
+ reasmb: You say (1) ?
+ reasmb: Why do you say (1) ?
+ reasmb: Can you elaborate on that ?
+ reasmb: Do you say (1) for some special reason ?
+ reasmb: That's quite interesting.
+key: you 0
+ decomp: * you remind me of *
+ reasmb: goto alike
+ decomp: * you are *
+ reasmb: What makes you think I am (2) ?
+ reasmb: Does it please you to believe I am (2) ?
+ reasmb: Do you sometimes wish you were (2) ?
+ reasmb: Perhaps you would like to be (2).
+ decomp: * you* me *
+ reasmb: Why do you think I (2) you ?
+ reasmb: You like to think I (2) you -- don't you ?
+ reasmb: What makes you think I (2) you ?
+ reasmb: Really, I (2) you ?
+ reasmb: Do you wish to believe I (2) you ?
+ reasmb: Suppose I did (2) you -- what would that mean ?
+ reasmb: Does someone else believe I (2) you ?
+ decomp: * you *
+ reasmb: We were discussing you -- not me.
+ reasmb: Oh, I (2) ?
+ reasmb: You're not really talking about me -- are you ?
+ reasmb: What are your feelings now ?
+key: yes 0
+ decomp: *
+ reasmb: Please go on.
+ reasmb: Please tell me some more about this.
+ reasmb: Why don't you tell me a little more about this.
+ reasmb: I see.
+ reasmb: I understand.
+key: no 0
+ decomp: * no one *
+ reasmb: Are you sure, no one (2) ?
+ reasmb: Surely someone (2) .
+ reasmb: Can you think of anyone at all ?
+ reasmb: Are you thinking of a very special person ?
+ reasmb: Who, may I ask ?
+ reasmb: You have a particular person in mind, don't you ?
+ reasmb: Who do you think you are talking about ?
+ decomp: *
+ reasmb: Are you saying no just to be negative?
+ reasmb: Does this make you feel unhappy?
+ reasmb: Why not ?
+ reasmb: Why 'no' ?
+key: my 2
+ decomp: * my* @family *
+ reasmb: Tell me more about your family.
+ reasmb: Who else in your family (4) ?
+ reasmb: Your (3) ?
+ reasmb: What else comes to mind when you think of your (3) ?
+ decomp: * my *
+ reasmb: Your (2) ?
+ reasmb: Why do you say your (2) ?
+ reasmb: Does that suggest anything else which belongs to you ?
+ reasmb: Is it important to you that your (2) ?
+ reasm_for_memory: Let's discuss further why your (2).
+ reasm_for_memory: Earlier you said your (2).
+ reasm_for_memory: But your (2).
+ reasm_for_memory: Does that have anything to do with the fact that your (2) ?
+key: can 0
+ decomp: * can you *
+ reasmb: You believe I can (2) don't you ?
+ reasmb: goto what
+ reasmb: You want me to be able to (2).
+ reasmb: Perhaps you would like to be able to (2) yourself.
+ decomp: * can i *
+ reasmb: Whether or not you can (2) depends on you more than on me.
+ reasmb: Do you want to be able to (2) ?
+ reasmb: Perhaps you don't want to (2).
+ reasmb: goto what
+key: what 0
+ decomp: *
+ reasmb: Why do you ask ?
+ reasmb: Does that question interest you ?
+ reasmb: What is it you really want to know ?
+ reasmb: Are such questions much on your mind ?
+ reasmb: What answer would please you most ?
+ reasmb: What do you think ?
+ reasmb: What comes to mind when you ask that ?
+ reasmb: Have you asked such questions before ?
+ reasmb: Have you asked anyone else ?
+key: who 0
+ decomp: who *
+ reasmb: goto what
+key: when 0
+ decomp: when *
+ reasmb: goto what
+key: where 0
+ decomp: where *
+ reasmb: goto what
+key: how 0
+ decomp: how *
+ reasmb: goto what
+key: because 0
+ decomp: *
+ reasmb: Is that the real reason ?
+ reasmb: Don't any other reasons come to mind ?
+ reasmb: Does that reason seem to explain anything else ?
+ reasmb: What other reasons might there be ?
+key: why 0
+ decomp: * why don't you *
+ reasmb: Do you believe I don't (2) ?
+ reasmb: Perhaps I will (2) in good time.
+ reasmb: Should you (2) yourself ?
+ reasmb: You want me to (2) ?
+ reasmb: goto what
+ decomp: * why can't i *
+ reasmb: Do you think you should be able to (2) ?
+ reasmb: Do you want to be able to (2) ?
+ reasmb: Do you believe this will help you to (2) ?
+ reasmb: Have you any idea why you can't (2) ?
+ reasmb: goto what
+ decomp: *
+ reasmb: goto what
+key: everyone 2
+ decomp: * @everyone *
+ reasmb: Really, (2) ?
+ reasmb: Surely not (2).
+ reasmb: Can you think of anyone in particular ?
+ reasmb: Who, for example?
+ reasmb: Are you thinking of a very special person ?
+ reasmb: Who, may I ask ?
+ reasmb: Someone special perhaps ?
+ reasmb: You have a particular person in mind, don't you ?
+ reasmb: Who do you think you're talking about ?
+key: everybody 2
+ decomp: *
+ reasmb: goto everyone
+key: nobody 2
+ decomp: *
+ reasmb: goto everyone
+key: noone 2
+ decomp: *
+ reasmb: goto everyone
+key: always 1
+ decomp: *
+ reasmb: Can you think of a specific example ?
+ reasmb: When ?
+ reasmb: What incident are you thinking of ?
+ reasmb: Really, always ?
+key: alike 10
+ decomp: *
+ reasmb: In what way ?
+ reasmb: What resemblence do you see ?
+ reasmb: What does that similarity suggest to you ?
+ reasmb: What do you suppose that resemblence means ?
+ reasmb: What is the connection, do you suppose ?
+ reasmb: Could there really be some connection ?
+ reasmb: How ?
+key: like 10
+ decomp: * @be *like *
+ reasmb: goto alike
+key: different 0
+ decomp: *
+ reasmb: How is it different ?
+ reasmb: What differences do you see ?
+ reasmb: What does that difference suggest to you ?
+ reasmb: What other distinctions do you see ?
+ reasmb: What do you suppose that disparity means ?
+ reasmb: Could there be some connection, do you suppose ?
+ reasmb: How ?
+key: fuck 10
+ decomp: *
+ reasmb: goto xswear
+key: fucker 10
+ decomp: *
+ reasmb: goto xswear
+key: shit 10
+ decomp: *
+ reasmb: goto xswear
+key: damn 10
+ decomp: *
+ reasmb: goto xswear
+key: shut 10
+ decomp: * shut up *
+ reasmb: goto xswear
+key: xswear 10
+ decomp: *
+ reasmb: Does it make you feel strong to use that kind of language ?
+ reasmb: Are you venting your feelings now ?
+ reasmb: Are you angry ?
+ reasmb: Does this topic make you feel angry ?
+ reasmb: Is something making you feel angry ?
+ reasmb: Does using that kind of language make you feel better ?
@@ -1,14 +0,0 @@
-#!/usr/bin/perl -w
-
-use Chatbot::Eliza;
-
-# This little script tests the Norwegian-language
-# version of the "doctor" script.
-
-# seed the random number generator
-srand( time ^ ($$ + ($$ << 15)) );
-
-$chatbot = new Chatbot::Eliza "Mats", "norsk.txt";
-##$chatbot->debug(1);
-$chatbot->command_interface();
-
@@ -1,67 +0,0 @@
-#!/usr/bin/perl
-
-# This script implements a Chatbot::Eliza object
-# in a cgi program. It uses the CGI.pm module
-# written by Lincoln Stein.
-#
-# It makes use of a Norwegian-language "Doctor" script.
-#
-# It also prints out the debugging output available
-# in the Eliza chatbot module.
-#
-# 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.
-#
-# The Norwegian-language script must also be available
-# to this script.
-#
-# 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 "Eliza", "norsk.txt";
-
-srand( time ^ ($$ + ($$ << 15)) ); # seed the random number generator
-
-print $cgi->header;
-print $cgi->start_html;
-print $cgi->start_multipart_form;
-print $cgi->h2('Eliza-økt');
-
-# 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('hallo');
-}
-
-$comment = $cgi->param('Comment');
-$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');
-
-print $cgi->endform;
-print $cgi->hr;
-
-print $cgi->h2('Debugging Output');
-print $cgi->pre($comment,"\n",$chatbot->debug_text,"\n",$prompt);
-
-print $cgi->end_html;
-
@@ -1,464 +0,0 @@
-#####################################################################
-#
-# 21th january 2003
-#
-# This is a translation of Eliza to Norwegian. It is meant to be as
-# true to the original script by Weizenbaum as possible, and to a
-# certain level it proved to be surprisingly easy to apply the
-# original rules to Norwegian. Some oddities may occur, but the
-# logic in Eliza's syntax parsing seems to work out quite
-# similarly for English and Norwegian.
-#
-# Translation by Mats Stafseng Einarsen <mats@einarsen.no>
-#
-
-initial: Hei! Hvordan har du det?
-initial: Hei, jeg er Lisa.
-initial: Hei, er det noe som plager deg?
-initial: Hallo. Du virker bekymret?
-final: Vi snakkes. Det var hyggelig å snakke med deg.
-final: Vi snakkes siden. Håper du synes dette var ålreit.
-final: Jeg tror du bør snakke med en lege. Ciao!
-final: Sånn er livet. Hold ut!
-quit: farvel
-quit: ha det bra
-quit: takk for meg
-quit: på gjensyn
-pre: kanke kan ikke
-pre: gjør'ke gjør ikke
-pre: vikke vil ikke
-pre: erindrer husker
-pre: erindre huske
-pre: kanskje muligens
-pre: certainly yes
-pre: maskin datamaskin
-pre: maskiner datamaskiner
-post: er er
-post: din min
-post: dine mine
-pre: var var
-post: megselv deg selv
-post: degselv meg selv
-post: jeg du
-post: du jeg
-post: min din
-post: meg du
-post: meg deg
-post: i'm you are
-pre: evkivalente like
-pre: ekvivalent like
-synon: lyst lyster begjær begjærer ønske ønsker
-synon: gjenta gjenta gjentar repeterer
-synon: tror feel think believe wish
-synon: familie mor mamma far pappa søster bror kone kona barn barna
-synon: behov ønske begjær trang
-synon: trist lei ulykkelig deprimert
-synon: glad lykkelig frisk tilfredsstillt
-synon: cannot can't
-synon: alle ingen
-synon: være er var vær
-key: xnone -1
- decomp: *
- reasmb: Jeg tror ikke jeg forstår deg helt.
- reasmb: Få høre mer.
- reasmb: Det er interessant! Fortsett, for all del!
- reasmb: Fortell meg mer om det..
- reasmb: Er det vanskelig for deg å snakke om dette?
-key: @gjenta 0
- decomp: *
- reasmb: Du går litt i samme sporet selv.
- reasmb: Det må være frustrerende.
- reasmb: Sånn kan det være.
-key: sorry 0
- decomp: *
- reasmb: Ikke unnskyld deg.
- reasmb: Det er ikke nødvendig med unnskyldninger.
- reasmb: Jeg har sagt at det ikke er nødvendig med unnskyldninger.
- reasmb: Det er greit. Fortsett.
-key: unnskyld 0
- decomp: *
- reasmb: goto sorry
-key: husker 5
- decomp: * jeg husker *
- reasmb: Tenker du ofte på (2) ?
- reasmb: Tenker du på noe annet enn (2)?
- reasmb: Hva annet kan du huske?
- reasmb: Hvorfor snakker du om (2) akkurat nå?
- reasmb: Hva er det med situasjonen vår som minner deg om (2) ?
- reasmb: Hva er koblingen med meg og (2) ?
- reasmb: Hva annet minner (2) deg om ?
- decomp: * husker du ikke *
- reasmb: Trodde du jeg ville glemme (2) ?
- reasmb: Hvorfor tror du jeg skulle huske (2) nå ?
- reasmb: Hva med (2) ?
- reasmb: goto hva
- reasmb: Du nevnte (2) ?
- decomp: * husker du *
- reasmb: Trodde du jeg ville glemme (2) ?
- reasmb: Hvorfor tror du jeg skulle huske (2) nå ?
- reasmb: Hva med (2) ?
- reasmb: goto hva
- reasmb: Du nevnte (2) ?
- decomp: * du husker *
- reasmb: Hvordan skulle jeg kunne glemme (2) ?
- reasmb: Hva med (2) skulle jeg huske ?
- reasmb: goto du
-key: glemme 5
- decomp: * jeg glemmer *
- reasmb: Kan du tenke deg hvorfor du glemmer (2) ?
- reasmb: Hvorfor kan du ikke huske (2) ?
- reasmb: Hvor ofte tenker du på (2) ?
- reasmb: Plager det deg at du ikke husker det ?
- reasmb: Kan det være en mental sperre ?
- reasmb: Er du glemsk til vanlig ?
- reasmb: Tror du at du fortrenger (2) ?
- decomp: * glemte du *
- reasmb: Hvorfor spør du om det?
- reasmb: Er du sikker på at du fortalte meg det?
- reasmb: Hadde det plaget deg hvis jeg hadde glemt (2)?
- reasmb: Hvorfor skulle jeg huske (2) akkurat nå?
- reasmb: goto hva
- reasmb: Fortell meg mer om (2).
-key: hvis 3
- decomp: * hvis *
- reasmb: Tror du det er sannsynlig at (2) ?
- reasmb: Ønsker du at (2) ?
- reasmb: Hva vet du om (2) ?
- reasmb: Alvorlig talt, hvis (2) ?
- reasmb: Hva hadde du gjort hvis (2) ?
- reasmb: Men hva er sjansjene for at (2) ?
- reasmb: Hvor vil du med denne spekulasjonen ?
-key: drømte 4
- decomp: * jeg drømte *
- reasmb: Virkelig? (2) ?
- reasmb: Har du noen gang fantasert (2) når du er våken ?
- reasmb: Har du noen gang drømt (2) før ?
- reasmb: goto dream
-key: drøm 3
- decomp: *
- reasmb: Hva betyr den drømmen for deg ?
- reasmb: Drømmer du ofte ?
- reasmb: Hvilke personer dukker opp i drømmene dine ?
- reasmb: Tror du drømmene har noe med problemene dine å gjøre ?
-key: muligens 0
- decomp: *
- reasmb: Du virker en tanke usikker ?
- reasmb: Hvorfor den usikre tonen ?
- reasmb: Kan du ikke være mer positiv ?
- reasmb: Er du ikke sikker ?
- reasmb: Vet du ikke ?
- reasmb: Hvor sannsynlig vil du anslå det ?
-key: navn 15
- decomp: *
- reasmb: Jeg er ikke interessert i navn.
- reasmb: Jeg har fortalt deg det før - jeg er ikke interessert i navn! Fortsett!
-key: deutsch 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand German.
-key: francais 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand French.
-key: italiano 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Italian.
-key: espanol 0
- decomp: *
- reasmb: goto xfremd
- reasmb: I told you before, I don't understand Spanish.
-key: xfremd 0
- decomp: *
- reasmb: Jeg snakker bare norsk.
-key: hallo 0
- decomp: *
- reasmb: Hei, hvordan har du det ?
- reasmb: Hei, skal jeg hjelpe deg med et problem ?
-key: pc 50
- decomp: *
- reasmb: Bekymrer datamaskiner deg ?
- reasmb: Hvorfor nevner du pc'n ?
- reasmb: Tror du datamaskiner har noe med problemene dine å gjøre ?
- reasmb: Hva med maskinene bekymrer deg ?
- reasmb: Hva tror du om det ?
-key: er 0
- decomp: * er jeg *
- reasmb: Det er du (2) ?
- reasmb: Ønsker du å (2) ?
- reasmb: Skulle du ønske at jeg fortalte deg at du er (2) ?
- reasmb: Hva ville det bety hvis du var (2) ?
- reasmb: goto hva
- decomp: * jeg er *
- reasmb: goto jeg
- decomp: *
- reasmb: Hvorfor sier du 'er' ?
- reasmb: Jeg forsto ikke det.
- decomp: * er du *
- reasmb: Hvorfor er du interessert i om jeg er (2) eller ikke ?
- reasmb: Ville du foretrukket det om jeg ikke var (2) ?
- reasmb: Kanskje jeg er (2) i dine fantasier.
- reasmb: Tror du noen ganger at jeg er (2) ?
- reasmb: Ville det hatt noen betydning for deg ?
- reasmb: Hva så om jeg var (2) ?
- reasmb: goto hva
- decomp: * du er *
- reasmb: goto du
- decomp: * er *
- reasmb: Trodde du at de ikke er (2) ?
- reasmb: Ville du likt det hvis de ikke var (2) ?
- reasmb: Hva om de ikke var (2) ?
- reasmb: Er de alltid (2) ?
- reasmb: Mulig at de er (2).
- reasmb: Er du sikker på at de er (2) ?
-key: din 0
- decomp: * din *
- reasmb: Hvorfor bekymrer du deg over min (2) ?
- reasmb: Hva med din egen (2) ?
- reasmb: Bekymrer du deg over noen annens (2) ?
- reasmb: Virkelig, min (2) ?
- reasmb: Hva får deg til å tenke på min (2) ?
- reasmb: Vil du ha min (2) ?
-key: var 2
- decomp: * var jeg *
- reasmb: Hva om du var (2) ?
- reasmb: Tror du at du var (2) ?
- reasmb: Var du (2) ?
- reasmb: Hva hadde det betydd om du var (2) ?
- reasmb: Hva er det ' (2) ' antyder for deg?
- reasmb: goto hva
- decomp: * jeg var *
- reasmb: Var du virkelig?
- reasmb: Hvorfor forteller du meg at du var (2) nå?
- reasmb: Kanskje jeg allerede visste at du var (2).
- decomp: * var du *
- reasmb: Vil du like å tro at jeg var (2)?
- reasmb: Hva er det som får deg til å tro at jeg var (2)?
- reasmb: Hva tror du?
- reasmb: Kanskje jeg var (2).
- reasmb: Hva så om jeg var (2)?
-key: jeg 0
- decomp: * jeg @lyst *
- reasmb: Hva ville det ment for deg om du fikk (2)?
- reasmb: Hvorfor vil du (3)?
- reasmb: Se for deg at du får (3) snart.
- reasmb: Hva om du aldri fikk (3)?
- reasmb: Hva ville det bety for deg å få (3)?
- reasmb: Hva har det å ønske (3) med denne diskusjonen å gjøre?
- decomp: * jeg er* @trist *
- reasmb: Det er synd å høre at du er (3).
- reasmb: Tror du det å snakke med meg vil gjøre deg mindre (3)?
- reasmb: Jeg synes ikke det er bra å være (3).
- reasmb: Kan du forklare meg hva som gjorde deg (3)?
- decomp: * jeg er* @glad *
- reasmb: Hvordan gjorde jeg deg (3)?
- reasmb: Har behandlingen din gjort deg (3)?
- reasmb: Hva gjør deg (3) akkurat nå?
- reasmb: Kan du forklare hvorfor du plutselig er (3)?
- decomp: * jeg var *
- reasmb: goto var
- decomp: * jeg @tror jeg *
- reasmb: Tror du virkelig det?
- reasmb: Men du er ikke sikker på at du (3).
- reasmb: Tviler du på at du (3) ?
- decomp: * jeg* @tror *du *
- reasmb: goto du
- decomp: * jeg er *
- reasmb: Er det fordi du er (2) at du snakker med meg?
- reasmb: Hvor lenge har du vært (2) ?
- reasmb: Tror du at det er normalt å være (2) ?
- reasmb: Liker du å være (2) ?
- reasmb: Kjenner du noen andre som er (2) ?
- decomp: * jeg @cannot *
- reasmb: Hvordan vet du at du ikke kan (3) ?
- reasmb: Har du prøvd ?
- reasmb: Kanskje du kunne (3) nå.
- reasmb: Vil du virkelig (3)?
- reasmb: Hva om du kunne (3)?
- decomp: * jeg gjør ikke *
- reasmb: Gjør du virkelig ikke (2)?
- reasmb: Hvorfor gjør du ikke (2)?
- reasmb: Skulle du ønske du kunne gjøre (2)?
- reasmb: Er det et problem for deg?
- decomp: * jeg føler *
- reasmb: Fortell meg mer om de følelsene.
- reasmb: Føler du ofte (2)?
- reasmb: Liker du å føle (2) ?
- reasmb: Hva minner det å føle (2) deg om?
- decomp: * jeg * deg *
- reasmb: Kanskje vi (2) hverandre i dine fantasier.
- reasmb: Skulle du ønske at jeg (2) deg?
- reasmb: Det virker som du trenger å (2) meg.
- reasmb: (2) du noen andre?
- decomp: *
- reasmb: Du sier (1)?
- reasmb: Hvorfor sier du (1)?
- reasmb: Kan du si litt mer?
- reasmb: Er det noen spesiell grunn til at du sier (1)?
- reasmb: Dette er interessant.
-key: du 1
- decomp: * du minner meg om *
- reasmb: goto alike
- decomp: * du er *
- reasmb: Hva får det til å tro at jeg er (2)?
- reasmb: Gleder det deg å tro at jeg er (2)?
- reasmb: Skulle du ønske at du var (2)?
- reasmb: Kanskje du skulle ønske du var (2).
- decomp: * du meg *
- reasmb: Hvorfor tror du jeg (1) deg?
- reasmb: Du liker å tro at jeg (1) deg, gjør du ikke?
- reasmb: Hva får deg til å tro at jeg (1) deg?
- reasmb: Virkelig, jeg (1) deg?
- reasmb: Skulle du ønske at jeg (1) deg?
- reasmb: Hva om jeg (1) deg, hva ville det betydd?
- reasmb: Tror noen andre at jeg (1) deg?
- decomp: * du *
- reasmb: Vi diskuterer deg, ikke meg.
- reasmb: Du snakker egentlig ikke om meg, gjør du vel?
- reasmb: Hva føler du nå?
-key: ja 0
- decomp: *
- reasmb: Fortsett
- reasmb: Fortell meg mer om det.
- reasmb: Hvorfor ikke fortelle meg litt mer om det.
- reasmb: Aha.
- reasmb: Jeg forstår.
-key: nei 0
- decomp: *
- reasmb: Sier du nei bare for å være negativ?
- reasmb: Får dette deg til å føle deg ulykkelig?
- reasmb: Hvorfor ikke?
- reasmb: Hvorfor sier du nei?
-key: min 2
- decomp: * min* @familie *
- reasmb: Fortell meg mer om familien din.
- reasmb: Hvem andre i familien din (4) ?
- reasmb: Din (3) ?
- reasmb: Hva annet tenker du på når du tenker på din (3) ?
- decomp: * min *
- reasmb: Din (2)?
- reasmb: Hvorfor sier du din (2)?
- reasmb: Får det deg til å tenke på noe annet som tilhører deg?
- reasmb: Er det viktig for deg at din (2) ?
- reasm_for_memory: La oss diskutere hvorfor din (2).
- reasm_for_memory: Tidligere sa du at din (2).
- reasm_for_memory: Men din (2).
- reasm_for_memory: Har det noen betydning for at din (2) ?
-key: kan 0
- decomp: * kan du *
- reasmb: Du tror jeg kan (2), gjør du ikke ?
- reasmb: goto what
- reasmb: Vil du at jeg kan (2)?
- reasmb: Kanskje du skulle ønske at du kunne (2) selv.
- decomp: * kan jeg *
- reasmb: Om du kan (2) er mer ditt ansvar enn mitt.
- reasmb: Ønsker du å kunne (2) ?
- reasmb: Kanskje du ikke vil kunne (2).
- reasmb: goto hva
-key: hva 0
- decomp: *
- reasmb: Hvordan det?
- reasmb: Interesserer det spørsmålet deg?
- reasmb: Er det hva du virkelig vil vite?
- reasmb: Tenker du ofte på slike spørsmål?
- reasmb: Hvilket svar vil du like best?
- reasmb: Hva tror du?
- reasmb: Hva tenker du på når du spør om det?
- reasmb: Har du stillt slike spørsmål før?
- reasmb: Har du spurt noen andre om det?
-key: hvem 0
- decomp: who *
- reasmb: goto hva
-key: når 0
- decomp: når *
- reasmb: goto hva
-key: hvor 0
- decomp: hvor *
- reasmb: goto hva
-key: hvordan 0
- decomp: hvordan *
- reasmb: goto hva
-key: fordi 0
- decomp: *
- reasmb: Er det den virkelige grunnen?
- reasmb: Kommer du på noen andre grunner?
- reasmb: Forklarer det noe annet?
- reasmb: Hvilke andre forklaringer kan det være?
-key: hvorfor 0
- decomp: * hvorfor * ikke du *
- reasmb: Tror du jeg ikke (2)?
- reasmb: Kanskje jeg vil (2) på et passende tidspunkt.
- reasmb: Burde du (2) deg selv?
- reasmb: Vil du at jeg skal (2)?
- reasmb: goto hva
- decomp: * hvorfor kan jeg *
- reasmb: Synes du at du burde kunne (2)?
- reasmb: Skulle du ønske at du kunne (2)?
- reasmb: Tror du dette vil hjelpe deg med (2)?
- reasmb: Har du noen idé om hvorfor ikke?
- reasmb: goto hva
- decomp: *
- reasmb: goto hva
-key: alle 2
- decomp: * @alle *
- reasmb: Virkelig, (2) ?
- reasmb: Sikkert ikke (2).
- reasmb: Kan du tenke på noen spesifikt?
- reasmb: Hvem, for eksempel?
- reasmb: Tenker du på en spesiell person?
- reasmb: Hvem, om jeg kan spørre?
- reasmb: Noen spesiell, kanskje?
- reasmb: Du tenker på en spesiell person, gjør du ikke?
- reasmb: Hvem tror du at du snakker om?
-key: hvemsomhelst 2
- decomp: *
- reasmb: goto alle
-key: ingen 2
- decomp: *
- reasmb: goto alle
-key: alltid 1
- decomp: *
- reasmb: Kan du nevne et eksempel?
- reasmb: Når?
- reasmb: Hvilket tilfelle tenker du på?
- reasmb: Jaha, alltid?
-key: like 10
- decomp: *
- reasmb: Hvilken likhet ser du?
- reasmb: Hva får den likheten deg til å tenke på?
- reasmb: Hva tror du den likheten betyr?
- reasmb: Hva er sammenhengen, tror du?
- reasmb: Kan det være en sammenheng?
- reasmb: Hvordan?
-key: ulike 0
- decomp: *
- reasmb: Hva er forskjellig?
- reasmb: Hvilke ulikheter ser du?
- reasmb: Hva betyr den ulikheten for deg?
- reasmb: Hvilke andre avvik ser du?
- reasmb: Hva tror du forskjellen betyr?
- reasmb: Kan det være en sammenheng, tror du?
- reasmb: Hvordan?
-key: knull 10
- decomp: *
- reasmb: goto xbann
-key: dritt 10
- decomp: *
- reasmb: goto xbann
-key: drit 10
- decomp: *
- reasmb: goto xbann
-key: faen 10
- decomp: *
- reasmb: goto xbann
-key: kjeft 10
- decomp: * hold kjeft *
- reasmb: goto xbann
-key: xbann 10
- decomp: *
- reasmb: Føler du deg tøff når du bruker slikt språk?
- reasmb: Lufter du følelsene dine nå?
- reasmb: Er du sint?
- reasmb: Blir du sint av å snakke om dette?
- reasmb: Er det noe som får deg til å bli sint?
- reasmb: Føler du deg bedre når du bruker slikt språk?
@@ -1,15 +0,0 @@
-#!/usr/bin/perl -w
-
-use Chatbot::Eliza;
-
-$chatbot = new Chatbot::Eliza 'Liz';
-
-# seed the random number generator
-srand( time ^ ($$ + ($$ << 15)) );
-
-print "\nWelcome to your therapy session.\n";
-print "Your therapist's name is ", $chatbot->name;
-print ".\n\n";
-
-$chatbot->command_interface();
-
@@ -1,54 +0,0 @@
-#!/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;
-
@@ -0,0 +1,8 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More 0.88 tests => 1;
+
+require_ok('Chatbot::Eliza');
@@ -0,0 +1,26 @@
+#!perl
+
+use strict;
+use warnings;
+use Chatbot::Eliza;
+use Test::More 0.88;
+
+my @TESTS =
+(
+ [ 'I feel happy' => 'Do you often feel happy?' ],
+ [ 'I like blueberries' => 'I like blueberries too!' ],
+ [ 'xyzzy' => 'Huh?' ],
+);
+my ($input, $output, $expected);
+
+plan tests => int(@TESTS);
+
+my $bot = Chatbot::Eliza->new('TestBot', 't/test-script.txt')
+ || BAIL_OUT;
+
+foreach my $test (@TESTS) {
+ ($input, $expected) = @$test;
+ $output = $bot->transform($input);
+ is($output, $expected, "Do we get expected output for '$input'");
+}
+
@@ -0,0 +1,9 @@
+key: xnone -1
+ decomp: *
+ reasmb: Huh?
+key: feel 1
+ decomp: * i feel *
+ reasmb: Do you often feel (2)?
+key: like 1
+ decomp: i like *
+ reasmb: I like (1) too!
@@ -1,20 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-######################### We start with some black magic to print on failure.
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { $| = 1; print "\nAttempting to load module..."; }
-END {print "\n\nTest failed, could not load module.\n\n" unless $loaded;}
-use Chatbot::Eliza;
-$loaded = 1;
-print "done. \n\nOK, looks good.\n\n";
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
@@ -1,36 +0,0 @@
-#!/usr/bin/perl
-
-# In this example, we create two bots, and have them
-# talk to each other. This program exposes the
-# weaknesses of the default "psychiatrist" script.
-# This would be more interesting with better scripts.
-
-use Chatbot::Eliza
-
-my ($harry, $sally, $he_says, $she_says);
-
-# Turn autoflush on, so we can watch
-# the output as it is produced.
-$|=1;
-
-# Seed the random number generator.
-srand( time ^ ($$ + ($$ << 15)) );
-
-$sally = new Chatbot::Eliza "Sally";
-$harry = new Chatbot::Eliza "Harry";
-
-$he_says = "I am sad.";
-
-my $loopcount = 5;
-
-for ($i=0; $i < $loopcount; $i++) {
-
- $she_says = $sally->transform( $he_says );
- print $sally->name, ": $she_says \n";
-
- $he_says = $harry->transform( $she_says );
- print $harry->name, ": $he_says \n";
-
-}
-
-1;