I've been pretty fascinated with Twitter bots lately. I recently wrote @random_map, a bot that tweets random aerial images of the Earth every hour, but I've always wanted to create a Markov Chain based bot that would create random tweets based on words and phrases I would use.
For those who aren't familiar with Markov Chaining, it's a random process that uses probability and states to decide where to go next. One important property of a Markov Chain is that past transitions don't affect future transitions. In the sense of @CailinBot, Markov Chaining is used to decide the next phrase/word to use in a tweet, after choosing the current word/phrase to use.
For example, here is a simple Markov Chain with two states:
Yesterday, I was itching to finally tackle this, so I sat down and wrote @CailinBot, using a really cool Ruby gem called twitter_ebooks. This gem fetched the past 4000 tweets from my personal Twitter account, saved popular words and phrases as a text model, and used Markov Chaining to create @CailinBot tweets. Once I finished setting up the bot and assigning actions (how to respond to private messages, when to reply to someone when someone mentions it, etc.), I set it up on my Raspberry Pi and let it go to work.
I quickly realized I had created a monster.
It immediately started being snarky:
It doesn't like USG very much:
It's obsessed with fungus:
It pays attention to national politics:
It can be mean at times:
It also has emotions:
Oh, and apparently it thinks it is a human being?
Very odd.