String metric
In mathematics and computer science, a string metric (also known as a string similarity metric or string distance function) is a metric that measures similarity or dissimilarity (distance) between two text strings for approximate string matching or comparison and in fuzzy string searching. For example the strings "Sam" and "Samuel" can be considered to be similar. A string metric provides a number indicating an algorithm-specific indication of similarity.
The most widely known string metric is a rudimentary one called the Levenshtein Distance (also known as Edit Distance). It operates between two input strings, returning a score 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.
A widespread example of a string metric is DNA sequence analysis and RNA analysis, which are performed by optimised string metrics to identify matching sequences.
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, Web interfaces, e.g. Ajax-style suggestions as you type, data integration, and semantic knowledge integration.
List of string metrics
- Hamming distance
- Levenshtein distance and Damerau–Levenshtein distance
- Needleman–Wunsch distance or Sellers' algorithm
- Smith–Waterman distance
- Gotoh distance or Smith-Waterman-Gotoh distance
- Block distance or L1 distance or City block distance
- Jaro–Winkler distance
- Soundex distance metric
- Simple matching coefficient (SMC)
- Dice's coefficient
- Jaccard similarity or Jaccard coefficient or Tanimoto coefficient
- Tversky index
- Overlap coefficient
- Euclidean distance or L2 distance
- Cosine similarity
- Variational distance
- Hellinger distance or Bhattacharyya distance
- Information radius (Jensen–Shannon divergence)
- Harmonic mean
- Skew divergence
- Confusion probability
- Tau metric, an approximation of the Kullback–Leibler divergence
- Fellegi and Sunters metric (SFS)
- TFIDF or TF/IDF
- Maximal matches
- Lee distance
See also
- approximate string matching
- String matching
- Carnegie Mellon University open source library
- StringMetric project a Scala library of string metrics and phonetic algorithms
- Natural project a JavaScript natural language processing library which includes implementations of popular string metrics
External links
- http://www.dcs.shef.ac.uk/~sam/stringmetrics.html [dead link] A fairly complete overview Archived (Date missing) at dcs.shef.ac.uk (Error: unknown archive URL)