Horoscope Generator on Twitter

So, with my copious spare minutes, I've been playing with text a lot. Modifying it, trying to make interesting stuff out of it. Most of this involves Markov Chains, which are really a fascinating concept. There's a great summary of them on Coding Horror.

My general goal has been to take some text, run it through some sort of process, and turn it into output that is interesting enough to use as a Twitter bot. This is challenging, since the character limit makes it hard to confer any real meaning. So, I've had a couple failures.

My first public stab is a bot that outputs horoscopes. Horoscopes seemed like a great source text – fairly short most of the time, concise, conferring a bunch of information that is generic enough to appeal to everyone. I managed to scrape about 100,000 horoscopes off the web, parsed them out, did a bunch of text cleanup, etc. Then I ran them through a markov generator. The results are on Twitter as @horoscopish.

Horoscopes are perfect text for something like this, since they're a perfect combination of being very reader-positive, vapid, and generally pretty silly. The text combines well, and more often than not seems to output a tweet that has some nugget of value.

While I was at it, I made a full-length horoscope generator as well. It will output a couple hundred words, and as a result is probably more interesting in the long-run. And it's soooo much like actual horoscopes although the text is not terribly close to it's source material at this point. With a little editing, this could be in a newspaper horoscope column:

Center yourself. Consider what you want to play and rejuvenate yourself so that you have many other matters on their mind. You may want to give you the drive to get into shape. This has become a home away from home, and domestic life is an open book. Even notoriously self-involved people will notice you. You're restless to do something original - just do what feels right. Walk away from stress. Your airy style makes a difference. You inspire a lot of excess energy. An immediate decision is not necessary, but be aware changes can also be mooted now Cancer. Christmas plans discussed too. You may have experienced this during September and understandably so.

A couple other similar Twitter bots (not by me):<ul>

  • @dedbullets
  • @the_w0rd_0f_g0d
  • @the_truth
  • </ul>

    ps. I'll probably put my source code for this online in the next couple days.

    Filed under: Code, twitter