String metric explained

In mathematics and computer science, a string metric (also known as a string similarity metric or string distance function) is a metric that measures distance ("inverse similarity") between two text strings for approximate string matching or comparison and in fuzzy string searching. A requirement for a string metric (e.g. in contrast to string matching) is fulfillment of the triangle inequality. For example, the strings "Sam" and "Samuel" can be considered to be close.[1] A string metric provides a number indicating an algorithm-specific indication of distance.

The most widely known string metric is a rudimentary one called the Levenshtein distance (also known as edit distance).[2] It operates between two input strings, returning a number equivalent to the number of substitutions and deletions needed in order to transform one input string into another. Simplistic string metrics such as Levenshtein distance have expanded to include phonetic, token, grammatical and character-based methods of statistical comparisons.

String metrics are used heavily in information integration and are currently used in areas including fraud detection, fingerprint analysis, plagiarism detection, ontology merging, DNA analysis, RNA analysis, image analysis, evidence-based machine learning, database data deduplication, data mining, incremental search, data integration, malware detection,[3] and semantic knowledge integration.

List of string metrics

There also exist functions which measure a dissimilarity between strings, but do not necessarily fulfill the triangle inequality, and as such are not metrics in the mathematical sense. An example of such function is the Jaro–Winkler distance.

Selected string measures examples

NameDescriptionExample
Hamming distanceOnly for strings of the same length. Number of changed characters."" and "" is 3.
Levenshtein distance and Damerau–Levenshtein distanceGeneralization of Hamming distance that allows for different length strings, and (with Damerau) for transpositions and have a distance of 3.
  1. → (substitution of "s" for "k")
  2. → (substitution of "i" for "e")
  3. → (insertion of "g" at the end).
Jaro–Winkler distanceJaroWinklerDist("MARTHA","MARHTA") =

dj=

1\left(
3
m
|s1|

+

m
|s2|

+

m-t
m

\right)=

1\left(
3
6
6

+

6
6

+

6-2
2
6

\right)=0.944

m

is the number of matching characters;

t

is half the number of transpositions("MARTHA"[3]!=H, "MARHTA"[3]
=T).-Simple matching coefficient (SMC)
-
Jaccard similarity or Jaccard coefficient or Tanimoto coefficient
Most frequent k charactersMostFreqKeySimilarity('research', 'seeking', 2) = 2-Tversky index
-Overlap coefficient
-Variational distance
-Hellinger distance or Bhattacharyya distance
-Information radius (Jensen–Shannon divergence)
-Skew divergence
-Confusion probability
-Tau metric, an approximation of the Kullback–Leibler divergence
-Fellegi and Sunters metric (SFS)
-Maximal matches

External links

Notes and References

  1. Book: Lu , Jiaheng . Proceedings of the 2013 ACM SIGMOD International Conference on Management of Data . String similarity measures and joins with synonyms . etal . 2013 . 373–384 . https://dl.acm.org/citation.cfm?id=2465313. 10.1145/2463676.2465313 . 9781450320375 . 2091942 .
  2. Navarro . Gonzalo . A guided tour to approximate string matching . ACM Computing Surveys . 33 . 1 . 2001 . 31–88 . 10.1145/375360.375365. 10533/172862 . 207551224 . free .
  3. . Mohammad . Ghanayim . Alexander . Binun . Sergey . Frenkel . Yeali . S. Sun . Relationship of Jaccard and edit distance in malware clustering and online identification . 16th IEEE International Symposium on Network Computing and Applications . 2017 . 369–373.
  4. http://www.coli.uni-saarland.de/courses/LT1/2011/slides/stringmetrics.pdf Sam's String Metrics - Computational Linguistics and Phonetics
  5. Russell, David J., et al. "A grammar-based distance metric enables fast and accurate clustering of large sets of 16S sequences." BMC bioinformatics 11.1 (2010): 1-14.
  6. A Comparison of String Distance Metrics for Name-Matching Tasks.. 2003-08-01. 73–78. William. Cohen. Pradeep. Ravikumar. Stephen. Fienberg.