Re: Counting elements in a list wildcard

2006-04-26 Thread Edward Elliott
Iain King wrote: > steven = re.compile("Ste(v|ph|f|ff)(e|a)n") Also you can expand the RE a bit to improve readability: re.compile("Stev|Steph|Stef|Steff)(en|an)") -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting elements in a list wildcard

2006-04-26 Thread Edward Elliott
Iain King wrote: > steven = re.compile("Ste(v|ph|f|ff)(e|a)n") > steven = ["Steven", "Stephen", "Stefen", "Steffen", "Stevan", > "Stephan", "Stefan", "Steffan"] > > I know which I'd rather type. 'Course, if you can use a ready-built > list of names... Oh I agree, I'd rather *type* the former, bu

Re: Counting elements in a list wildcard

2006-04-26 Thread Iain King
Edward Elliott wrote: > John Machin wrote: > > On 25/04/2006 6:26 PM, Iain King wrote: > >> iain = re.compile("(Ia(i)?n|Eoin)") > >> steven = re.compile("Ste(v|ph|f)(e|a)n") > > > > IMHO, the amount of hand-crafting that goes into a *general-purpose* > > phonetic matching algorithm is already bord

Re: Counting elements in a list wildcard

2006-04-25 Thread Edward Elliott
John Machin wrote: > On 25/04/2006 3:15 PM, Edward Elliott wrote: >> Phoneme matching seems overly complex and might >> grab things like Tsu-zi. > > It might *only* if somebody had a rush of blood to the head and devised > yet another phonetic key "algorithm". Tsuzi does *not* give the same > res

Re: Counting elements in a list wildcard

2006-04-25 Thread Edward Elliott
John Machin wrote: > On 25/04/2006 6:26 PM, Iain King wrote: >> iain = re.compile("(Ia(i)?n|Eoin)") >> steven = re.compile("Ste(v|ph|f)(e|a)n") > > IMHO, the amount of hand-crafting that goes into a *general-purpose* > phonetic matching algorithm is already bordering on overkill. Your > method usi

Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 8:51 PM, Iain King wrote: > John Machin wrote: >> On 25/04/2006 6:26 PM, Iain King wrote: >>> hawkesed wrote: If I have a list, say of names. And I want to count all the people named, say, Susie, but I don't care exactly how they spell it (ie, Susy, Susi, Susie all work

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King
John Machin wrote: > On 25/04/2006 6:26 PM, Iain King wrote: > > hawkesed wrote: > >> If I have a list, say of names. And I want to count all the people > >> named, say, Susie, but I don't care exactly how they spell it (ie, > >> Susy, Susi, Susie all work.) how would I do this? Set up a regular >

Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 6:26 PM, Iain King wrote: > hawkesed wrote: >> If I have a list, say of names. And I want to count all the people >> named, say, Susie, but I don't care exactly how they spell it (ie, >> Susy, Susi, Susie all work.) how would I do this? Set up a regular >> expression inside the count?

Re: Counting elements in a list wildcard

2006-04-25 Thread John Machin
On 25/04/2006 3:15 PM, Edward Elliott wrote: > Phoneme matching seems overly complex and might > grab things like Tsu-zi. It might *only* if somebody had a rush of blood to the head and devised yet another phonetic key "algorithm". Tsuzi does *not* give the same result as any of Suzi, Suzie, Su

Re: Counting elements in a list wildcard

2006-04-25 Thread Iain King
hawkesed wrote: > If I have a list, say of names. And I want to count all the people > named, say, Susie, but I don't care exactly how they spell it (ie, > Susy, Susi, Susie all work.) how would I do this? Set up a regular > expression inside the count? Is there a wildcard variable I can use? > He

Re: Counting elements in a list wildcard

2006-04-24 Thread Edward Elliott
Dave Hughes wrote: > Another algorithm that might interest isn't based on "sounds-like" but > instead computes the number of transforms necessary to get from one > word to another: the Levenshtein distance. A C based implementation > (with Python interface) is available: I don't know what algorith

Re: Counting elements in a list wildcard

2006-04-24 Thread Dave Hughes
hawkesed wrote: > If I have a list, say of names. And I want to count all the people > named, say, Susie, but I don't care exactly how they spell it (ie, > Susy, Susi, Susie all work.) how would I do this? Set up a regular > expression inside the count? Is there a wildcard variable I can use? > He

Re: Counting elements in a list wildcard

2006-04-24 Thread Ben Finney
"Ryan Ginstrom" <[EMAIL PROTECTED]> writes: > If there are specific spellings you want to allow, you could just > create a list of them and see if your Suzy is in there: > > >>> possible_suzys = [ 'Susy', 'Susi', 'Susie' ] > >>> my_strings = ['Bob', 'Sally', 'Susi', 'Dick', 'Jane' ] > >>> for lin

RE: Counting elements in a list wildcard

2006-04-24 Thread Ryan Ginstrom
> Behalf Of hawkesed > If I have a list, say of names. And I want to count all the people > named, say, Susie, but I don't care exactly how they spell it (ie, > Susy, Susi, Susie all work.) how would I do this? Set up a regular > expression inside the count? Is there a wildcard variable I can use

Counting elements in a list wildcard

2006-04-24 Thread hawkesed
If I have a list, say of names. And I want to count all the people named, say, Susie, but I don't care exactly how they spell it (ie, Susy, Susi, Susie all work.) how would I do this? Set up a regular expression inside the count? Is there a wildcard variable I can use? Here is the code for the non-