[REBOL] Re: [REBOL parse] Parsing AEIOU and sometimes Y
From: lmecir:mbox:vol:cz at: 2-May-2007 20:47
Ed O'Connor napsal(a):
> On 5/2/07, Ladislav Mecir wrote:
>> To recap, the ultimate goal is to count V C pairs/groups, where V
>> equals an arbitrary number of vowels, and C equals an arbitrary number
>> of consonants, i.e.,
>> simple-VC-rule: [some vowel some consonant (m: m + 1)]
>>> the above rule does not count pairs, rule [(m: 0) some [vowel consonant
>>> (m: m + 1)]] does.
> Thanks, you are right. Prior to the "sometimes y" complication, I had
> been relying on the following rule to build out the algorithm:
> This simplified rule was successful for generating the m value for
> words-- based on my test data. I misquoted this rule in my email.
> Thanks for the clarification.
you can forget about the "sometimes" y when using my suggestion:
simple-vowel: charset "aeiouAEIOU"
y: charset "yY"
simple-consonant: exclude charset [
#"b" - #"x" #"z" #"B" - #"X" #"Z"
pbc: first [
not-preceded-by-consonant: [end skip]
not-pbc: first [
preceded-by-consonant: [end skip]
[simple-vowel | preceded-by-consonant y] not-pbc
[simple-consonant | not-preceded-by-consonant y] pbc
any consonant any [some vowel some consonant (m: m + 1)]
parse "banana" rule
the trouble is, that your pair counting rule still doesn't look exact