Possible Duplicate:
Detecting syllables in a word
For kicks (and to brush up on my Python), I’m trying to create an algorithm that will randomly generate a Haiku (Japanese poem made up of three lines with 5, 7, and 5 syllables each).
The problem I’ve run into is finding the number of syllables in a word (I’m using the en-US.dic from Ubuntu).
Currently, I have a script running that attempts to grab the number reported by this web site, but that is slow, and isn’t generating many hits. This seems more promising, but I don’t know how to use Python to inject a word into their text box.
My question is two-fold:
- Is there an algorithmic way to determine the number of syllables in a word (and thus, not need to make thousands of web requests)?
- Can I use Python to inject words into WordCalc?
Download the Moby Hyphenated Word List. It has most English words and names hyphenated by syllable. The number of syllables would be the number of hyphen markers + number of spaces + number of actual hyphens + 1.