This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Implementation of the "Strike a match" algorithm presented in the article | |
http://www.catalysoft.com/articles/StrikeAMatch.html by Simon White. | |
Excerpt from the above URL: The similarity between two strings s1 and s2 is | |
twice the number of character pairs that are common to both strings divided by | |
the sum of the number of character pairs in the two strings. Note that the | |
formula rates completely dissimilar strings with a similarity value of 0, since | |
the size of the letter-pair intersection in the numerator of the fraction will | |
be zero. On the other hand, if you compare a (non-empty) string to itself, then | |
the similarity is 1. |