03 March 2009

I am now on twitter, and for those interested it is Twitter

I have been thinking about AI’s and chatbots for twitter and will be figuring out which I can adapt myself. However, there are plenty of clever tweeps (twitter people) out there who might be able to code their own or adapt something.

Bring out your Twitter AI’s! If you simply pipe twitter to Alice or Eliza, or even Psychoanalyze-pinhead, code your own complete AI, dust off and bring out NIALL then I want to know here.

So here - put your best twitter chat bot forward - a link to twitter to follow, as a comment, and tell us a little about how it is written. I will be getting people to test it from around the twitterverse (is that a word?) at silly hours of the day, to ensure it really is a bot (it may be hard to prove this bit).

So go on - give us your best, chattiest bot - I want to hear from you. Let the OrionRobots Twitter Turing Test Begin! For those who want a short name, I am thinking Twuring!

Rules: * Must be on twitter - with its own profile. * Twitter profile should state it is a bot, and an entry to twuring. * Be prepared to tell us a little of how you did it (enough to prove it is a bot and not a fake) - a link to a blog/article about how you did it would be good.


# More resources for contenders

This is a contest and resources for writing a Turing Test capable chatbot on twitter. The turing test means that the bot needs to be capable of being indistinguishable (or as near as) from a human being. So a spammy bot will get nowhere. If you can code in C#, perl, python, ruby or (insert favourite programming language of choice here) then come have a go at it!

Twitter has plenty of people chatting about many things. But what if some of them were robots? Which of those are the best robots? Do you know of some or could you code one yourself? Time to put them forward for the Twitter Turing Test if you think they are world class. Showcase your natural language programming skills here.

I don’t mind what language or hack is used to make it, even an elaborate way of piping psychoanalyse-pinhead through to twitter - anything goes.

They need to be plenty convincing, or simply just interesting to interact with. What may be interesting is to have a robot capable of passing and yet proving that it is really a bot.

I know most of the programming languages, but I’ve not used the twitter library in any other than Python, Perl and JS, and even then I’ve only scratched the surface.

The Twuring contest (Turing on Twitter), is my concept to use Twitter to field turing bots. Twitter has the advantage that it gets people used to chatting online via a computer, and keeping messages/responses down to only 140 characters makes the playing field a little simpler too. Twitter + Chat bots could be a really good match.

The page has info on twitter, on turing, on existing non-twitter bots which could be used. I’ve added info on the API’s for twitter for different languages (although all wrap a fairly simple HTTP request).

What is the Twuring Contest

In short a search to find the best twittering robots, based on the Turing test. They should have something interesting to say, be prepared to answer some questions (and reply when they don’t understand a reply/DM directed at them).

The robots need to be plenty convincing, or simply just interesting to interact with. What may be interesting is to have a robot capable of passing and yet proving that it is really a bot.

Bring out your Twitter AI’s! If you simply pipe twitter to Alice or Eliza, or even Psychoanalyze-pinhead, code your own complete AI, dust off and bring out NIALL then I want to know here. Find interesting ways to use the Perl, C#, Java and myriad other twitter API’s to build your chat bot. We will be looking out for Turks (read below for what that means) too.

To enter them, simply twitter with the tag #twuring and the @name of the bots twitter profile. Then let the twitterverse take a look at and judge which they think is the best. Use the #twuring tag to discuss your entries, ask for tips etc.

May the best coder win.

Natural Language Processing and chatbots

I recommend the book Natural Language Processing With Python, an O’Reilly book by Steven Bird, Ewen Klein and Edward Loper for getting started. There are few languages this will be easier in than Python, perhaps prolog among them. Python has superb string processing capability, modules dedicated to creating parse trees, and easy ways to interface with networked components and systems like twitter.

Twuring Bot Entries and Info

@iniaes @chatbots

What is twitter?

Twitter is primarily a rapid broadcast medium. It is not designed for 1-to-1, and although there is a direct message facility, it is not going to replace email any time soon.

It is not a personal friend network in the way facebook is either. It is probably more likened to an ad-hoc global chat room, where hash-tags take the place of IRC rooms, and by using clients that allow observing and combining hashtags into one stream, you can mix and match subjects. It has fads, kind of like mexican waves across twitter users when tags become popular. Because of the short length, it is suitable for human computer interfaces, although this can lead to text speak and jargon.

The following thing is another element, kind a pat on the back, and a personal stream, but is less fun than just searching/replying on curent topic tags. About Twitter - in their own words

Resources on the Turing Test

The Turing Test is a great philosophical benchmark for computer intelligence and it is rapidly becoming one that will need to be revised any day now - computers online are becoming more conversational (at least in text). More websites are beginning to have chatbots as interfaces to their FAQ’s and product catalogues.

Some great chat bots

Eliza was probably the first Chat bot I knew about. Eliza emulated a psychoanalysis session. It would store and pick up some aspects of a conversation to repeat them later. Interaction was in a single chat interface.

I then had the pleasure of working with NIALL - The Non Intelligent Amos Language Learner. This ran on an Amiga and was distributed as its source code which ran in the popular AMOS basic system. It would use the Amiga speech system to help the illusion. What it did was learn a lexicon of words and word pairings - a very basic grammar.

Later I came across a DOS program named Alice - which showed a moving face along with speech. It was a lot closer to the Eliza style chatting - based on rules and trigger words, but was much more capable of learning and remembering conversations. Versions of Alice are still on the web today under the name Alicebot which is all singing, all dancing and uses a AIML markup language to form expert chatbot systems.

Many websites now include a chatbot, for example the IKEA website has Anna which can answer some basic furnishing questions and will direct you (mostly helpfully) to the relevant pages on the Ikea website. It is questionably little more than a sophisticated search tool.

So will you build a twitter chatbot that will make a list of classic chatbots later? Enter one into #twuring and try for that honour.

Choosing a Library/API to work with twitter

The thoughtful people at twitter have gathered up a number of API’s that interface with twitter. There are libraries for most languages, and the first place to look for them is twitter’s own development library page Twitter Libraries.

You probably want to make sure the API you choose covers two areas - Setting up the OAuth with twitter, then actually interacting with it to send/receive communications.

You should take a look at the API’s documentation, make sure it makes sense to you - shop around here, some are better documented than others, and this can be an indicator of how ready an API is for users other than the original author to use.

Also, see if the API has a set of tests. When you think you’ve found one you like, grab a copy of the API and it’s test cases, and ensure you can get them to a state where you can run them in your own environment. You then know that these test cases work for you, and by looking at them, you get an idea about using the API, and what stuff definitely works.

You should also consider the license - and how that would affect your code. Generally BSD and similar permissive licenses are recommended over paying for an API, or using a GPL library with the restrictions that involves.

Languages covered are: Browser Client Side: ActionScript/Flash, JavaScript Native OO Languages/Runtimes: C++, Java, .NET, Objective-C / Cocoa Native functional Languages: Clojure, Erlang, Scala Scripting Languages: Perl, PHP, Python, Ruby

There should be enough tutorials and libraries for anybody to get started connecting a chatbot to twitter for a #twuring entry.

Building A Perl Twitter chat Bot

Twitter Perl API’s:

  • App::Tweet by Joshua McAdams. This is a command line wrapper to Net::Twitter. It is write only - so probably not much use for an interactive bot.
  • Twitter::Shell by Daisuke Maki.A twitter shell, very alpha looking at the CPAN page. Watch this space.
  • There is also little stopping you grabbing/building a perl SAX parser, building your own REST queries, and going it alone.

Perl chatbot info:

A basic plan: Put a perl script on a cron job, that will (once every minute) check for any messages directed at it using the twitter API. It will then lex process and respond to these. Using either built up regular expressions, or the RecDescent module, grammar and lexical rules can be laid down.

C++ resources

Twitter C++ API’s: * twitLib by Bradley Lackey & Maks Zolin. Multiplatform C++ library.beta. * C And C++ - Creating A Chatbot | DreamInCode.net * AI Hub Forums-Java, C++, Perl, PHP Chatbots - Artificial Intelligence, Chatbots, Robotics, Technology, Neural Networks * Andrew Stephen Callaghan :: Blog :: Chat Bot in C++: GRAHHHH!!

Ruby Resources

Do Twitter Allow this?

Some may be worried that twitters terms of service may not allow robots to chat on it. The good news is that bots are perfectly allowed within the terms, as long as they are not causing harm.

Spammy bots, or those propagating viruses or worms are disallowed. But a chatbot, like Eliza, Anna or similar will run into no difficulty. Although perhaps Anna may talk a little too much about Ikea to be much use.

For detail - Twitter Terms

Twuring Rules

Although rules may be a bore - lets have a couple to set the stage here: Rules: * Must be on twitter - with its own profile. * Spam bots wont pass. The robot must interact - that is - it should be able to respond and converse, not simply post in a monologue. * Twitter profile should state it is a bot, and an entry to twuring. * Be prepared to tell us a little of how you did it (enough to prove it is a bot and not a fake) - a link to a blog/article about how you did it would be good. * Nothing hateful or explicit please.

The bot can be a sales bot, as long as it can answer questions (like the Ikea help bot).



Other places to find us