“Encomials: sonnets from Pentametron”, a whimsical anthology of AI-generated poetry

Published in:  Artificial intelligence

by Pisana Ferrari – cApStAn Ambassador to the Global Village

“What Happens When Machines Learn to Write Poetry?”. This is the title of a recent article for The New Yorker by Dan Rockmore, Associate Dean for the Sciences and  Director of the Neukom Institute for Computational Sciences at Dartmouth College (1)Rockmore provocatively opens by saying that may be more resonances between programming and poetry than one might think. “Computer science is an art form of words and punctuation”, he says, “thoughtfully placed and goal-oriented, even if not necessarily deployed to evoke surprise or longing”. And, “laid out on a page, every program uses indentations, stanzas, and a distinctive visual hierarchy to convey meaning”. Sonnets, in particular, occupy something of a “sweet spot”, he adds: they’re a rich art form (good for poets), with clear rules (good for machines).

Enter Ranjit Bhatnagar, an artist and programmer, someone who can therefore appreciate both of these sides. (2) In 2012, Bhatnagar invented Pentametron, an art project which mines the “Twittersphere” for tweets in iambic pentameter. By using a pronouncing dictionary created at Carnegie Mellon, says Rockmore, Bhatnagar first built a program to count syllables and recognize meter. Then, with a separate piece of code to identify rhymes, he started to assemble sonnets. For the first National Novel Generation Month (NaNoGenMo), in 2013, Bhatnagar submitted I got an alligator for a pet!,” a collection of 504 sonnets created with Pentametron. (3)

For his most recent collection of computer-assisted sonnets, Encomials: sonnets from Pentametron, Bhatnagar relaxed these constraints, says Rockmore, realizing that for a machine to produce work that sounded “human-generated”, it had to strike a delicate balance between accuracy and authenticity. Bhatnagar looked at the debug logs of Pentametron (tweets that had been discarded because they were close to iambic pentameter but not perfect) and built a new program to comb through this corpus and write sonnets with enjambed lines, i.e. phrases that flow over naturally from one line to the next.

Could machine poetry ever pass the Turing Test? (4) Rockmore actually helped put together a submission for the 2016 Turing Tests in the Creative Arts at Dartmouth. The sonnets, created with another algorithm, Hafez, won the competition, but didn’t pass the Turing Test. In fact when all the AI sonnets submitted were interspersed among human ones, none of the AI “poets” managed to fool the competition’s judges.

Encomials has had some great reviews, here is an interesting one by Christian Bök, an experimental Canadian poet, author of Eunoia, which won the Canadian Griffin Poetry Prize. “Ranjit Bhatnagar brings to life what Paul Klee might have called a ‘twittering machine’, a device that, in this case, collates sonnets from a chorus of online tweets. Each sonnet reveals the inadvertent pentameters of poetry hidden in our daily, banal speech. Such a whimsical anthology reveals that, unlike the poets of today, our machines are only getting smarter. Each tweet enlivens us with its haphazard surprises, while all the algorithms race by us, sprinting up Parnassus”

What of the future? One could think of AI as an entirely new, and worthy, category of art, muses Rockmore. “As we interact more and more with machines, both knowingly and unknowingly, our own expectations around both work and art will change, and labels will start to dissolve”. “Machine-generated” could (even) become a kind of literary G.M.O. tag … A fascinating read.


1) “What Happens When Machines Learn to Write Poetry”, Dan Rockmore, The New Yorker, January 7, 2020

2) Ranjit Bhatnagar is an artist who works in music, installation, and text, with a particular interest in algorithmic techniques. His works have been exhibited across the US and in Europe – https://bit.ly/2tAHPtP

3) The National Novel Generation Month (NaNoGenMo) is an online platform created by Darius Kazemi that challenges people to write code that writes a novel. Kazemi is a computer programmer and artist. With Courtney Stanton, he is co-founder of technology collective Feel Train

4) An AI passes the Turing Test if it can prove itself to be indistinguishable from a human. The Turing Test is named after Alan Turing, an English computer scientist, cryptanalyst, mathematician and theoretical biologist.