Learn R Programming

deducorrect (version 1.3.7)

damerauLevenshteinDistance: Calculate the Damerau Levenshtein Distance between two strings

Description

The restricted Damerau Levenshtein Distance between two strings is commonly used for checking typographical errors in strings. It takes the deletion and insertion of a character, a wrong character (substition) or the swapping (transposition) of two characters into account. By default these operations each account for distance 1.

Usage

damerauLevenshteinDistance(sa, sb, w = c(1, 1, 1, 1))

Arguments

sa
character vector
sb
character vector of equal length(sa)
w
integer vector for cost of deletion, insertion, substitution and transposition.

Value

integer vector with pairwise edit distances

References

Damerau F (1964). A technique for computer detection and correction of spelling errors. Communications of the ACM, 7,issue 3

Levenshtein VI (1966). Binary codes capable of correcting deletions, insertions, and reversals. Soviet Physics Doklady 10: 707-10 Damerau Levenshtein Distance calculates the difference between two strings used for typographical errors (typo's)