})
testthat::test_that("the method takes as input a numeric value", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_true( init$Asciidammit(input = numeric(0)) == "[]" )
})
testthat::test_that("the method takes as input a numeric value", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_true( init$Asciidammit(input = NULL) == "None" )
})
st1
UTILS$asciionly(st1)
UTILS$asciionly(1233)
UTILS$asciionly(list(123))
source('~/ADD_GITHUB/fuzzywuzzyR/R/fuzzy_w.R')
testthat::test_that("input is non-NULL", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_error( init$Asciionly(string = NULL) )
})
testthat::test_that("input is character string", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_error( init$Asciionly(string = 1) )
})
init$Asciionly(string = st1)
UTILS$validate_string(1)
UTILS$validate_string("a")
UTILS$validate_string(list("a"))
UTILS$validate_string(list("a", 'b'))
UTILS$validate_string(list("a", 'b', 1))
testthat::test_that("input is non-NULL", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_error( init$Validate_string(string = NULL) )
})
testthat::test_that("input is character string", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_error( init$Validate_string(string = 1) )
})
testthat::test_that("the method returns the expected output", {
skip_test_if_no_module("fuzzywuzzy.utils")
init = FuzzUtils$new()
testthat::expect_true( init$Validate_string(string = st1) == TRUE )
})
init$Validate_string(string = character(0))
init = FuzzExtract$new()
init$Extract(string = NULL, processor = NULL, scorer = NULL, limit = 5L)
init$Extract(string = word, sequence_strings = NULL, processor = NULL, scorer = NULL, limit = 5L)
init$Extract(string = 1, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L)
init$Extract(string = word, sequence_strings = 1, processor = NULL, scorer = NULL, limit = 5L)
testthat::test_that("the string argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$Extract(string = NULL, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the sequence_strings argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$Extract(string = word, sequence_strings = NULL, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the string argument is a character string", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$Extract(string = 1, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the sequence_strings argument is a character vector", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$Extract(string = word, sequence_strings = 1, processor = NULL, scorer = NULL, limit = 5L) )
})
s1 = ' It was a dark and stormy night. I was all alone sitting on a red chair.'
s2 = ' It was a murky and stormy night. I was all alone sitting on a crimson chair.'
word = 'Fra Bagg'
vec_getclose = c('Frodo Baggins', 'Tom Sawyer', 'Bilbo Baggin')
st1 = "Atlanta Falcons"
st2 = "New York Jets"
tmp_init = FuzzMatcher$new()
tmp_sc = tmp_init$WRATIO defaults to 'FuzzMatcher.WRATIO()'
EXTRACT$extract(word, vec_getclose, NULL, tmp_sc, 5L)
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
init$Extract(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR, limit = 5L)
source('~/ADD_GITHUB/fuzzywuzzyR/R/fuzzy_w.R')
init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR, limit = 5L)
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR, limit = 5L)
init$Extract(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR, limit = 5L)
testthat::test_that("the processor argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$Extract(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR, limit = 5L) )
})
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = list(), limit = 5L)
testthat::test_that("the scorer argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = list(), limit = 5L) )
})
init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = '5L')
testthat::test_that("the limit argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = '5L') )
})
init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L)
res_lst = init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L)
unlist(lapply(res_lst, function(x) x[[1]]))
unlist(lapply(res_lst, function(x) x[[2]]))
inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('numeric', 'vector'))
class(unlist(lapply(res_lst, function(x) x[[2]])))
inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector'))
inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector'))
testthat::test_that("returns the expected output if scorer is NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L)
testthat::expect_true( inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector')) && inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector')) )
})
testthat::test_that("returns the expected output if scorer is not NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$Extract(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR, limit = 5L)
testthat::expect_true( inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector')) && inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector')) )
})
testthat::test_that("the string argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractBests(string = NULL, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the sequence_strings argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = NULL, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the string argument is a character string", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractBests(string = 1, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the sequence_strings argument is a character vector", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = 1, processor = NULL, scorer = NULL, limit = 5L) )
})
testthat::test_that("the processor argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR, limit = 5L) )
})
testthat::test_that("the scorer argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = list(), limit = 5L) )
})
init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, score_cutoff = '0L', limit = 5L)
testthat::test_that("the score_cutoff argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, score_cutoff = '0L', limit = 5L) )
})
testthat::test_that("the limit argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = '5L') )
})
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 5L)
res_lst
res_lst = init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 1L)
res_lst
testthat::test_that("returns the expected output if scorer is NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, limit = 1L)
testthat::expect_true( res_lst[[1]][[1]] == "Frodo Baggins" && res_lst[[1]][[2]] == 67 )
})
testthat::test_that("returns the expected output if scorer is not NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractBests(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR, limit = 5L)
testthat::expect_true( res_lst[[1]][[1]] == "Frodo Baggins" && res_lst[[1]][[2]] == 67 )
})
testthat::test_that("the string argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractWithoutOrder(string = NULL, processor = NULL, scorer = NULL) )
})
testthat::test_that("the sequence_strings argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractWithoutOrder(string = word, sequence_strings = NULL, processor = NULL, scorer = NULL) )
})
testthat::test_that("the string argument is a character string", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractWithoutOrder(string = 1, sequence_strings = vec_getclose, processor = NULL, scorer = NULL) )
})
testthat::test_that("the sequence_strings argument is a character vector", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractWithoutOrder(string = word, sequence_strings = 1, processor = NULL, scorer = NULL) )
})
testthat::test_that("the processor argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR) )
})
testthat::test_that("the scorer argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = list()) )
})
testthat::test_that("the score_cutoff argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, score_cutoff = '0L') )
})
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
res_lst
inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector')) && inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector'))
testthat::test_that("returns the expected output if scorer is NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
testthat::expect_true( inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector')) && inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector')) )
})
testthat::test_that("returns the expected output if scorer is not NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractWithoutOrder(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR)
testthat::expect_true( inherits(unlist(lapply(res_lst, function(x) x[[1]])), c('character', 'vector')) && inherits(unlist(lapply(res_lst, function(x) x[[2]])), c('integer', 'vector')) )
})
testthat::test_that("the string argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractOne(string = NULL, processor = NULL, scorer = NULL) )
})
testthat::test_that("the sequence_strings argument is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractOne(string = word, sequence_strings = NULL, processor = NULL, scorer = NULL) )
})
testthat::test_that("the string argument is a character string", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractOne(string = 1, sequence_strings = vec_getclose, processor = NULL, scorer = NULL) )
})
testthat::test_that("the sequence_strings argument is a character vector", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$ExtractOne(string = word, sequence_strings = 1, processor = NULL, scorer = NULL) )
})
testthat::test_that("the processor argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = list(), scorer = SCOR) )
})
testthat::test_that("the scorer argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = list()) )
})
testthat::test_that("the score_cutoff argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL, score_cutoff = '0L') )
})
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
res_lst
testthat::test_that("returns the expected output if scorer is NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
testthat::expect_true( res_lst[[1]][[1]] == "Frodo Baggins" && res_lst[[1]][[2]] == 67 )
})
testthat::test_that("returns the expected output if scorer is not NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR)
testthat::expect_true( res_lst[[1]][[1]] == "Frodo Baggins" && res_lst[[1]][[2]] == 67)
})
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
res_lst
res_lst[[1]] == "Frodo Baggins" && res_lst[[1]] == 67
res_lst
res_lst[[1]]
res_lst[[1]] == "Frodo Baggins"
testthat::test_that("returns the expected output if scorer is NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = NULL)
testthat::expect_true( res_lst[[1]] == "Frodo Baggins" && res_lst[[2]] == 67 )
})
testthat::test_that("returns the expected output if scorer is not NULL - processor takes default function", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
res_lst = init$ExtractOne(string = word, sequence_strings = vec_getclose, processor = NULL, scorer = SCOR)
testthat::expect_true( res_lst[[1]] == "Frodo Baggins" && res_lst[[2]] == 67)
})
init = FuzzExtract$new()
init$Dedupe(contains_dupes = NULL, threshold = 70L, scorer = NULL)
init$Dedupe(contains_dupes = 1, threshold = 70L, scorer = NULL)
vec_getclose
init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = list())
testthat::test_that("the scorer argument is a function in case that is not NULL", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
init_scor = FuzzMatcher$new()
SCOR = init_scor$WRATIO
testthat::expect_error( init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = list()) )
})
init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = '70L', scorer = NULL)
testthat::test_that("the threshold argument is a numeric value", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_error( init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = '70L', scorer = NULL) )
})
init = FuzzExtract$new()
init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL)
testthat::test_that("it returns the expected output", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_output( init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL) )
})
a = init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL)
a
str(a)
reticulate::py_str(a)
reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL)) == "dict_keys(['Frodo Baggins', 'Tom Sawyer', 'Bilbo Baggin'])"
testthat::test_that("it returns the expected output", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
testthat::expect_true( reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL)) == "dict_keys(['Frodo Baggins', 'Tom Sawyer', 'Bilbo Baggin'])" )
})
reticulate::py_to_r(a)
devtools::document(pkg = '/home/lampros/ADD_GITHUB/fuzzywuzzyR')
setwd('/home/lampros/ADD_GITHUB/')
system("R CMD build fuzzywuzzyR")
system("R CMD check --as-cran fuzzywuzzyR_0.1.0.tar.gz")
FUZZ <<- reticulate::import("fuzzywuzzy.fuzz", delay_load = TRUE) delay load foo module ( will only be loaded when accessed via $ )
DIFFLIB <<- reticulate::import("difflib", delay_load = TRUE)
EXTRACT <<- reticulate::import("fuzzywuzzy.process", delay_load = TRUE)
UTILS <<- reticulate::import("fuzzywuzzy.utils", delay_load = TRUE)
source('~/ADD_GITHUB/fuzzywuzzyR/R/fuzzy_w.R')
init = FuzzExtract$new()
reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL))
s1 = ' It was a dark and stormy night. I was all alone sitting on a red chair.'
s2 = ' It was a murky and stormy night. I was all alone sitting on a crimson chair.'
word = 'Fra Bagg'
vec_getclose = c('Frodo Baggins', 'Tom Sawyer', 'Bilbo Baggin')
st1 = "Atlanta Falcons"
st2 = "New York Jets"
reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL))
is.character(res_str)
res_str = reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL))
is.character(res_str)
length(res_str) > 0
testthat::test_that("it returns the expected output", {
skip_test_if_no_module("fuzzywuzzy.process")
init = FuzzExtract$new()
res_str = reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL))
testthat::expect_true( is.character(res_str) && length(res_str) > 0 )
})
init = FuzzExtract$new()
res_str = reticulate::py_str(init$Dedupe(contains_dupes = c(vec_getclose, "Bilbo Baggin"), threshold = 70L, scorer = NULL))
is.character(res_str) && length(res_str) > 0
setwd('/home/lampros/ADD_GITHUB/')
system("R CMD build fuzzywuzzyR")
system("R CMD check --as-cran fuzzywuzzyR_0.1.0.tar.gz")
system("R CMD INSTALL fuzzywuzzyR_0.1.0.tar.gz")
covr::shine(covr::package_coverage(path = '/home/lampros/ADD_GITHUB/fuzzywuzzyR', type = "tests", quiet = F))
install.packages("DT")
covr::shine(covr::package_coverage(path = '/home/lampros/ADD_GITHUB/fuzzywuzzyR', type = "tests", quiet = F))
covr::shine(covr::package_coverage(path = '/home/lampros/ADD_GITHUB/fuzzywuzzyR', type = "tests", quiet = F))
covr::package_coverage(path = '/home/lampros/Desktop/kaggle_gpu/add_GITHUB/textTinyR', type = "tests", quiet = F)
covr::package_coverage(path = '/home/lampros/ADD_GITHUB/fuzzywuzzyR', type = "tests", quiet = F)
system("R CMD INSTALL fuzzywuzzyR_0.1.0.tar.gz")
setwd('/home/lampros/ADD_GITHUB/')
system("R CMD INSTALL fuzzywuzzyR_0.1.0.tar.gz")
setwd('/home/lampros/Desktop/kaggle_gpu/add_GITHUB/')
system("R CMD build fuzzywuzzyR")
system("R CMD check --as-cran fuzzywuzzyR_1.0.0.tar.gz")
setwd('/home/lampros/Desktop/kaggle_gpu/add_GITHUB/')
system("R CMD build fuzzywuzzyR")
system("R CMD check --as-cran --use-valgrind fuzzywuzzyR_1.0.1.tar.gz")
word = "安广"
choices = c("安徽","安广")
init_proc = fuzzywuzzyR::FuzzUtils$new() initialization of FuzzUtils class to choose a processor
remove_special_chars = paste0(word, "%&$!")
PROC = init_proc$Full_process(string = remove_special_chars, decoding = 'utf-8') processor-method
PROC
remove_special_chars
init_scor = fuzzywuzzyR::FuzzMatcher$new(decoding = 'utf-8') 'utf-8' decoding applies to all methods of the 'FuzzMatcher' class
SCOR = init_scor$WRATIO choosen scorer function
init <- fuzzywuzzyR::FuzzExtract$new(decoding = 'utf-8') 'utf-8' decoding applies to all methods of the 'FuzzExtract' class
fzextr = init$Extract(string = word, sequence_strings = choices, scorer = SCOR)
fzextr