Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[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. > > Ed >
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" ] simple-vowel pbc: first [ ( preceded-by-consonant: none not-preceded-by-consonant: [end skip] ) ] not-pbc: first [ ( preceded-by-consonant: [end skip] not-preceded-by-consonant: none ) ] vowel: [ [simple-vowel | preceded-by-consonant y] not-pbc ] consonant: [ [simple-consonant | not-preceded-by-consonant y] pbc ] rule: [ (m: 0) any consonant any [some vowel some consonant (m: m + 1)] any vowel ] parse "banana" rule the trouble is, that your pair counting rule still doesn't look exact -L