Random Limerick GeneratorFor some great original limericks, visit Cybergeezer's www site here. It's his work I quote below. |
|
| Limericks All limericks should have the same form: five lines of verse covering four bars of rhythm in 12/8-time - a ubiquitous time-signature in Irish folk music. Lines 1,2 and 5 rhyme with one another, as do lines 3 and 4. Limericks are a concise and economical storytelling form. That property, as well as outrageous rhyming, is probably what makes a good limerick so hilarious: There was a young girl from Tahiti, Pandora, a psychic and mystic, An impetuous maiden named Marion, A NASA technician named Lars A fellow named Gates, no carouser, |
WinZip® brings the convenience of Windows to the use of Zip files and other compression formats. If you don't have "the most celebrated shareware app in the history of computing" already, use the above link to download it. |
| Random Limericks This project is somewhat dear to me as it followed on from my random song lyrics program which in turn followed on from the random word generator which was the first computer program I designed - at school on an Apple II microcomputer in about 1979. The algorithm for that first opus was to randomly choose a word length (1-n letters) then for each iteration (1-wordlength) choose a random number (0-25), add it to the character 'A' and print the result. Outside the loop a space would be printed then the whole procedure repeated. My schoolfriend Chris Pearson and I spent our lunch hour staring expectantly at the printer waiting for the Hamlet soliloquy which we knew for a statistical fact was eventually due. But, our lunch hour being several billions of years too short at least, we had to be content with the word TIT as the longest intelligible word produced - not an unamusing result, though, for two 13-year-old boys. The next project was random song lyrics - seeded with a selection of Queen lyrics spiced up with the most ribald contents of my vocabulary at the time. Syntactic correctness was thin on the ground, never mind semantics, but the output was wonderfully surreal and pant-wettingly funny for any fan of nonsense. That surreality takes on somewhat more structure in the sample offered here - my random limerick generator. First written in BASIC for the ZX81, then the ZX Spectrum, and many years later rewritten in C for DOS on the PC. This version is a Visual C++ application written using MFC, so I apologise in advance for the large download sizes! It features a dialog box with which to edit the vocabulary used to generate limericks, and a rich edit control view into which the limericks are written. The application reads and writes .lim files which contain both the vocabulary and any contents of the rich edit control at the time of saving. When you run the application and choose the Who [VERB] [ADJECTIVE] [PLURAL_NOUN] of And it was chosen as the second line in a limerick, then the markers might be replaced to give this:Who wore six bums of sorrow A useful feature when you're priming the vocabulary from real limericks is to paste each line of the limerick into the appropriate list of line templates and then replace each part of speech with a part of speech marker. Do this by double-clicking a word to select it and then pushing the button representing the part of speech to which the selected word belongs. This will do two things: cut the word and place it in the part of speech list, and replace the selection with the part of speech marker written on the button. So for example for the limerick which begins:There was a young girl from Tahiti double-click the word 'young' to select it and then choose the [ADJECTIVE] button. This will place 'young' into the list of adjectives and place a marker into the line template. After replacing the ajective 'girl' if you so wish, all that's left is the rhyme. You'll have to handle the rhyme manually, I'm afraid, as I didn't rate my chances of coming up with a reliable algorithm to match the sounds of words. You might want to add a limerick's rhymes to the vocabulary first then copy its lines to the line template lists, do the substitutions, and then delete the rhyme from the end. In the above example, after substitutions, the template might end up like this:There was a [ADJECTIVE] [SINGULAR_NOUN] from If you're doing a lot of editing and you don't want to be continually reminded about unsaved changes then uncheck the Confirm Save Changes checkbox. Once you've finished editing your vocabulary, dismiss the dialog box and choose theOkay, they're not as good as Cybergeezer's limericks, but then a lot less effort (and no wit nor intelligence) goes into the random ones - and they're generated quicker than one a week. Although this random limerick system has something in common with Natural Selection inasmuch as it involves a random element applied over large timescales the product of which is subject to some sort of appraisal or filtering, the fundamental distinction is that my system does not evolve. Ironically, my original random word generator - the first program I ever designed - is statistically guaranteed eventually to produce a perfect limerick to everyone's taste. Not necessarily in our Universe's lifetime, though. The random limerick generator isn't blessed with such theoretically limitless talents. Even so, it is pretty cool when sheer chance throws up a pleasantly bizarre or suprisingly meaningful line or limerick - and, what's more, you're likely to live long enough to see them. Success does depend on taking care to set up a good vocabulary, though. The artifice lies in the vocabulary design; the generator and probability supply the art. Here's a couple of better examples using the supplied limerick vocabulary file (you'll probably wonder how bad the not-so-good examples were!). Isaac Newton explained Einstein's dance |
| last updated: 4-oct-01 |