Re: Help Optimizing Word Search

2005-01-12 Thread snoe
With a list of letters: 'ABAE?S?' your implementation ran 3.5 times faster than the one from http://blog.vrplumber.com/427 (in 0.437 seconds vs 1.515) Without wildcards yours runs slightly quicker as well. I guess with the wildcards, using an re as a quick filter against each word, versus the tra

Re: Help Optimizing Word Search

2005-01-12 Thread Scott David Daniels
Paul Rubin wrote: "Case Nelson" <[EMAIL PROTECTED]> writes: Basically, the program needs to take in a random list of no more than 10 letters, and find all possible mutations that match a word in my dictionary (80k words). However a wildcard letter '?' is also an acceptable character which increas

Re: Help Optimizing Word Search

2005-01-12 Thread Win
Hi Case. Just in case you're really, truly looking for a fast Scrabble word-search algorithm, the classic AI/CS article here is: Andrew W. Appel and Guy J. Jacobson, The world's fastest Scrabble program, Communications of the ACM, 31(5), pp 572--578, May 1988. You can find a copy of this article

Re: Help Optimizing Word Search

2005-01-12 Thread Ganesan R
> "Case" == Case Nelson <[EMAIL PROTECTED]> writes: > Hi there I've just been playing around with some python code and I've > got a fun little optimization problem I could use some help with. > Basically, the program needs to take in a random list of no more than > 10 letters, and find all p

Re: Help Optimizing Word Search

2005-01-11 Thread snoe
Mike, Thanks, this worked great, and was 4x faster than my method! Thanks everyone for replying! The changes I made were: !rest = ''.join([chr(i) for i in range(256) if chr(i).upper() not in WORD]) !# a wildcard in the word means that we check all letters !if '?' in WORD: !rest = '' !trans

Re: Help Optimizing Word Search

2005-01-11 Thread snoe
First of all thank you very much for the reply. I hope I'm not too verbose here, just hope that if someone else runs into a similar problem they can find an answer here. > This appears to be a Computer Science 101 Data Structures and > Algorithms question, not a Python question, but here's an answ

Re: Help Optimizing Word Search

2005-01-11 Thread Mike C. Fletcher
To search for a word which is a jumble of a given set of characters in a (sizable) lexicon, see this posting: http://blog.vrplumber.com/427 your alterations would be to check for length == to length - number-of-wildcards (with the wildcards removed from the translation table, of course) and

Re: Help Optimizing Word Search

2005-01-11 Thread John Machin
Paul Rubin wrote: > "Case Nelson" <[EMAIL PROTECTED]> writes: > > Basically, the program needs to take in a random list of no more than > > 10 letters, and find all possible mutations that match a word in my > > dictionary (80k words). However a wildcard letter '?' is also an > > acceptable char

Re: Help Optimizing Word Search

2005-01-11 Thread Paul Rubin
"Case Nelson" <[EMAIL PROTECTED]> writes: > Basically, the program needs to take in a random list of no more than > 10 letters, and find all possible mutations that match a word in my > dictionary (80k words). However a wildcard letter '?' is also an > acceptable character which increases the wor

Re: Help Optimizing Word Search

2005-01-11 Thread John Machin
Case Nelson wrote: > Hi there I've just been playing around with some python code and I've > got a fun little optimization problem I could use some help with. > > Basically, the program needs to take in a random list of no more than > 10 letters, and find all possible mutations that match a word

Help Optimizing Word Search

2005-01-11 Thread Case Nelson
Hi there I've just been playing around with some python code and I've got a fun little optimization problem I could use some help with. Basically, the program needs to take in a random list of no more than 10 letters, and find all possible mutations that match a word in my dictionary (80k words).