levenshtein.distance: Compute Levenshtein distances

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/levenshtein.distance.R

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

1
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

1
2

Example output

Loading required package: stringdist
sh: 1: wc: Permission denied
sh: 1: cannot create /dev/null: Permission denied
Could not detect number of cores, defaulting to 1.
Loading required package: lattice
Loading required package: latticeExtra
Loading required package: RColorBrewer
             accourus                impies            louveteaux 
                    6                     8                     8 
    p<U+00E9>dalerons      pi<U+00E9>tinons             soupirait 
                    8                     7                     6 
             uniforme                  loco      remport<U+00E9>s 
                    8                     6                     8 
      po<U+00E9>tesse            orgasmique      d<U+00E9>clanche 
                    6                     9                     9 
             familier     amabilit<U+00E9>s empoussi<U+00E9>r<U+00E9> 
                    8                    10                     8 
         vid<U+00E9>o              steppers               sulfate 
                    7                     8                     7 
       <U+00E9>cartai               saluait 
                    6                     7 

vwr documentation built on May 2, 2019, 4:23 a.m.