Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > String Manipulation > Sequence Alignment & Comparison > Distance and Similarity Measures >
Mathematica > Data Manipulation > Numerical Data > Exploratory Data Analysis > Distance and Similarity Measures >
Mathematica > Data Manipulation > Statistics > Exploratory Data Analysis > Distance and Similarity Measures >

EditDistance

EditDistance[u, v]
gives the edit or Levenshtein distance between strings or vectors u and v.
  • EditDistance[u, v] gives the number of one-element deletions, insertions, and substitutions required to transform u to v.
Edit distance between two strings:
Edit distance between two vectors:
Edit distance between two strings:
In[1]:=
Click for copyable input
Out[1]=
 
Edit distance between two vectors:
In[1]:=
Click for copyable input
Out[1]=
Compute distance between strings of unequal length:
Compute distance between vectors of any length:
Obtain edit distance ignoring case of letters:
Cluster string data using edit distance:
Cluster numeric data using edit distance:
EditDistance is less than or equal to HammingDistance for strings of equal length:
EditDistance is less than or equal to HammingDistance for vectors of equal length:
New in 6
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team