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 10:15

Hi Ed, ...
> A key piece of the algorithm requires counting the number ("measure") > of vowel-consonant pair-sets according to the following pattern: > > [C] VC (m)... [V] > > Then the value of m is then used to apply suffix swapping rules. So... > setting aside the "sometimes y" issue, the above can be expressed in > 'parse as: > > rule: [any consonant [some vowel some consonant (m: m + 1)] any vowel] > > Once we introduce the "sometimes y" requirement, this simple rule > becomes messy quickly. At the end of the day, I need to add up the > [some vowel some consonant] rule under with that added "sometimes y" > complexity. Thanks to your pointers, I think I'll be able to continue > pursuing it in this direction, hopefully keeping the mess under > control. > > Thanks, > Ed >
how about this one: simple-vowel: charset "aeiouAEIOU" simple-consonant: exclude charset [#"b" - #"x" #"z" #"B" - #"X" #"Z"] simple-vowel y: charset "yY" 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 (print "y = vowel")] not-pbc ] consonant: [ [simple-consonant | not-preceded-by-consonant y (print "y consonant")] pbc ] rule: [not-pbc any [consonant | vowel]] -L