Re: Fuzzy string matching of product names - Mailing list pgsql-general

From Andy Colson
Subject Re: Fuzzy string matching of product names
Date
Msg-id 4BBB4BC5.7080808@squeakycode.net
Whole thread Raw
In response to Re: Fuzzy string matching of product names  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List 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

pgsql-general by date:

Previous
From: Björn Lindqvist
Date:
Subject: Re: Completely wrong row estimates
Next
From: David Kerr
Date:
Subject: Re: Connection Pooling