computes the Levenshtein edit distance between the two strings. string1 and string2. This operation is symmetrical. The optional argument weights specifies weights for the deletion, matched, and insertion operations; by default it is set to +1, 0, +1 respectively, so that a least editdistance means a closer match between the two strings. This function implements the Levenshtein edit distance as presented in Wikipedia article, accessed Nov 2006. Also the levenshtein edit distance of a string with an empty string is defined to be its length.
The default return value is dist the edit distance, and the other return value L is the distance matrix.
editdistance('marry','marie') returns value +2 for the distance.