Re:Pentametron Reveals Unintended Poetry of Twitter Users
by klenwell on Sunday February 17, 2013 @04:34PM
(#5236823)
Here's some pythonesque pseudo-code that might do it:
for tweet in twitter_api.latest_tweets():
phonetic_tweet = convert_tweet_to_phonemes(tweet)
if is_iambic(phonetic_tweet):
end_rhymes = extract_end_rhymes(phonetic_tweet)
db.insert_iambic_tweet(tweet, end_rhymes)
for end_rhyme in end_rhymes:
rhyming_tweets = db.select_rhyming_tweets(end_rhyme)
if rhyming_tweets:
rhyming_tweet = random.choice(rhyming_tweets)
return [tweet, rhyming_tweet]
There are several open source word lists out there that make this feasible.
Re:Pentametron Reveals Unintended Poetry of Twitter Users
by abecedarius on Sunday February 17, 2013 @05:01PM
(#5236907)
I also wrote a filter over Twitter for iambic pentameter once, and had a friend write a web frontend to it. Here's my (messy) code; http://glozer.net/ wrote the frontend in Erlang but AFAIK never released it.
https://github.com/darius/versecop
Pentametron is cooler. I did try filtering for rhymes too, but there wasn't enough data in the free feed, at least back then.
Re:Pentametron Reveals Unintended Poetry of Twitter Users
by nzukoski on Sunday February 17, 2013 @09:11PM
(#5237759)
I read somewhere that it uses the cmu pronouncing dictionary which would give it both the meter and rhyme it needs (http://www.speech.cs.cmu.edu/cgi-bin/cmudict)
love watching people do the Harlem shake
I really really really want a snake
How does it work? I'm guessing it 1) scans tweets for pentameters using a large corpus annotated by syllables, then 2) looks up a rhyming dictionary to check the tweet is likely to be fruitful (i.e. doesn't end with the word orange or similar) and 3) waits...