From: Rafael 'Dido' Sevilla Date: 2002-08-05T12:21:56+09:00 Subject: Re: Regex to count syllables On Mon, Aug 05, 2002 at 11:58:18AM +0900, Phlip wrote: > Rubies: > > Just a tricky one. I need a function that counts syllables in English words > with, say, 99.5% accuracy for common words. The deal is a "syllable" seems > to be "a group of one to three vowels, always including Y"; the exceptions > seen so far are "a trailing 'ing' is always a syllable", and "silent E on > the end not preceded by L is not a syllable." 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). -- Rafael R. Sevilla +63(2)8123151 Software Developer, Imperium Technology Inc. +63(917)4458925