Rafael 'Dido' Sevilla wrote: > I think that syllabication rules in words are not regular sets. I > suspect that at the very least the complete set of rules needs a CFL, > given how messy English syllabication rules are. Note the word > 'syllable' violates the simple rule you've given: 'syl-la-ble' (the > first syllable contains NO vowels). Maybe it would be better to encode > the syllabication rules and use them recursively. I believe programs > like TeX and MS Word actually have extensive databases of syllabication > rules that do this job with perfect accuracy (I have the feeling that > most if not all open source programs that do hyphenation have code > that's ultimately derived from TeX...perhaps even some closed-source > programs do, given the nature of TeX's licensing). I'm sorry. I should have made clearer I was not asking for high-level thinking about grammar, or even a 99.9997% accurate counter. (But I did cover Y is always a vowel.) Further, you are discussing the word-break rules. I mean the phonetic pronunciation rules, and all I need is a rough count. I don't need to locate the actual breaks; this would require the deep business rule set you describe. The existing code handles "syllable" fine: assert 3 == syllableCounter('syllable') I'm only asking for tutorial help refactoring my function to put the 'if' statements inside the regular expression. Because I supplied the tests needed to show the refactor's safe, the refactor should add or remove no grammar rules. -- Phlip http://www.greencheese.org/PeaceAndCalm -- In the future everyone will be Andy Warhol for 15 minutes --