mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-21 11:58:03 +00:00
ba2c4459a5
This introduces two functions, one which creates a fingerprint of a word, and one which computes a distance between two words fingerprints. The fingerprint is made by counting the transitions between one character and another one. Here we consider the 26 alphabetic letters regardless of their case, then any digit as a digit, and anything else as "other". We also consider the first and last locations as transitions from begin to first char, and last char to end. The distance is simply the sum of the squares of the differences between two fingerprints. This way, doubling/ missing a letter has the same cost, however some repeated transitions such as "e"->"r" like in "server" are very unlikely to match against situations where they do not exist. This is a naive approach but it seems to work sufficiently well for now. It may be refined in the future if needed. |
||
---|---|---|
.. | ||
haproxy | ||
import |