Re: Fuzzy string matching of product names

From: Andy Colson <andy(at)squeakycode(dot)net>
To: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>, PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Fuzzy string matching of product names
Date: 2010-04-06 14:57:09
Message-ID: 4BBB4BC5.7080808@squeakycode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/5/2010 3:00 PM, Peter Geoghegan wrote:
>> http://www.postgresql.org/docs/8.4/static/fuzzystrmatch.html
>>
>> --
>> Bill Moran
>> http://www.potentialtech.com
>> http://people.collaborativefusion.com/~wmoran/
>
> Fuzzystrmatch is generally used to compare two single words for how
> similar they sound. How can that actually be applied to get the
> functionality that I've described?
>
> Regards,
> Peter Geoghegan
>

You could use regexp_split_to_table to split words, then soundx each
one, and find matching... assuming you have a table like:

andy=# select * from tmpx;
id | cname
----+-----------------
1 | andy corp
2 | cola corp
3 | pepsi cola corp
4 | bob inc
(4 rows)

(I dont have the soundx stuff installed, so I'll uppercase instead)

andy=# select id from (select id, upper(regexp_split_to_table(cname,
E'\\s+')) as sndx from tmpx) as foo where sndx = 'CORP';
id
----
1
2
3
(3 rows)

and actually, you probably want "select distinct id from..."

-Andy

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Kerr 2010-04-06 17:09:10 Re: Connection Pooling
Previous Message Björn Lindqvist 2010-04-06 13:21:24 Re: Completely wrong row estimates