Looking for library to estimate likeness of two strings
Guilherme Polo
ggpolo at gmail.com
Thu Feb 7 10:46:20 EST 2008
2008/2/7, agenkin at gmail.com <agenkin at gmail.com>:
> On Feb 7, 2:37 am, "Daniel Fetchinson" <fetchin... at googlemail.com>
> wrote:
>
> > Hi folks, just went through this thread and a related one from 2006
> > and I was wondering what the best solution is for using these string
> > metrics in a database search. If I want to query the database for a
> > string or something that is close to it (close being defined by one of
> > the string metrics discussed above) it seems I have to select each and
> > every word from the database and compare it with the query word which
> > is very ineffective.
>
>
> I have never used sqlite database, but Postgres has a module that
> implements levenshtein(), soundex() and metaphone() functions, so you
> can do something like this:
>
> SELECT * FROM s WHERE soundex(name) = soundex('john');
> SELECT * FROM s WHERE difference(name, 'john') > 2;
>
> http://www.postgresql.org/docs/8.3/static/fuzzystrmatch.html
>
SQLite supports soundex, but it is disabled by default, you need to
compile it with -DSQLITE_SOUNDEX=1
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
-- Guilherme H. Polo Goncalves
More information about the Python-list
mailing list