Instead of making two seperate functions for matching and transposes (which would be terrible since you find the transpose while doing matching), I created this little class to hold the results of both.
Find the all of the matching and transposed characters in two strings
Find the all of the matching and transposed characters in two strings
First String
Second String
A Match Result with both the number of matches and number of transposed characters
Determine the Jaro Distance.
Determine the Jaro Distance. Winkler stole some of Jaro's thunder by adding some more math onto his algorithm and getting equal parts credit! However, we still need Jaro's Distance to get the Jaro-Winkler Distance. Equation: 1/3 * ((|A| / m) + (|B| / m) + ((m - t) / m)) Where: |A| = length of first string |B| = length of second string m = number of matches t = number of transposes
Number of matches
Number of transposes
Length of String one
Length of String two
Jaro Distance
Determine the maximum window size to use when looking for matches.
Determine the maximum window size to use when looking for matches. The window is basically a little less than the half the longest string's length. Equation: [ Max(A, B) / 2 ] -1
First String
Second String
Max window size
Find the Winkler Common Prefix of two strings.
Find the Winkler Common Prefix of two strings. In Layman's terms, find the number of character that match at the beginning of the two strings, with a maximum of 4.
First string
Second string
Integer between 0 and 4 representing the number of matching characters at the beginning of both strings.