Twitter (almost) Wrote a Novel

published on February 19th, 2012 · more from the blog →

TLDR: I tested the Infinite Monkey Theorem using words found on Twitter. They unknowingly reproduced 98% of George Orwell's novel "1984" in 12 hours, and went on to complete 99.8% of the entire book in ~9 days... check out the results.


Lately I've fallen in to that trap of spending way too much time looking at other peoples cool stuff, and not enough time making my own cool stuff. To remedy this I took a journey and delved into the darker side of my brain, and with some force, pulled out one of those random ideas that had been lurking in there for some time.

The thing that emerged was to test the classic (and clich├ęd) Infinite monkey theorem. Which states that a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text, such as the complete works of William Shakespeare.

The plan

Not being a big fan of Bill, infinite numbers of monkeys, or strictly abiding by the rules, I instead turned my attention to that oh-so-wonderful form of social media, Twitter. Surely the "twitterati" could do a better job of recreating a novel than a bunch of lame monkeys! To test it out I found myself a copy of George Orwell's Nineteen Eighty-Four (out of copyright, so don't sue me) and got to work seeing if twitter could reproduce it.

Lets do it!

Using Twitter's search API, and a bit of coding, I extracted all the unique words from the book (~8,985) and set about searching for recent tweets containing that word. 8 hours later and Twitter had kindly found all but ~150 or so of the words, with a few adjustments (spell-checking and splitting hyphenated words) that came down to just 34 missing words. Not bad considering none of the participants were aware of their involvement in the experiment.


In conclusion

I know this doesn't prove much, but it was a fun experiment anyway, twitter almost reproduced a great piece of fiction, and in fairness to them they had written all the "real" words, and some of the made-up ones too. I know the experiment doesn't exactly prove the Infinity Monkey Theorem, as the words weren't produced in sequence or whatever other "rules" you want to put on a random theory, but I don't really care.

Here's to making more random stuff!

:-)