From: Brian Candler Date: 2008-10-07T03:15:45+09:00 Subject: Re: Problem with comparing huge amount of strings Martin DeMello wrote: > On Mon, Oct 6, 2008 at 1:03 AM, Jan Fischer wrote: >> certain number if comapare method says they match. > The problem with relying on a compare function for grouping is that it > leads naturally to an O(n^2) solution. Ideally, what you want is some > sort ofo "characteristic" function, so that two entries with the same > characteristic are likely to be in the same grouping. Soundex on the first word, perhaps? (See wikipedia) I don't know how appropriate it would be for your dataset, but it's easy to try out. Maybe at least it will give you some smaller groups which in turn can be subject to more detailled analysis. If it works well then you can make an extra column for this value, with an index, so your DB can search and group on it efficiently. -- Posted via http://www.ruby-forum.com/.