I'm trying to find a way to calculate the total number of matching words in a bunch of strings. I have a database with thousands of strings (and unique ID nums), and I can't just do the obvious brute force solution, as it takes WAY too long (see below). Basically I wanna end up with an array that tells me which strings have high probabilities of being the same string (perhaps the same information, told multiple ways). EX:
The quick brown fox jumped over the lazy dogs.
The quick brown dogs jumped over the lazy fox.
Both strings say the same thing, but they would not generate a normal ($string1 eq $string2) match. The trick is, I also want to be told that I have a 'near' match on a string (perhaps "the very quick brown...") too. The data currently exists in a two demsional array:
$big_deal[$count]= $row; # Assign Unique ID to element 0
$big_deal[$count]= $row; # Assign string to element 1
print ($#big_deal+1) . " records found.<br>\n";
I played with this all morning, before it dawned on me that this might be something someone else has done, or would know of a better way to do then I. My solution currently involves six loops (shudder) and a search of only 200 strings returns a result in just under two hours (on a decently fast Xserve). Any advice appriciated!