Melbourne: An Indian origin computer programmer living in US has written an algorithm that turns millions of tweets into poetry.
Ranjit Bhatnagar’s algorithm scans millions of Twitter postings to find rhyming couplets in Shakespearean-style iambic pentameter and turn them into sonnets.
“There are great tidal waves of language sloshing around the planet all the time, and Pentametron is just picking out a few shiny seashells,” News.com.au quoted Bhatnagar as saying.
The algorithm works by referencing the Carnegie Mellon University dictionary, which contains more than 150,000 words and names and is trained to ignore emoticons.
“If it knows all the words, it checks the dictionary for the stress patterns of the words, which add up to the rhythm of the tweet,” he explained.
“If the rhythm seems to match the pattern of iambic pentameter, the tweet goes into a bin of potential lines of poetry. On average, about one in every 50,000 tweets qualifies,” he said.
Bhatnagar said he was inspired by the surrealist movement of the 1920s where poets would create collaborative works by adding a text to a poem without knowing what the others had written.
“Constraints, like a 140 character limit, or black and white film, or a complex rhyme scheme, are a proven way to spur creativity,” he added.