<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>DEAN LEE:/DEV/BLOG &#187; chat bot</title>
	<atom:link href="http://www.deanlee.cn/tag/chat-bot/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deanlee.cn</link>
	<description>mount /dev/brain &#124;&#124; tail -f /var/log/thoughts &#62;&#62; /pub/www</description>
	<pubDate>Thu, 22 Mar 2012 06:55:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
	<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>How to create a jabber chat bot based on AIML,the C# way.</title>
		<link>http://www.deanlee.cn/programming/how-to-create-a-jabber-chat-bot-based-on-aimlthe-c-way/</link>
		<comments>http://www.deanlee.cn/programming/how-to-create-a-jabber-chat-bot-based-on-aimlthe-c-way/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 05:30:55 +0000</pubDate>
		<dc:creator>Dean Lee</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[A.L.I.C.E]]></category>

		<category><![CDATA[AIML]]></category>

		<category><![CDATA[bot]]></category>

		<category><![CDATA[chat bot]]></category>

		<category><![CDATA[jabber]]></category>

		<guid isPermaLink="false">http://www.deanlee.cn/programming/how-to-create-a-jabber-chat-bot-based-on-aimlthe-c-way/</guid>
		<description><![CDATA[I have created a jabber chat bot based on on the A.L.I.C.E(Artificial Linguistic Internet Computer Entity) and AIML(Artificial Intelligence Markup Language).which is named alice@35.cn,you can add alice@35.cn to your contact list and chat with her anytime:
 
It&#8217;s really simple to build your own alice chat bot by using agsXMPP and AIMLBot.The following sections is my [...]]]></description>
			<content:encoded><![CDATA[<p>I have created a jabber chat bot based on on the <a href="http://www.alicebot.org/">A.L.I.C.E</a>(Artificial Linguistic Internet Computer Entity) and <a href="http://www.alicebot.org/aiml.html">AIML</a>(Artificial Intelligence Markup Language).which is named alice@35.cn,you can add alice@35.cn to your contact list and chat with her anytime:</p>
<p><a href="http://www.deanlee.cn/wp-content/uploads/2009/07/image2.png" rel="lightbox"><img title="image" style="display: inline" height="188" alt="image" src="http://www.deanlee.cn/wp-content/uploads/2009/07/image-thumb2.png" width="402" /></a> </p>
<p>It&#8217;s really simple to build your own alice chat bot by using <a href="http://www.ag-software.de/index.php?page=agsxmpp-sdk" target="_blank">agsXMPP</a> and <a href="http://aimlbot.sourceforge.net/" target="_blank">AIMLBot</a>.The following sections is my quick and dirty tour on how to do it(You should know how to use agsXMPP and AIMLBot first):</p>
<p>After downloading and compiling the agsXMPP and AIMLBot,add them as References to your bot project:</p>
<p><img height="46" alt="image" src="http://www.deanlee.cn/wp-content/uploads/2008/09/windowslivewriterhowtocreateajabberchatbotbasedonaimlthe-be0cimage-5.png" width="131" /></p>
<p>Initialize AIMLBot :</p>
<pre class="prettyprint">AIMLbot.Bot myBot = new AIMLbot.Bot();
myBot.loadSettings();
myBot.loadAIMLFromFiles();</pre>
<p>Response chat message in XmppClientConnection&#8217;s OnMessage Event:</p>
<pre class="prettyprint">AIMLbot.Request request = new Request(msg.Body, GetUser(msg.From.Bare), myBot);
AIMLbot.Result reply = myBot.Chat(request);
agsXMPP.protocol.client.Message replyMsg = new agsXMPP.protocol.client.Message();
replyMsg.Type = MessageType.chat;
replyMsg.To = msg.From;
replyMsg.Body = reply.Output; 

XmppCon.Send(replyMsg); </pre>
<p>a simple implementation of GetUser:</p>
<pre class="prettyprint">protected AIMLbot.User GetUser(String jid)
{
   Hashtable myHash = Hashtable.Synchronized(userSessions);
   AIMLbot.User user = (AIMLbot.User)myHash[jid];
   if (user == null)
   {
       user = new AIMLbot.User(jid, myBot);
       myHash[jid] = user;
   }
   return user;
} </pre>
<p>that&#8217;s all,it&#8217;s really easy and simple,huh?</p>
<p>PS:you can download free AIML sets from <a href="http://aitools.org/Free_AIML_sets" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.deanlee.cn/programming/how-to-create-a-jabber-chat-bot-based-on-aimlthe-c-way/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

