Hello On Fri, Jun 26, 2009 at 3:00 PM, Igor Tandetnik<itandet...@mvps.org> wrote: > Alberto Simoes wrote: >> For that, my script receives a word (say, 'car') and generated all >> possible additions and remotions, and substitutions: >> >> Additions: _car c_ar ca_r car_ >> Substitutions: _ar c_r ca_ >> remotions: ar cr ca >> >> Then, the script constructs an SQL query: >> >> SELECT DISTINCT(word) FROM dict WHERE word = "ar" OR word = "ca" OR >> word LIKE "_car" OR word LIKE "c_r" OR word = "cr" OR word LIKE "_ar" >> OR word LIKE "ca_r" OR word LIKE "c_ar" OR word LIKE "ca_" OR word >> LIKE "car_"; >> >> And this SQL quer works... but not as quickly as I need (specially >> because the speed is proportional to the word size). > > I'd try writing a custom function that figures out whether two words are > "close enough" (most of the time, you should be able to declare a > negative by looking at just two first characters), then do > > select word from dict where closeEnough(word, 'car');
Hmms, need to check how to do that. But that would mean call the function to all words in the database (110K atm). > I also don't see why you need DISTINCT. Do you have duplicate words in > dict? Yes, I have. Forgot to explain ;) Thanks -- Alberto Simões _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users