Get started with AIML C# programming (IV): Train your own robot


It is very, very easy to train or coach your own robot. The way is to teach your robot in a question-answer fashion.

Q: Where is City University of Hong Kong?
A: It is located in Tat Chee Avenue, Kowloon, Hong Kong SAR.

By asking your robot to memorize this Q-A pair, your robot gets smarter. And when you ask the question, it will simply output your given answer!

Well this is my interpretation of AIML’s term, in AIML, question or input = Pattern, whereas the answer or output = Template, and the Q-A pair = category

image

So if you add a test.aiml file and edit above pattern-template category, you have finished training your robot to learn this! That is it! Believe it or not, it simply works!

Continue reading “Get started with AIML C# programming (IV): Train your own robot”

Get started with AIML C# programming (III): Be nice and understand that robot can be naïve!


In previous two blogs (Here and Here), I have shown how to experiment AIML programming, and it is not hard to turn the HelloRobot console into a GUI program. Yes, I did, and found that the robot is smart and fun.

Until, the silly me, typed below:

Me: Marry me!
Robot: …………………………………………………………

image

Continue reading “Get started with AIML C# programming (III): Be nice and understand that robot can be naïve!”

Get started with AIML C# programming (II): Give your robot a cute name


In the last blog, I have demonstrated how to say hello to AIML based robot. It is cool, but when you ask the robot

You: “What is your name?”
The Robot: I am Unknown.

Weird, but how do we name our robot and make it aware that he has his own name? Simple! Go the bin\config folder, you will see there is a file called Settings.xml (the file together with aiml and config folder can be downloaded here)

image

Continue reading “Get started with AIML C# programming (II): Give your robot a cute name”

Get started with AIML C# programming (I): Just say hello to the robot


In this series of articles, I am about to keep a note on my recent trials to program AIML using C#. AIML, or Artificial Intelligence Markup Language, is an XML dialect for creating natural language software agents. With AIML, you can design your own soft robot with ease!

  • Create a library project and add a class called CuteRobot. The reason for create a library is to reuse such robot code later. You may however directly put it in the main application as you like.
public class CuteRobot
{
    const string UserId = "CityU.Scm.David";
    private Bot AimlBot;
    private User myUser;

    public CuteRobot()
    {
        AimlBot = new Bot();
        myUser = new User(UserId, AimlBot);
        Initialize();
    }

    // Loads all the AIML files in the \AIML folder         
    public void Initialize()
    {
        AimlBot.loadSettings();
        AimlBot.isAcceptingUserInput = false;
        AimlBot.loadAIMLFromFiles();
        AimlBot.isAcceptingUserInput = true;
    }

    // Given an input string, finds a response using AIMLbot lib
    public String getOutput(String input)
    {
        Request r = new Request(input, myUser, AimlBot);
        Result res = AimlBot.Chat(r);
        return (res.Output);
    }
}

Continue reading “Get started with AIML C# programming (I): Just say hello to the robot”