Learn R Programming

vwr (version 0.3.0)

levenshtein.distance: Compute Levenshtein distances

Description

Compute the Levenshtein distance between two character strings (the minimal number of insertions, deletions or replacements required to transform one string into the other)

Usage

levenshtein.distance(xsource, targets)

Arguments

xsource
A character string to compute the Levenshtein distance from.
targets
A list of words to compute the Levenshtein distance to. Must be of type character, or convertible to type character with as.character.

Value

An integer vector containing Levenshtein distances, with names corresponding to targets.

Details

The distance computation is performed by stringdist with method="lv".

References

Levenshtein, V. I. (1966, February). Binary codes capable of correcting deletions, insertions and reversals. In Soviet physics doklady (Vol. 10, p. 707).

See Also

levenshtein.neighbors,stringdist, ald, levenshtein.damerau.distance

Examples

Run this code
data(french.words)
levenshtein.distance('pourquoi',sample(french.words,20))

Run the code above in your browser using DataLab