Showing posts with label chatbots. Show all posts
Showing posts with label chatbots. Show all posts

Bug fixing with Mac, the chatbot

I've just fixed a bug in the data files for my chatbot, Mac. The bug was preventing Mac from replying to your input. It turns out there was a misplaced comma. All fixed now and Mac is chatting away like a four-year-old child again.

The usual standard of conversation you can expect from a computer program written in JavaScript.


New updates to my chatbot

I have spent most of Sunday having very daft conversations with my chatbot, Mac, and I am pleased to say that I am happy with progress so far. His dictionary files have increased in size and he is becoming a much better conversationalist.


If you want to have a pointless conversation with Mac, then you can find him waiting for you here. Try asking him who he thinks will win the race for the White House, or what his opinions are on current affairs. I'm not actually claiming that he will make any sense, but it will be fun finding out. Enjoy!

My #chatbot is online

He's ready! Warts and all.  Mac, the superdecade games chatbot is online and ready to talk to you.

Another thrilling conversation with Mac.
Ok, I admit it, he doesn't say much for now, but I promise that I'll update his database with more topics to improve his conversation skills as time goes by.

Feel free to go and chat, or steal my code, whatever.  Any feedback then do get in touch.

Some improvements to my chatbot

Today I made some improvements to 'Mac' my chatbot engine. It is still too early to release yet, but here are the new features:

The chat history is in reverse order. The latest response is at the top.

1. Mac can now remember the values of variables stored within the user's input. In the above example, it can match the variable <<name>> from the user's input "Some call me Tim" and "My name is Bob".

2. Mac has can have two different responses to user input depending on whether a condition evaluates as true.  Conditions are expressed in the format ( [conditon] AND [condtion] ... ) OR ([condition] AND [condition ] ... ) .... So, for example if you tell him your name is something different to what he thinks, you get a different response.

Well, that's it for now, but stay tuned for more chatbot developments - and a live version plus code for you to play with - coming soon!

It's alive!

I have been working on Mac, my JavaScript chatbot for a couple of days.  I won't post it online just yet as it is still in development.

The interface with no CSS.  The previous conversation is stacked up in reverse order.

The JSON file for one input pattern.
The bot works as follows:

The user types some text into the edit box and the system tries to match this with a script object stored in the JSON file.  For each script, if the current conversation subject matches one for the script, it will check whether the user's input matches one of the regular expressions in the 'pattern' array.  If there is a match it will check whether the condition has been met.  If the condition is true it will respond with the data in "whenTrue", otherwise if the condition is false, or if there is no condition, the "whenFalse" block will execute.  In both cases, a random response from the "match" field will be returned.  The system will silently set variables in the 'think' list and set the special conversation variable to the new conversation topic in "setSubject".

The result of the script above is that Mac will respond to some standard greetings "Hi", "Hello", "Hullo", etc.  Should the user type "Hi" again, Mac will have a different response "Hello again".

That's all for now because I have to go, but I'll keep on working and publish the code shortly.

I'm through with Pandorabots

After a brief fling with Pandorabots and AIML I have decided that the affair is over.

My reasons are that the AIML language is a little primitive and I can do better by coding a chat bot myself. Coding the engine and the chat bot itself seems much more exciting as a project to me.

Secondly, I can host as many chat bots as I want on my own domain (www.superdecadegames.com) for free.

One aspect of AIML that I can do better with is the <vrai> substitutions which require an awful lot of copying and pasting of pre-existing code and can cause problems when the thing you are substituting changes or does not exist.  The <that> construction makes code look a little messy overall and, as I am not afraid to get my hands dirty with some regular expressions, I should be able to produce something a little more impressive.

Well, work begins tonight.

Some of these should help.

Goodbye, Mac.  We hardly knew you!

I am slowly getting somewhere with my chatbot

So today I reworked most of my chatbot code so that he would accept multiple greetings ("Hi", "Hullo", "Hello" etc).  Also, I wanted Mac to respond with a friendly "what is your name?" and have the chatbot remember what to call you in the future.


This is achieved through the use of AIML <srai> recursion and setting context with <that>.

  • This code deals with matching multiple ways of saying 'Hi'.  What did I miss out?


<category><pattern>HI</pattern><template>Hullo. What is your name?</template></category>
<category><pattern>HI ^</pattern><template><srai>HI</srai></template></category>
<category><pattern>HELLO ^</pattern><template><srai>HI</srai></template></category>
<category><pattern>HULLO ^</pattern><template><srai>HI</srai></template></category>
<category><pattern>HEY ^</pattern><template><srai>HI</srai></template></category>
<category><pattern>HOWDY ^</pattern><template><srai>HI</srai></template></category>
<category><pattern>SUP ^</pattern><template><srai>HI</srai></template></category>

  • This code deals with the user replying to Mac's question "What is your name?"  Whatever is typed is stored in a variable called 'name' for later.

<category><pattern>*</pattern><that>^ WHAT IS YOUR NAME</that>
<template>It is nice to meet you <set name="name"><star/></set>.</template></category>
<category><pattern>MY NAME IS *</pattern><that>^ WHAT IS YOUR NAME</that>
<template>It is nice to meet you <set name="name"><star/></set>.</template></category>

  • This code deals with the user checking whether Mac has indeed remembered their name.
<category><pattern>WHAT IS MY NAME</pattern><template>You are <get name="name"/>.</template></category>
<category><pattern>WHO AM I</pattern><template><srai>WHAT IS MY NAME</srai></template></category>

I'm building a chat bot

Following my work on Susan, the ASCII personal assistant, I have become interested in chatbots. Today I set up an account with pandorabots and began to create my first bot - Mac, a ten year old cat from England.

It is early days yet.

It is still early days for Mac. Pandorabots use AIML (Artificial Intelligence Markup Language) for defining the responses to the human's input. I am still reading through the tutorial. There are libraries of responses you can import, however I want Mac to be unique, so I am coding him from scratch. As such, he can only respond to a few questions, but hopefully I will stay interested in the project and keep building him.

If you want to talk to Mac, then you will need a pandorabots account. There is an API through which I will eventually publish Mac, but for now I'll keep you posted on developments in this blog.

Mac, helping me code

Label