John Colby
jcolby at colbyconsulting.com
Wed Oct 22 17:30:00 CDT 2003
Thanks. John W. Colby www.colbyconsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart McLachlan Sent: Wednesday, October 22, 2003 6:18 PM To: Access Developers discussion and problem solving Subject: RE: [AccessD] "fuzzy logic" search On 22 Oct 2003 at 9:26, John Colby wrote: > Stuart, > > Could you comment the code for me? I have no idea what the hamming distance > is trying to accomplish and don't wish to take a class to figure it out. > Just a 1 paragraph overview at te top and a couple of line comments thrown > in would be a great help. > Sorry, I thought it was fairly obvious. Hamming Distance is a measure of the "differentness" of two strings: It is just a count of the number of locations within a string which are different. The function just checks whether the two strings are the same length and then steps through them comparing the character at each location. I used a flag of -1 to indicate that the strings where a different length. A perfect match has a Hamming Distance of 0. If one character has been mistyped, there will be a Hamming Distance of 1. If two mistypes (including a transposition of two digits) the Hamming Distance will be 2 etc. I just check for a Hamming Distance of 1, or a distance of 2 where the checksum of the two strings is the same (an indication that they are likely to contain the same set of characters) -- Lexacorp Ltd http://www.lexacorp.com.pg Information Technology Consultancy, Software Development,System Support. _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com