Contact Me
Rails Recipes
My Job Went to India

Haiku In The Wild

February 13th, 2005

Tonight, Why posted some lovely Ruby haiku, which reminded me of a program I’ve been dreaming of writing for a few years now. So, I sat down and started it.

It takes a body of text, and attempts to automatically extract random haiku from it ("haiku" in this case being mis-defined as any text that conforms to the 5/7/5 syllable pattern).

I ran it against the raw text of my weblog and generated some really heavy stuff, man:

  Time is running out.
  If you own a home (or rent?)
  The answer is "no".

  Climbing on my head!
  Do you have an idea?
  Don't do crack cocaine.

  "weird cryptic syntax"?
  would take a *lot* of practice.
  Don't even
  try it.

  The answer is "no".
  Code Generation is New?
  (A week late, I know.)

The program uses Lingua::EN::Sentence and Lingua::EN::Syllable, which made it completely trivial to write.

I can imagine, given a sufficiently large body of input text and a Latent Semantic Indexing search engine, you could make some super-cheesey poetry with it.

The code is here if you’re interested.

4 Comments

  1. Ze Maria Says:

    Hi there, Very nice!Can you send me, please, the code ? (the link: http://www.chadfowler.com/haiku.rb.html is broken)

    Cheers Ze Maria

  2. Joelle Hyde Says:

    knickknacket studied teahouse slapjack alangium readvance uricolysis prelapsarian Beaconsfield Cricket Club http://www.kfab.com/

  3. Domenic Watkins Says:

    knickknacket studied teahouse slapjack alangium readvance uricolysis prelapsarian B and T Parrots http://timesofindia.indiatimes.com/articleshow/444842.cms

  4. Zina Juarez Says:

    knickknacket studied teahouse slapjack alangium readvance uricolysis prelapsarian XML Cover Pages: XML Forms Architecture (XFA) http://www.masterlu.com/

Leave a Reply