lss: Levenshtein similarity (based on Levenshtein distance)

View source: R/lss.R

lssR Documentation

Levenshtein similarity (based on Levenshtein distance)

Description

Levenshtein similarity (based on Levenshtein distance)

Usage

lss(S1, S2, normalize = TRUE)

Arguments

S1

character of length 1 or longer, contains the sequence

S2

character of length 1 or longer, contains the sequence

normalize

logical, should the distance measure be normalized (by default: TRUE)

Details

we use the adist function, and normalize it according to 1-d(S1, S2) / max(S1l, S2l), where D is the adist function and S1l and S2l are the lengths of the two sequences

Value

numeric value of Levenshtein similarity

Examples

S1 <- "AAAABBAAAC"
S2 <- "ABAABBBAAA"
lss(S1, S2)
lss(S1, S1)
## Not run: 
RecordLinkage::levenshteinSim(S1, S2)

## End(Not run)
S3 <- "CBX"
lss(S1, S3)
lss(S2, S3)
# and with character vectors:
S1 <- c("one", "two", "three")
S2 <- c("eins", "two", "three")
lss(S1, S2)
lss("ABC", "DBC")

gobbios/cfp documentation built on April 11, 2022, 2:22 a.m.