A friend of mine made a tool that did exactly this, but with Haikus instead.  He had a dictionary of syllables, and then just iterated through the syllables (following the rules of a haiku).  You can type in a haiku and find its index, or just iterate through the indices to see the (mostly nonsense) generated haikus.