String metric

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

Template:Short description Script error: No such module "redirect hatnote".

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

Name Description Example
Hamming distance Only for strings of the same length. Number of changed characters. "Template:Mono" and "Template:Mono" is 3.
Levenshtein distance and Damerau–Levenshtein distance Generalization of Hamming distance that allows for different length strings, and (with Damerau) for transpositions Template:Mono and Template:Mono have a distance of 3.
  1. Template:MonoTemplate:Mono (substitution of "s" for "k")
  2. Template:MonoTemplate:Mono (substitution of "i" for "e")
  3. Template:MonoTemplate:Mono (insertion of "g" at the end).
Jaro–Winkler distance JaroWinklerDist("MARTHA","MARHTA") =
dj=13(m|s1|+m|s2|+mtm)=13(66+66+6226)=0.944
  • m is the number of matching characters;
  • t is half the number of transpositions("MARTHA"[3]!=H, "MARHTA"[3]!=T).
Most frequent k characters MostFreqKeySimilarity('research', 'seeking', 2) = 2

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "Citation/CS1".
  3. Script error: No such module "Citation/CS1".
  4. a b c d e 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. Script error: No such module "Citation/CS1".

Script error: No such module "Check for unknown parameters".

External links

Template:Strings