screenshot of the application showing the words "apparently about maybe"

Try it here!

The twitter random API is a wonderful source of randomness. Except it’s all but random: it’s a stream of human consciousness. This stream won’t be the same today as it will tomorrow. But what does it say ?

Since the first day I saw an endless stream of tweets in my terminal, I’ve wanted to capture the essence of what was said. But there is just too much, you can’t read it all.

What if I could get the most tweeted words and surface them ? Of course they won’t have any form, it won’t be a sentence. So what about making it an endlessly mutating sentence, moving along the Twitter discussion… I would listen to the most tweeted words in the last minutes or so, pick some at random and insert them in that poem.

screenshot of the application showing the words "employee risk somewhere"

That sounds easy enough. The problem is: its Twitter. And on Twitter people tweet in various ways… If you run this experiment without filter, you’ll get a lot of gibberish. Pseudonyms for instance are a big source of noise, as they’re many times used without an @ mention. And of course let’s not talk of all the mispelling.

At first I tried filtering using an English dictionary. It works but it gets very boring. You don’t get any names, brands or popular references. Things like covfefe, what Twitter is really about. What twitter is talking most about right now might not be in the dictionary.

So how to get a more informal dictionary ? Twitter of course ! I manually selected a few accounts that would tweet recent but properly formed words. Journalists tend to do that. A sprinkle of @realDonaldTrump and other few (full list is here) and you get a much more interesting dictionary.

screenshot of the application showing the words "nasty hands"

In order to create the sentence, I made a simple rule: either add or remove words in order to always keep a sentence between 1 and 4 words. There is no grammar checks involved, the words are just randomly put together. Meaning is not guaranteed. The background color will also change every time the sentence gets to a single word. It seems to add a little meaning too: as the screen holding only one word will turn full pink, the word “alone” might take a different meaning than on a black background.

The result is Twitter Poem, and it makes a great screensaver ! I personaly use WebSaver.

The code is available on github:

screenshot of the application showing the words "weird enough"