Casual Games, Social Software

Read more at the weblog »

GrokItBot: A Python, AIML and Bayesian IM bot

ScreenshotsDownload GrokItBotTalk to GrokItBot

Update 11/09/09: GrokItBot now runs as a Twisted IRC bot, rather than an AIM one. Download the code from GitHub.

GrokItBot is an IM bot that uses Py-TOC, PyAIML and Divmod Reverend to create an AIM bot that makes uses of AIML (Artificial Intelligence Markup Language) to respond to messages, combined with a Bayesian algorithm to provide learning and guessing capabilities.

Credit should also be given to Mike Wakerly for his 'typing response' code.


GrokItBot is intended to cut down on the amount of AIML that needs to be written for very similar inputs. Once you have trained the bot that 'hi', 'lo' and 'yo' all mean the same thing, 'hello', using the Bayesian trainer, then you only need one AIML response. Once trained, it should also be able to guess that 'hi there grokit', 'lo there' and 'yo yo yo yo grandma' all mean the same thing, 'hello'. This cuts down the amount of AIML that needs to be written enormously.

GrokItBot in action

With a Bayesian guessing filter, GrokItBot should take a guess at the topic of conversation and, if it finds no suitable response, ask for clarification.

GrokItBot is *not* intended to be an ALICE bot replacement. I've written GrokItBot to act as a utility rather than a chatterbot. I use GrokItBot for server monitoring tasks, reminders and to update and search this website. All of which I could do using a normal IM Bot. By using a bot with AIML and Bayesian smarts, however, I don't have to remember the exact syntax for each of those operations. For example, rather than having a specific 'search' command, GrokItBot will respond to any number of permutations of the search command once it is fully trained.

The conversational templates and 'srai' tags provided by PyAIML are the best way of dealing with messages once the Bayesian guesser has classified them according to topic. Needless to say, the 'topic' tag is vital to this. The fact that AIML files can be reloaded and 'learned' dynamically is also a huge factor in choosing PyAIML.

Read on to find out how it all works.

Suttree Beatniks with better clothing, brought to you by Duncan Gough. About Archives Casual Game Dev Code Disclaimer EcoLocal Music Knows PMOG
Links for Thursday, February 14th, 2019