Pentametron creates sonnets out of users’ tweets

This is certainly a lot better use of a Twitter bot than most. It’s just the sort of high-concept bot I would love to do, if only I had a decent idea for one. And I bet it’ll irritate real poets, like Cuttlefish, for its (present) flaws.

Creator Ranjit Bhatnagar built, in PHP, a script that searches Twitter’s millions of tweets an hour for any and all tweets that match iambic pentameter scansion, finds rhyming couplets, and compiles them together into a sonnet. And considering the source, there’s some amazingly deep stuff! For instance:

still haven’t eaten anything today…
Have had a lotta nicknames growing up
BOO Chelsea !! Liverpool deserve the cup !!
Blue is the Color, Football is the game…

Fame of the money, Money of the fame.
Do not appreciate the referee.
REMEMBER LOVE, REMEMBER YOU AND ME
So many babies at the outlet mall

Abundant Life Assembly welcomes all! 😀
Its fucking hailing! Hail! In fucking May!
im shirted up… and ready for the day!
Tomorrow Baby Steps and Twinkle. O/

I was invited to the city tho :)))))
i Hit the mall and spend a G today .

See!? Civilization has totally achieved its purpose, the world can end now.

The really cool thing about this, to me, is how the script figures out the scansion.

First, it strips the tweet of emoticons and ASCII art. It then cross-references each word against the CMU Pronouncing Dictionary. CMU includes stress markers, indicated, in a poetically neat turn, as ones and zeros — the line for abandonment, for example, is “AH0 B AE1 N D AH0 N M AH0 N T” — and Pentametron compares those markers against the binary line for iambic pentameter: 0101010101. If the tweet is in iambic pentameter, Pentametron retweets it; if not, it moves on.

At the start, Pentametron concerned itself only with rhythm, which made for engaging if opaque blank-verse sonnets. It now attempts to create rhyming couplets, in chronological order. (Bhatnagar acknowledges that the AABB rhyme scheme of Pentametron’s sonnets isn’t properly Shakespearean, and says he plans on eventually reworking his robo-poet to write in more complex rhyme schemes.)

If you have an inkling build a Twitter bot, I built a Python framework you can use as a starter. I’ve basically used it for nothing so far, save for scraping Mock The Movie. I’d be thrilled if it was used to build something remotely as awesome as this bot, quite frankly.

{advertisement}
Pentametron creates sonnets out of users’ tweets
{advertisement}

13 thoughts on “Pentametron creates sonnets out of users’ tweets

  1. 1

    The truth is, I’m fascinated by stuff like this. I wrote about the Google Poetry Translator a while ago (http://freethoughtblogs.com/cuttlefish/2011/01/17/google-poetry-translator/ ).

    I do find it amusing that I am more mechanically bound to strict pronunciation than the twitterbot is–my suspicion is that if it and I were to generate two-score verses, and these verses were presented to real poets to judge, twitterbot would be seen as a more human poet than I am.

    (which is a polite way of saying that the twitterbot can’t rhyme to save its CPU. Sadly, neither can most units running the standard wetware.)

  2. 2

    Yeah. I’m amused by some smileys not being recognized, and the letters being used to produce a rhyme (like line 12 above: you have to pronounce O/ as “Oh” instead of “Dude with its arms in the air”).

    Still, rhyming is a “solvable” problem. A PC with a proper pronunciation dictionary could easily find strictly-mechanical rhymes, rhymes that only work in a dialect, or even loose rhymes.

  3. 4

    Oooh. Now there’s something I might enjoy coding. You’d need like half as many tweets, since so many are refrain!

    Was trying to figure out how to do limericks as a mental exercise, after @brx0 on Twitter told me that searches for “Nantucket” produced results in spades.

  4. 5

    Still, rhyming is a “solvable” problem. A PC with a proper pronunciation dictionary could easily find strictly-mechanical rhymes, rhymes that only work in a dialect, or even loose rhymes.

    rhymezone has tools for exact rhymes and close rhymes (I have not explored them, so I don’t know how loose they are in either category), and of course “real” poets (read: not me) vary in how far from exact rhymes they are willing to go (or, frankly, how close to exact rhymes they are willing to go), so pentametron could conceivably have far less a task on its hands than initially seems!

  5. 9

    Well, assuming the tweeters at least correctly spell the last word, yeah, rhyming isn’t that bad. I’d chuck anything misspelled to start off with.

    Trust me, what rhymes for one person absolutely does not rhyme for all. I edited a book for an Englishman, and in the end we just had to agree to disagree. Or, as he put it… “bite me”.

  6. 11

    You kiddin’? This is the internet we’re talking about. It sparks flame wars over the most milquetoast and universally agreeable topics.

    Okay, I’m seriously thinking of doing the Pentametron one better. Rhyming and pronunciation are both solved problems, theoretically. One could conceivably feed multiple concurrent bots different rulesets and generate every sort of structured poetry imaginable. Limericks might be a while between output, though, considering how seldom people tweet five syllable tweets. I’d have to do something so it had options to include the end syllables, and that it works on multiple poems concurrently so as not to waste potential poem fodder because it hit on a tough rhyme or rare scansion.

  7. 12

    Ok… first thing is, you aren’t looking at poetry, you’re looking at verse. Which A) is so much easier than poetry–more mechanical, more rule-governed, more predictable… and B) is my bailiwick! I don’t do poetry, I do verse, which is much more amenable to computer-generated analysis. But which is also soooo two generations ago, if you ask modern poets.

    I do not know the answer to this, but I’d place a bet… in the past ten years, there have been ten editions of “best poetry” anthologies–I would bet that sonnets (shakespearian or petrarchan) represent less than 5 percent of the “best” poems of the past decade. I suspect that I could make the same wager for *any* rhyme-and-meter form, not just sonnets.

    And, on another note…

    Take a good look at the OEDILF site before you try to computerize limericks. These people are good. Really good. Most of what I threw at them, that I thought was perfectly fine, was clearly and obviously inadequate. In other words, limericks are harder than we think they are.

    Now, I firmly believe that even poetry can be seen as the product of environmental influence. But this twitterbot ain’t it yet. It shows, though, that remarkable things can be generated by simple iterative processes.

  8. 13

    Some of these couplets are actually really cool, and weirdly profound, like the stuff you sometimes find in magnetic poetry:

    Do not appreciate the referee.
    Remember love, remember you and me.

    Pentametron tells a story as old as humanity, about passion and loyalty in defiance of society’s restraints.

    By the way, about limericks being harder than people think: I have one that I wrote, that in fact I’ve posted once on FTB, in one of JT&’s threads, I think:

    I see you’re attempting a limerick
    But rhyming, my friend, is a cheap trick.
    To make your verse leeter,
    Remember the meter:
    Three three two two three amphibrachic.

    It was indeed hard to write; the word “amphibrach” turns out to be a dactyl, which I don’t think is really fair. But now that I have it, it’s amazing how often I get to use it: in almost any public board or thread where limericks appear, one of them justifies posting that in response. The people I address it to never seem to think it’s funny, though…

Comments are closed.