[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Regex for the last vowel/diphthong in a word



On Mon, Aug 02, 1999 at 04:29:58PM -0400, Michael G Schwern wrote:
> On Mon, Aug 02, 1999 at 03:51:51PM -0400, Stevie Strickland wrote:
> > Okay, I was trying to come up with a regex for the last vowel/diphthong
> > in a word that is in this set: a, o, u, au.  The best regex I've come
> > up with so far is this:
> > 
> > /([aou]u?)([^aou]*)$/
> > 
> > (Assume for the purposes of this exercise that the variable against
> >  which this match is being performed is a single word.)
> 
> Would (/([aou]|au)/g)[-1] be simplest?  Could be slow if the string is
> large.

Yeah... if I use this to also parse a vocab file, I may not want to try
that... I like the next thing you suggested :)

> Maybe something with a negative lookahead... (coworker suggested this)
> 
> /([aou]|au)(?=[^aou]*$)/

Hmmmm... that looks good, I was looking at negative lookaheads, myself,
but I wasn't *too* sure on how to use them... I see, they're just what
would be next in the regex without actually using it (so the
/$accent{$1}$2/ in my s/// could just be /$accent{$1}/... thanks :)

> I don't know if its relevant, but would something like Text::Metaphone
> be helpful?  Dipthongs, phonemes... same diff.

Errrrr... well, I'm not too sure... I looked at the Readme (this is your
module, right?) and I'm kinda iffy on whether it would work well, being
based off an English speaker's speech... but I could try it and see,
anyway... thanks for the help! :)

Thanks,
Stevie

-- 
Stevie Strickland                    |  325912 Georgia Tech Station
sstrickl@cc.gatech.edu               |  Georgia Institute of Technology
http://kelewan.dhis.org/~sstrickl    |  Atlanta, GA 30332
Official Debian GNU/Linux Developer  |  Cyberlink/#Debian on IRC
Member of the X Strike Force         |  PGP/GPG ID = 23A6D909/AE7637D9
------------------------------------------------------------------------
PGP Key fingerprint = 84 52 C7 EA E6 DB A1 C5  6A C9 D6 B9 88 26 74 FC
GPG Key fingerprint = 3062 4329 AA5C 6095 DB71  AF9A 2A5E C7DE AE76 37D9

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe