Haiku
No, this is not the operating system. Sorry to disappoint. This is actually an interesting question i came across a few days back. The problem is actually quite simple: code generate as many Haikus as the user wants. Now, why this got me interested is because i used to write a couple of Haikus myself. And i was decent at it as well (it was enough to get a couple of them published in my college magazine). So i sat about thinking what the possible methods of generating Japanese 3 line poetry with a 5-7-5 syllable rule via code be possible. Here is one idea that bounced my mind today and i would like to share it.
Haiku, for those who do not know is as I mentioned earlier, Japanese 3 line poetry with a simple rule: the 1st and the 3rd lines are to have exactly 5 syllables (like that in English), and the 2nd line is to have 7 syllables. Simple!! But not so simple to implement it, or so i thought. I went around trying to break the problem down and realized that is was all about realizing, or making the code realize what a syllable is in a given word. Once you do that there is very little left to it. (Or so i think.) So to tackle that little issue i went about finding out the definition of what a syllable is. And here is what i found:
a combination or set of one or more units of sound in a language that must consist of a sonorous element (a sonant or vowel) and may or may not contain less sonorous elements (consonants or semivowels) flanking it on either or both sides: for example ``paper'' has two syllables. -http://www.thefreedictionary.com/syllables "Some consonants can be pronounced alone (mmm, zzz), and may or may not be regarded as syllables, but they normally accompany vowels, which tend to occupy the central position in a syllable (the syllabic position), as in pap, pep, pip, pop, pup. Consonants occupy the margins of the syllable, as with p in the examples just given. A vowel in the syllable margin is often referred to as a glide, as in ebb and bay. Syllabic consonants occur in the second syllables of words like middle or midden, replacing a sequence of schwa plus consonant . . .." - (Gerald Knowles and Tom McArthur, The Oxford Companion to the English Language, edited by Tom McArthur. Oxford Univ. Press, 1992). Reference http://grammar.about.com/od/rs/g/syllableterm.htmSo come to think of it, even this is not all that crazy as i thought it would be. If one can find enough rules to satisfy the basic criteria of finding the Number of Syllables i think the goal is achieved. Because the idea is not to break up the words into syllables. The idea is to count the number of syllables so that it meets the 5-7-5 criteria of the poem. What i mean is this: in the word combine there are two syllables. Now how does it matter if the two of them are com & bine and comb & ine. The final result is two in either case. So, now that this seems tangible, just pick up a set of words, work around a few combinations in code meet the 5-7-5 criteria and viola!!! You have a haiku. Who says that it has to make sense? ;) But there is a simple work around for that as well. Atleast the idea in my head can get more understandable haikus than the ones you would otherwise get with raw code driven combinations. The idea is to take a known, grammatically or even poetically correct source of text. Mix up the sentences if you like. If you are worried about plagiarism use the content of your blog or something. Just any trusted source of text which meet the above two criteria. Now, work up an algorithm to pick up fragments of sentences from this source which meets the 5-7-5 criteria. And, if your code is decent, you will get more than one human understandable haiku in one go. So there you have it. Go along now, make those words rhyme. ;) And when you do, give me a call, because i am too tired to try it out now. May be another day. Till then, good night.