Matches of character strings
GetCloseMatches(string = NULL, sequence_strings = NULL, n = 3L, cutoff = 0.6)
a character string.
a vector of character strings.
an integer value specifying the maximum number of close matches to return; n must be greater than 0.
a float number in the range [0, 1], sequence_strings that don't score at least that similar to string are ignored.
Returns a list of the best "good enough" matches. string is a sequence for which close matches are desired (typically a string), and sequence_strings is a list of sequences against which to match string (typically a list of strings).
https://www.npmjs.com/package/difflib, http://stackoverflow.com/questions/10383044/fuzzy-string-comparison
try({
if (reticulate::py_available(initialize = FALSE)) {
if (check_availability()) {
library(fuzzywuzzyR)
vec = c('Frodo Baggins', 'Tom Sawyer', 'Bilbo Baggin')
str1 = 'Fra Bagg'
GetCloseMatches(string = str1, sequence_strings = vec, n = 2L, cutoff = 0.6)
}
}
}, silent=TRUE)