As we all know, limericks are short, five-line, occasionally-lewd poems with an AABBA rhyming scheme and an anapestic meter (whatever that is):
Writing a Limerick's absurd
Line one and line five rhyme in word
And just as you've reckoned
They rhyme with the second
The fourth line must rhyme with the third
You are tasked to write the shortest program that, when fed an input text, prints whether it thinks that the input is a valid limerick. Input can either be on the command line or through standard input, at your option, and output could either be a simple "Y"/"N" or a confidence score, again at your option.
Here's another example of a correct limerick:
There was a Young Lady whose eyes
Were unique as to colour and size
When she opened them wide
People all turned aside
And started away in surprise
But the poem below is clearly not a limerick, since it doesn't rhyme:
There was an old man of St. Bees
Who was stung in the arm by a wasp.
When asked, "Does it hurt?"
He replied, "No, it doesn't,
I'm so glad that it wasn't a hornet."
Nor is this one, as the meter is all wrong:
I heard of a man from Berlin
Who hated the room he was in
When I asked as to why
He would say with a sigh:
"Well, you see, last night there were a couple of hoodlums around who were celebrating the Bears winning the darned World Cup, and they were really loud so I couldn't sleep because of the din."
Here are some of the clues you could use to decide whether or not your input is a limerick:
- Limericks are always five lines long.
- Lines 1, 2 and 5 should rhyme.
- Lines 3 and 4 should rhyme.
- Lines 1, 2 and 5 have around 3x3=9 syllables, while the third and fourth have 2x3=6 syllables
Note that none of these except the first are hard-and-fast: a 100% correctness rating is impossible.
Your entry should at the very least correctly categorize examples 1 through 3 in a deterministic fashion.
You are allowed to use any programming language you would like, except of course programming languages specifically designed for this contest (see here).
You are not allowed to use any library except your programming language's standard offerings.
You are allowed to assume that this file, the CMU Sphinx pronounciation dictionary, is in a file called 'c' in the current directory.
You are not allowed to hard-code for the test inputs: your program should be a general limerick categorizer.
You are allowed to assume that the input is ASCII, without any special formatting (like in the examples), but your program should not be confused by interpunction.
The following bonuses are available:
- Your program outputs its result as a limerick? Subtract 150 characters length bonus!
- Your program also correctly identifies sonnets? Subtract 150 characters extra length bonus!
- Your program outputs its result as a sonnet when used on a sonnet? Subtract 100 characters additional extra length bonus!
Remember to mention which bonuses you think you deserve, if any, and subtract the bonus from your number of characters to arrive at your score. This is a code golf contest: the shortest entry (i.e. the entry with the lowest score) wins.