How can i do Levenshtein distance measurement on word (not character) Level in R?
See the following:
Expected result 1)
# levenshtein operations needed: Delete*2 --> 2 operations
array1 <- c("word", "car")
array2 <- c("word", "pool", "beer", "car")
I am seeking a function levenshtein()
, so that the distance of 2 is returned for the example above:
levenshtein(array1, array2)
--> 2
Expected result 2)
# levenshtein operations needed: Delete and insert --> 2 operations
array1 <- c("word", "car", "pool")
array2 <- c("word", "pool", "car")
I am seeking a function levenshtein()
, so that the distance of 2 is returned for the example above:
levenshtein(array1, array2)
--> 2
I found the following: Word-level edit distance of a sentence But i didnt find a working needleman-wunsch implentation that yields the expected results, described above.