i goofed up my thread by using the word "anagram" incorrectly, or too loosely... i also wanted to find all the smaller words that i can make with the letters that i have. for example i would like for "monkey" to return with "monk" and "key" and "money" and so on, not just 6 letter words. i think this makes it so you can't use the methods where you sort everything first, which i discovered didnt work all the time if you want smaller words too. if you sort "monkey" you get "ekmnoy" but if you sort "monkeys" you get "ekmnosy", which means if your letters are "monkeys", you wont get "monkey" back. that s is a big monkey wrench between o and y. maybe i should do the sort first way on the words in the dictionary that have the same amount of letters, and then do some other way on all the words that have less letters, and skip all the words that are too long? i'm still glad for all the nice anagram (in the strict sense) finder code in this thread. this is the best list ever. ----- Original Message ----- From: Brian Schröder <firstname.lastname@example.org> Date: Friday, December 9, 2005 4:15 am Subject: Re: is this a good way to find anagrams?
on 2005-12-10 08:16
on 2005-12-12 10:04
email@example.com wrote: > i goofed up my thread by using the word "anagram" incorrectly, or too > loosely... i also wanted to find all the smaller words that i can > make with the letters that i have. for example i would like for > "monkey" to return with "monk" and "key" and "money" and so on, not > just 6 letter words. One interesting way to do subset finding in words is to hook up a fast bignum library (I think ruby/gsl should do this), and index each letter with a prime number, so that a word maps to the product of its letters. Then word_b contains word_a if number_b % number_a == 0. martin