Last data update: 2014.03.03

R: Compute Levenshtein distances
levenshtein.distanceR Documentation

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.

Details

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

Value

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

Author(s)

Emmanuel Keuleers

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

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

Results