Saturday, July 21, 2007

Eliza Loves You - Rogerian psychotherapist

Recently I ported the ElizaLovesYou Gaim plugin to Pidgin. Click here to download the source. Most conversations with the Eliza bot are quite uninteresting. But the one I saw today needs special mention. It is one of the most interesting conversations I've seen with Eliza bot.Here goes the conversation. Scroll down to read the code.

(05:51:39 PM) J: alo
(05:51:39 PM) Codeshepherd's Bot: Hi J/Talk.v104FA524C95, The maniac is sleeping or eating or buzy doing some shit!!!.
(05:51:39 PM) Codeshepherd's Bot: I am his dumb slave bot :). You can speak to me if you want!!!
(05:51:50 PM) J: hi Jayshree and arch here
(05:51:51 PM) Codeshepherd's Bot: Please go on.
(05:52:27 PM) J: hello
(05:52:28 PM) Codeshepherd's Bot: How do you do. Please state your problem.
(05:52:58 PM) J: i'm fine. how r u?
(05:52:59 PM) Codeshepherd's Bot: Do you say you'm fine for some special reason?
(05:53:45 PM) J: yes cause we re are goibg to the ice cream parlor
(05:53:46 PM) Codeshepherd's Bot: Please go on.
(05:54:17 PM) J: how do u do?
(05:54:18 PM) Codeshepherd's Bot: Why do you ask?
(05:54:35 PM) J: generaaly i'm concerned about your health
(05:54:36 PM) Codeshepherd's Bot: Do you want my health?
(05:55:11 PM) J: how can i take your health?
(05:55:12 PM) Codeshepherd's Bot: What is it you really want to know?
(05:55:42 PM) J: generally how are you?
(05:55:43 PM) Codeshepherd's Bot: Oh, I?
(05:55:54 PM) J: yes you only..
(05:55:55 PM) Codeshepherd's Bot: I understand.
(05:56:15 PM) J: ok give me the answer..
(05:56:16 PM) Codeshepherd's Bot: Please go on.
(05:56:30 PM) J: how are you?
(05:56:31 PM) Codeshepherd's Bot: What are your feelings now?
(05:57:09 PM) J: i'm still wondering why are you not answering my question?
(05:57:10 PM) Codeshepherd's Bot: Is it important to you that your question?
(05:57:32 PM) J: yes..
(05:57:33 PM) Codeshepherd's Bot: Please go on.
(05:58:08 PM) J: no problems in life
(05:58:09 PM) Codeshepherd's Bot: Why 'no'?
(05:58:42 PM) J: because i stay happy all the time..
(05:58:43 PM) Codeshepherd's Bot: You say because you stay happy all the time?
(05:58:50 PM) J: yes..
(05:58:51 PM) Codeshepherd's Bot: Please tell me some more about this.
(05:59:12 PM) J: being sad is again sad...
(05:59:13 PM) Codeshepherd's Bot: Earlier you said your question.
(05:59:55 PM) J: yes, i was asking you how are you?
(05:59:56 PM) Codeshepherd's Bot: Why do you tell me you were asking me how are me now?
(06:00:15 PM) J: okies i'm confused now..
(06:00:16 PM) Codeshepherd's Bot: Why do you say okies you'm confused now?
(06:00:49 PM) J: because you don't seem to answering my question.
(06:00:50 PM) Codeshepherd's Bot: Why do you say your question?
(06:01:10 PM) J: i think i should talk somethiong else..
(06:01:11 PM) Codeshepherd's Bot: Do you really doubt you should talk somethiong else?
(06:01:39 PM) J: no i don't have ant doubts..
(06:01:40 PM) Codeshepherd's Bot: Why 'no'?
(06:01:59 PM) J: because i'm clear
(06:02:00 PM) Codeshepherd's Bot: Do you say because you'm clear for some special reason?
(06:02:28 PM) J: yes because i have taken bath 2day..
(06:02:29 PM) Codeshepherd's Bot: Please go on.
(06:02:40 PM) J: did you take bath?
(06:02:41 PM) Codeshepherd's Bot: You're not really talking about me -- are you?
(06:02:56 PM) J: yes i'm talking about you.
(06:02:57 PM) Codeshepherd's Bot: Why don't you tell me a little more about this.
(06:03:08 PM) J: like what?
(06:03:09 PM) Codeshepherd's Bot: But your question.
(06:03:23 PM) J: i forgot my question..
(06:03:24 PM) Codeshepherd's Bot: Is it important to you that your question?
(06:03:37 PM) J: no not important.
(06:03:38 PM) Codeshepherd's Bot: Why 'no'?
(06:04:03 PM) J: pk let me move on to somthng else.
(06:04:04 PM) Codeshepherd's Bot: But your question.
(06:04:17 PM) J: i discad that question
(06:04:18 PM) Codeshepherd's Bot: Why do you say you discad that question?
(06:04:34 PM) J: i;m not interested in that question..
(06:04:35 PM) Codeshepherd's Bot: Can you elaborate on that?
(06:04:40 PM) J: no
(06:04:41 PM) Codeshepherd's Bot: Why not?
(06:04:59 PM) J: because i forgo my quetion
(06:05:00 PM) Codeshepherd's Bot: Is it important to you that your quetion?
(06:05:10 PM) J: not important
(06:05:11 PM) Codeshepherd's Bot: But your quetion.
(06:05:41 PM) J: hello can you type some other line
(06:05:42 PM) Codeshepherd's Bot: We were discussing you -- not me.
(06:05:57 PM) J: oh sorry..
(06:05:58 PM) Codeshepherd's Bot: I've told you that apologies are not required.
(06:06:20 PM) J: thanks for reminding e
(06:06:21 PM) Codeshepherd's Bot: That is interesting. Please continue.
(06:06:38 PM) J: i don;t have anything to say now
(06:06:39 PM) Codeshepherd's Bot: You say you don;t have anything to say now?
(06:07:17 PM) J: yes
(06:07:18 PM) Codeshepherd's Bot: Please tell me some more about this.
(06:07:46 PM) J: we are going to the ice cream parlour to eat ice ceam
(06:07:47 PM) Codeshepherd's Bot: Would you like it if they were not going to the ice cream parlour to eat ice ceam?
(06:08:09 PM) J: no i will not like it.
(06:08:10 PM) Codeshepherd's Bot: Why not?
(06:08:30 PM) J: because i want to eat ice cream
(06:08:31 PM) Codeshepherd's Bot: What would it mean to you if you got to eat ice cream?
(06:08:51 PM) J: i would be happy
(06:08:52 PM) Codeshepherd's Bot: Why do you say you would be happy?
(06:09:07 PM) J: because i like ice cream
(06:09:08 PM) Codeshepherd's Bot: That is interesting. Please continue.
(06:09:44 PM) J: ice cream is creamy and cold, that makes it good thing to eat after food
(06:09:45 PM) Codeshepherd's Bot: Does talking about this bother you?
(06:09:57 PM) J: no not at all
(06:09:58 PM) Codeshepherd's Bot: Why 'no'?
(06:10:23 PM) J: why should i have problem with it?
(06:10:24 PM) Codeshepherd's Bot: That's quite interesting.
(06:10:29 PM) J: hmm
(06:10:30 PM) Codeshepherd's Bot: That is interesting. Please continue.
(06:10:43 PM) J: ok now i'm tired
(06:10:44 PM) Codeshepherd's Bot: Can you elaborate on that?
(06:10:52 PM) J: tell me some stories
(06:10:53 PM) Codeshepherd's Bot: Please go on.
(06:11:10 PM) J: ya tell me cindrella story.
(06:11:11 PM) Codeshepherd's Bot: Tell me more about that.
(06:11:23 PM) J: you have to tell me that.
(06:11:24 PM) Codeshepherd's Bot: Do you wish to believe I have to tell you?
(06:11:38 PM) J: yes
(06:11:39 PM) Codeshepherd's Bot: Why don't you tell me a little more about this.
(06:13:25 PM) J: i don't have anything more to say.
(06:13:26 PM) Codeshepherd's Bot: Why do you say you don't have anything more to say?
(06:14:11 PM) J: ok bye!
(06:14:12 PM) Codeshepherd's Bot: Please go on.


#ElizaLovesYou v0.4
#Changes
#Ported v0.3 to Pidgin by Deepan Chakravarthy
#Email: codeshepherd AT gmail DOT com
#Thanks to sadrul and resiak on #pidgin@irc.freenode.net and Davo_Dinkum on ##English@irc.freenode.net for their help.
#ElizaLovesYou v0.3 - Rogerian psychotherapist for Pidgin
#Copyright (C) 2004 Scott Wolchok
#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 2
#of the License, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#(You can find the GPL at http://www.gnu.org/copyleft/gpl.html)
#You'll need to install Chatbot::Eliza from CPAN before this will work.
#Run 'perl -MCPAN -e "shell"' and answer the questions, then type
#'install Chatbot::Eliza' at the prompt. That should do it!
#'install Pidgin' at the prompt
#'install Purple' at the prompt
#Please note that this plugin is just a hook for the Perl Chatbot::Eliza
#module - the credit for the actual "bot" goes to the John Nolan, the
#writer of that module.
#Superdug is great!!!!



use Pidgin;
use Purple;
use Chatbot::Eliza;
use strict;

my %bots;
my $plugin;
my $data = "";
#my @timeouts; #Pidgin segfaults if we leave the send_message timeout and unload the plugin

%::PLUGIN_INFO = (
perl_api_version => 2,
name => "ElizaLovesYou",
version => "0.4",
summary => "Rogerian psychotherapist for Pidgin",
description => "Automatically responds to incoming messages on all accounts using the Eliza algorithm",
author => "Scott Wolchok ",
url => "www.codeshepherd.com/downloads/elizalovesyou.pl",
load => "plugin_load",
unload => "plugin_unload"
);

sub plugin_init
{
return %::PLUGIN_INFO;
}

sub do_eliza
{
my $im;
my ($account, $sender, $message, $conv, $flags) = @_;
$bots{$sender} = new Chatbot::Eliza unless $bots{$sender};

while($message =~ s/<.*?>//)
{
}; #HTML si t3h sux0r!
if($conv)
{
my $theIM = $conv->get_im_data();

#Tried to use a queue to hold timeouts so we could remove them at plugin_unload - the thing segfaults if there's a timeout pending and you unload it
# push @timeouts, Pidgin::timeout_add($plugin,10,\&send_message,[$theIM,$bots{$sender}->transform($message)]);
Purple::timeout_add($plugin,1,\&send_message,[$theIM,$bots{$sender}->transform($message)]);

Purple::Debug::info($::PLUGIN_INFO{name}, "tutorialpluginLeaving do_eliza\n");
}

else
{
$conv = Purple::Conversation->new(1, $account, $sender);
if ($conv)
{
print "ok.\n";
$im = $conv->get_im_data();

# Here we send messages to the conversation
$im->send("Hi $sender, The maniac is sleeping or eating or buzy doing some shit!!!.");
$im->send("I am his dumb slave bot :). You can speak to me if you want!!!");
}
else
{
}

}
}

sub send_message
{
Purple::Debug::info($::PLUGIN_INFO{name}, "tutorialpluginEntering send_message\n");
my ($IM, $message) = @{$_[0]};

Purple::Debug::info($::PLUGIN_INFO{name}, "Shifting timeouts\n");
#shift @timeouts;

Purple::Debug::info($::PLUGIN_INFO{name}, "tutorialpluginSending message\n");
Purple::Conversation::IM::send($IM,$message);

return undef;
}
sub plugin_load
{
$plugin = shift;

my $conversations_handle = Purple::Conversations::get_handle();
Purple::Signal::connect($conversations_handle, "received-im-msg", $plugin, \&do_eliza, $data);
}

sub plugin_unload
{
my $plugin = shift;

# for my $timeout (@timeouts) {
# Pidgin::timeout_remove($timeout);
# }
}

#Note: I got this from forsaken in #gaim on FreeNode and renamed it to getIM, his original credit follows:
#From Split.pl and edited.
#Michael Wozniak and Anthony Noto
sub getIM
{
my $thing = $_[0];
my @im_array = Purple::ims(); #get the array of IM's
foreach my $element (@im_array)
{
if ( Purple::Conversation::get_name( Purple::Conversation::IM::get_conversation ( $element ) ) eq $thing )
{
return $element; #return the correct IM
}
}

return undef;
}


31 comments:

Priyank Bolia said...

Thanks man for the great piece of code.

Anonymous said...

hi, its very informative, awesome tees , thanks

outofmemoryerror in java said...

fantastic article, here is another one which I found good.
What is garbage collection

Anonymous said...

hey i have been using it and works very well, but i cant make it work in ubuntu 10.04

any clue?

Mounika said...

Hello I am so delighted I found your blog, I really found you by mistake, while I was looking on Yahoo for something else, anyways I am here now and would just like to say thanks for a tremendous post. Please do keep up the great work.
Click here:
python training in marathahalli
Click here:
python training in btm

shethal said...

This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.. 
Devops Training in Chennai
Devops Training in Bangalore

shalinipriya said...

Well somehow I got to read lots of articles on your blog. It’s amazing how interesting it is for me to visit you very often.

Data Science training in kalyan nagar | Data Science training in OMR
Data Science training in chennai | Data science training in velachery
Data science training in tambaram | Data science training in jaya nagar

Anonymous said...

Very well written blog and I always love to read blogs like these because they offer very good information to readers with very less amount of words....thanks for sharing your info with us and keep sharing.
angularjs online Training

angularjs Training in marathahalli

angularjs interview questions and answers

angularjs Training in bangalore

angularjs Training in bangalore

luckys said...

indian whatsapp group links

gautham said...

thanks for your post blockchain training in hyderabad

raju said...

nice blogs thanks for sharing.......!
inplant training in chennai
inplant training in chennai for it.php
panama web hosting
syria hosting
services hosting
afghanistan shared web hosting
andorra web hosting
belarus web hosting
brunei darussalam hosting
inplant training in chennai

shree said...

very nice....
inplant training in chennai
inplant training in chennai
inplant training in chennai for it
namibia web hosting
norway web hosting
rwanda web hosting
spain hosting
turkey web hosting
venezuela hosting
vietnam shared web hosting

shri said...

nice...
internship in chennai for ece students
internships in chennai for cse students 2019
Inplant training in chennai
internship for eee students
free internship in chennai
eee internship in chennai
internship for ece students in chennai
inplant training in bangalore for cse
inplant training in bangalore
ccna training in chennai


ammu said...

good blogs.....!!!
chile web hosting
colombia web hosting
croatia web hosting
cyprus web hosting
bahrain web hosting
india web hosting
iran web hosting
kazakhstan web hosting
korea web hosting
moldova web hosting

varsha said...


I have really enjoyed sharing your website. thank you so much for your sharing this document. this document more useful and improve our knowledge.

AWS training in chennai | AWS training in annanagar | AWS training in omr | AWS training in porur | AWS training in tambaram | AWS training in velachery

nizam said...

it is one of the great blog to explore many things
BEST ANGULAR JS TRAINING IN CHENNAI WITH PLACEMENT

https://www.acte.in/angular-js-training-in-chennai
https://www.acte.in/angular-js-training-in-annanagar
https://www.acte.in/angular-js-training-in-omr
https://www.acte.in/angular-js-training-in-porur
https://www.acte.in/angular-js-training-in-tambaram
https://www.acte.in/angular-js-training-in-velachery

nizam said...

It is nice and informative blog.
AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery


aarthi said...

Effective article.Keep posting.
Java training in Chennai

Java training in Bangalore

Java training in Hyderabad

Java Training in Coimbatore

Java Online Training

Sonu Kabir said...

Thanks for sharing information awesome blog-post. Online Education Quiz website For Exam Follow this website Gk in Hindi

Jayalakshmi said...

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
java training in chennai

java training in tambaram

aws training in chennai

aws training in tambaram

python training in chennai

python training in tambaram

selenium training in chennai

selenium training in tambaram

shiny said...

Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!


web designing training in chennai

web designing training in annanagar

digital marketing training in chennai

digital marketing training in annanagar

rpa training in chennai

rpa training in annanagar

tally training in chennai

tally training in annanagar

jeni said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
data science training in chennai

data science training in velachery

android training in chennai

android training in velachery

devops training in chennai

devops training in velachery

artificial intelligence training in chennai

artificial intelligence training in velachery

deiva said...

I have been searching for this information and got to know now. Thanks to the admin for sharing this blog.
sap training in chennai

sap training in omr

azure training in chennai

azure training in omr

cyber security course in chennai

cyber security course in omr

ethical hacking course in chennai

ethical hacking course in omr

praveen said...

I must appreciate you for providing such a valuable content for us. This is one amazing piece of article. Helped a lot in increasing my knowledge
angular js training in chennai

angular js training in porur

full stack training in chennai

full stack training in porur

php training in chennai

php training in porur

photoshop training in chennai

photoshop training in porur

ganesh said...

Thanks for sharing this blog. This is an awesome post. Really very informative and creative contents.
Angular js Training in Chennai

Angular js Training in Velachery

Angular js Training in Tambaram

Angular js Training in Porur

Angular js Training in Omr

Angular js Training in Annanagar




Pushba said...

I have really enjoyed sharing your website. thank you so much for your sharing this document. this document more useful and improve our knowledge.
IELTS Coaching in chennai

German Classes in Chennai

GRE Coaching Classes in Chennai

TOEFL Coaching in Chennai

Spoken english classes in chennai | Communication training

lakshmik7410 said...

Thanks for sharing a very useful blog!
data science training in chennai

ccna training in chennai

iot training in chennai

cyber security training in chennai

ethical hacking training in chennai

Block said...

Thanks a lot very much for the high quality and results-oriented help.
I won’t think twice to endorse your blog post to anybody who wants
and needs support about this area.
oracle certification in Chennai
asp net training in Chennai
C # Training in Chennai
Hadoop admin training in Chennai

SwarnApp said...

I have been searching for this information and got to know now.
jewellery erp software
Jewellery erp software

SwarnApp said...

very nice post thanks blog........
Jewellery ERP Software Dubai
Jewellery ERP Software Dubai

SwarnApp said...

very nice post thanks blog........
Jewellery ERP Software UAE
Jewellery ERP Software UAE