[R] MiscPsycho - incorrect levenshtein distance?
Ben Meijering
b.meijering at ai.rug.nl
Wed Apr 14 12:08:31 CEST 2010
For some strings I get a wrong (MiscPsycho) Levenstein distance:
> stringMatch("abc", "ab", normalize="NO")
[1] 1
> stringMatch("abc", "bc", normalize="NO")
[1] 2
I think the lines
d <- matrix(0, nrow = n + 1, ncol = m + 1)
d[, 1] <- 1:(n + 1)
d[1, ] <- 1:(m + 1)
d[1, 1] <- 0
should be changed to
d <- matrix(0, nrow = n + 1, ncol = m + 1)
d[, 1] <- 0:n
d[1, ] <- 0:m
More information about the R-help
mailing list