levenshtein: Levenshtein String Edit Distance

Description Usage Arguments Value References

View source: R/levenshtein.R View source: R/Levenshtein.R

Description

Measure the Levenshtein edit distance between strings

Usage

1
2
3
4
5
6
7
levenshtein(string1, string2, case = TRUE, damerau = FALSE, map = NULL, 
	    motif = FALSE, fastMode = TRUE)

levenshteinDistanceMatrix(stringVector, case = TRUE, damerau = FALSE, 
	   map = NULL, motif = FALSE, diagonalValue = 0, verbose = TRUE)

fastLeven.C( string1, string2)

Arguments

string1, string2

character strings to measure edit distance between

stringVector

character vector to measure all pairwise edit distances of

case

be case sensitive

damerau

Demerau enhancement, swap of adjacent letters costs 1 instead of 2

map

character vector of regular expression modifiers

motif

when true, a single letter replacement costs 2, as a 'remove then insert'

diagonalValue

a numeric value to be assigned for a string's distance to itself

verbose

when true, print a small message to show progress to std out

Value

For levenshtein, a numeric scalar that is the number of character edits needed to turn string1 into string2.

For levenshteinDistanceMatrix, a square symmetric numeric matrix of size N = length(stringVector), where each element is the number of character edits between the corresponding 2 strings of stringVector, with explicit diagonal elements set to value diagonalValue.

For levenshtein, a numeric scalar that is the number of character edits needed to turn string1 into string2. This is a faster re-write in C.

References

Written by: Hans-Joerg Bibiko [email protected]


robertdouglasmorrison/DuffyTools documentation built on Dec. 7, 2018, 8:02 a.m.