How would you write a program to generate Haiku? [closed]
Computer Haiku
How would you write a program
To make them for you
Measure syllables
Understand semantic flow
Your goal can be met
Do not attempt it
Poetry does not mix well
With metal and bits
More seriously, good haiku (and even bad haiku) is a lot more about condensing meaning and imagery than counting syllables. It is generally also based on themes gathered from nature. Random word generation and syllable counting will get you measured gibberish, but not poetry...
First, you'll want to look into Markov chains, and second, there's a book about computer-generated poetry called Virtual Muse.