Giving Xpider a Brain

As part of the development of the Xpider (now affectionately named G.A.J.E.T. by my 11-year-old daughter, which stands for “Gadgetized Analytic Just-so-cute Exploratory Technology) I wanted to give it the semblance of a “personality”. Years ago I had written a sample Markov chain algorithm first in C++ and then ported to Javascript. It was just a fun experiment to see how well a Markov chain could generate human-like text from some training data.

After learning that the Edison board that powers GAJET would run Node.js, I decided to work on some social aspects of the little robot. I ported what I had from my earlier algorithm into Node.js, and found 2 sources of training data; the complete text of “The Hitchhiker’s Guide to the Galaxy” and the script from “Monty Python and the Holy Grail“. Using these texts, I “trained” the application to format the Markov chains and to properly normalize the responses. Not finished, I created a Twitter account for the robot called @MontyHitchhiker, and leveraged the Twitter API to have the application post tweets every 10-60 minutes (randomly). Additionally, I leveraged the API to fetch the top trends for the United States, so GAJET will tag a post with a random trending topic.

It all turned out pretty comedic, and while the little guy still has some work to do regarding refining the chains, I’m fairly happy with it overall.

The next step is to incorporate a speaker into the system, and utilize a text-to-speech service (probably MaryTTS) to have the ‘bot actually “speak” its “mind”.

If you’re interested in seeing the workings of the Node.js app, I’ve attached the current working application to this post, so feel free to download and use it. You’ll want to sign up for a Twitter account and create an application in order to get the requisite keys, but everything else should be there.

Click the link to download the MontyHitchhiker source code.

Leave a Reply

Your email address will not be published. Required fields are marked *