levenshtein: Levenshtein String Edit Distance

View source: R/levenshtein.R

levenshteinR Documentation

Levenshtein String Edit Distance

Description

Measure the Levenshtein edit distance between strings

Usage

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 bibiko@eva.mpg.de


robertdouglasmorrison/DuffyTools documentation built on March 24, 2024, 4:19 p.m.