Roses are red, Violets are blue, Computers writing poetry is something we probably shouldn’t do.

Sometimes over at Kaleida, while elbow deep in data with Python chugging along with various Natural Language Parsing (NLP) experiments, you need a little break, and so I figured it’d be nice if the computer sent me short poems it found as it searched through the news.

I was initially tempted by cheesy Christmas card poems, but then figured I should aim for Valentine’s day. It’d give me a few months worth of results to search through, and what could be nicer than a timely news based love poem from a computer?

Or, well, maybe not!

Undeterred I decided to press on, the first step in the whole process was finding sentences in the news where the last word rhymed with blue, for which we needed a list of blue rhymes.

I started with 228 one, two, three and four syllable words from http://www.rhymer.com/RhymingDictionary/blue.html.

Now, in comedy there are certain words that just inherently funny, and when coming up with a comedy name for sketches sticking with surnames that are nouns is generally a good bet…

  • David Chin, Dennis Plow, Rosemary Rediscovery Fiddle, Paloma Dent, Seymour Cliff, Edward Tent, Jessica Brick, Terry Horses and Nathan Cake.

…for example.

Some words are just better than others when it comes to the “arts”. When first running the now rhyming with blue code over the last couple of months news stories, one thingy stuck out almost straight away, poems ending in one syllable words were both very common and got dull very quickly. It seemed that the more syllables we ended on & the more unusual the word the more satisfying was the poem.

A quick demonstration; even doubling up a single syllable word makes it instantly better.

One Syllable       Two Syllables
(not very funny) (funnier)

Boo BooBoo
Do DoDo
Goo GooGoo
Moo MooMoo
Pew PewPew
Poo PooPoo
Woo WooWoo

Although extending to three syllables doesn’t further extend the amusement of the word, as we can see

One Syllable       Two Syllables     Three Syllables
(not very funny) (funnier) (likely to be sung by Sting)

Do DoDo DoDoDo
Da DaDa DaDaDa

The next step after that was to again look at the most commonly found words and lop the top ones off. Here’s the frequency of words for the last couple of weeks that had over 20 matches, because it’s fair to say I very quickly got bored of poems ending with “issue”.

Most common poem ending words.
issue:        1053
interview: 736
continue: 310
review: 286
value: 270
revenue: 154
into: 112
debut: 111
venue: 105
menu: 77
rescue: 55
untrue: 52
overdue: 43
pursue: 27
breakthrough: 27
tattoo: 26
taboo: 22
nephew: 22
anew: 21

Getting rid of those had the outcome of generating only 4–5 “suitable” poems per day, which seemed about the right number. Although sometimes it was still pushing the acceptability envelope somewhat…

…it was enough to keep me happy.

Curiously the top supplier of Roses are red, Violets are blue poems was the Daily Mail, here’s the stats generated for news stories discovered over the last few months…

Top 10 publications by poems generated.
Daily Mail:          762
The Guardian: 678
The Washington Post: 411
New York Times: 447
Fox News: 340
Reuters: 236
The Independent: 169
BBC: 153
CNN: 122
The Telegraph: 118

I think this is down to the Daily Mail’s statistically significant propensity for using words that end on ‘o’; tattoo, hairdo, taboo, yahoo and switcheroo!

The last obvious step was to turn it into a bot that posts it to tumblr and twitter. Especially in the style of inspirational tumblr quotes.

You’re welcome!