Sunday, November 13, 2011

C# .NET Web based chatterbot development with AIML - Part 3

Hi, here we go again.
As stated last time, today it is going to be the learning of some useful tags of AIML language, and the usage of the wild cards.


First we are going to talk about the <srai></srai> tag.


1) <srai></srai> tag is used to write the recursive categories. The usage of the <srai> tag gives the botmaster the opportunity to map the user input correctly with the knowledge base categories and give the most relevant answer.
Some interesting usages of the <srai> tag can be the partitioning of the sentence and the usage of synonyms.


a) Partitioning of the sentence
For example , an input sentence that begins with the word “Yes” and which has more words,” Yes” can be treated as a one sub sentence. The method can be implemented in the AIML language as follows.
<category>
<pattern>YES *</pattern>
<template><srai>YES</srai> <sr/></template>
</category>

Note -: </sr> tag is the shorten form for the tags <srai><star/></srai> .


Therefore, if the user input would be "Yes, I want to play cricket.", then the chatterbot will partition the sentence into two as "YES" and "I want to play cricket.". These two parts can be directed to two different categories which makes a proper output.


b) Synonyms
We all know that something can be said in more than one ways.
If we consider the following two categories:-

<category>
<pattern>HELLO</pattern>
<template>Hi there!</template>
</category>

<category>
<pattern>HI</pattern>
<template><srai>HELLO</srai></template>
</category>



Considering an example for an input pattern” HELLO” , the chatterbot response template would be “Hi there!” .And if the input pattern is “HI” then using the <srai> tag  "HI" will be directed to "HELLO"which also gives the answer “Hi there!”.


2) <that></that>


That tag refers to a previous chatterbot output.


If we consider an example input pattern “YES”. Then the chatterbot has to check for its previous response and output the answer. The example can be written in AIML as follows.
               <category> 
               <pattern>YES</pattern> 
               <that> DO YOU LIKE MOVIES </that> 
               <template> What's your favourite movie? </template> 
              </category>



There are lot more useful tags in the AIML language, and I strongly recommend you all to read the A Comparison Between Alice and Elizabeth Chatbot Systems to get a good knowledge and understanding about the chatterbot systems and the AIML language characteristics, importance and the usage.


Ok, now I hope you all will do your background reading to improve your understanding in the language of AIML. But lets talk a little about the wildcards usage here too.


1) "*"
If we take the examples as follows :-

<category>
<pattern>NO, I DO NOT WANT TO PLAY BECAUSE *</pattern>
<template>Ok, then let's talk about something else.</template>
</category>

Here the wildcard "*" used to represent all the wolds after the word "BECAUSE". The star wild card is used to represent one or more words in a pattern. If the chatterbot does not want to consider the user's reason for not liking the to play, then the category can be written as above.


2) A clarification to the wildcard "_" can be found in the following forum post.
AIML Pattern Matching


I hope you all are a little satisfied with the above explanation and the details. If you need more details about certain things you can read the links I have given throughout my posts. And today also I am giving you some of the valuable forum posts links.


1)AIML Pattern Matching - sentence splitting using the "_"
2)AIML Pattern Matching
3)AIML ‘topic’ tag
4)PROGRAM#- that tag issue with Web Site chatterbot development in c#


With my next post, I will discuss about how to design the brain (knowledge base) of the chatterbot with the needed categories.


Cheers!!


Saturday, October 8, 2011

C# .NET Web based chatterbot development with AIML - Part 2

Today I m going to describe about the basics of AIML language, I believe if you have done your home work by going through the links I provided in my last post C# .NET Web based chatterbot development with AIML - Part 1, you now have a good knowledge in AIML, but I think it would be helpful to provide a little introduction to AIML with simple examples which needs to implement our chatterbot.



AIML, the Artificial Intelligence Mark-up Language is a derived version from the Extensible Mark-up Language (XML). AIML files contain the AIML elements that comprise of data and these AIML data are written in an AIML file which starts with the tag<aiml> and end with the tag </aiml>. A full AIML file format can be represented as follows:-




Considering the above example, an AIML file consists of <category> elements which includes <pattern></pattern> and <template></template> tags.
The <pattern> tag content is matched with the user input and <template> contains the chatterbot answer. 


You can simply create an example aiml file by saving the above content to a notepad and saving it as filename.aiml. In this case we will save it as simpleExample.aiml


There you go, now you have your first aiml file with you.


There are a lot of AIML tags that can be used improve the chatterbot response. Some of those are <srai></srai> tag and  <that></that> tag. AIML use wildcard characters * and _.  We will learn some of those important tags and use of wildcard concepts in the next part.


I believe it is important to refer the AIML Reference Manual. You will learn lot of AIML tags and concepts in the reference manual.


See you next time. Bye for now. Cheers...:)

Sunday, September 18, 2011

C# .NET Web based chatterbot development with AIML - Part 1

Hi All,
As promised here I am again, not so late this time....:).
I hope you all are now familiar with the chatterbot concept and know some of the technologies that use to develop as I mentioned in the introduction post How to start implementing an AIML based chatterbot?
If you have not read the last post, do not worry :) you can proceed reading this, but it is always nice to have the background knowledge :).


Because this is the first part of the development of our chatterbot system, I am going to give you an overall view of the system that we are going to develop , therefore you all could gt a very high level understanding of the architecture.



As you can see from the above diagram,


1) We have the web interface where a user can input and get output . We are going to develop this using ASP.NET.


2) Once user input a particular question or any query to the chatterbot, system does some reasoning related to the query in order to get the best output from the knowledge-base. We are going to use the AIML interpreter for the reasoning of the chatterbot.


3) The knowledge-base consist of all the knowledge related to a particular area or general knowledge which helps with the answering process. Best suited answer is selected form the knowledge stored in the knowledge-base. The knowledge-base will be developed using the AIML  language.


Now you know what are the components of the our system and what are the technologies we are going to use in order to develop the system.
According to my experience, the most important part of a chatterbot is it's knowledge-base, which helps giving the best  experience of a chat. Therefore, we are going to focus on developing the knowledge-base first. 
As I mentioned above, we are going to develop it using AIML, which is Artificial Intelligence Markup Language. Before start developing the knowledge-base , we need to know about this AIML language.
Why don't we peep in for an AIML introduction first, then proceed with the development?. Sounds good isn't it? 
Followings are some useful links to get started with learning AIML, and with next post we will learn AIML basics and proceed forward. See you soon..:)


1 ) AIML: Artificial Intelligence Markup Language
2)  AIML Overview
3)  AIML 1.0.1 Tag Set
4) Artificial Intelligence Markup Language (AIML)
5) AIML Reference Manual

Friday, August 26, 2011

How to start implementing an AIML based chatterbot?

Hi everyone, long time...:), here goes my long awaited post.
First of all my apologies for the delay, for anybody who visited this blog in search for information on chatterbot development.
So, I am here again and this time I promise to make this a series of posts to describe the development of AIML chatterbot on .NET platform.
Actually this was my basic idea of the final year project, which I developed with enhanced features.
If you are new to chatbot development and reading this post, you know how helpful it is , if there is some help on the Internet for the chatter bot development for beginners. The communities who shares their knowledge with the world helped me in order to 
search the needed facts and the ways of development, and some forums helped me a lot for the clarification of my doubts.
I was so lucky to have a great supervisor and assessor for the guidance of my final year project, who helped me a lot in order to make it a success.
Therefore, I dedicate these posts to all who helped me with the project from all over the world.


Today, lets talk about how to get started on the chatter bot.
OK, you have the idea of "I need to develop a chatterbot " in your head, but how? 
Other questions in your mind would be 
Where can I get the needed information?
How do I start?
Where do I start?
What are the available methods?
Is there anybody to help me with the clarifications?


The same questions I had when I started my project, and I did succeed, so you all can do it...:)


Yes, of course you will want to search with the help of Google and other search engines. But you would not know where is the best place to start on?
First you must get the idea of what is a chatter bot? A little peep in to the history would be great, and it is interesting too.(Turing tests)
How a chatter bot works in brief?
What are the methods that are already there?(If you are a research student you would want to compare and contrast)
How to start implementing?


In my coming posts, I am only going to describe the implementation of a web based  chatter bot with AIML on .NET platform. But if you are interested in using different
technologies or platforms, there is help too on the Internet, so go ahead , no problems...:)


For a research beginner who is in seek for information,the following are the links that are good according to my opinion and for the others who like background reading. I am not going to describe theories and concepts in my blog. The following links will guide you through all those.


What is a chat bot?
For the researchers the best research papers would be:
Joseph Weizenbaum's ELIZA
A Comparison Between Alice and Elizabeth Chatbot Systems


Other useful links :
From Eliza to ALICE


The best forums :
ALICE AI Foundation Forum
Chatbots.org forum


With the next post, I am going to discuss about AIML.
See you all soon. Bye for now!