R Fuzzy Wuzzy Error Message "attempt to apply non-function"

Hello,

STILL working on getting my R Jeopardy Quiz app up and running smoothly, on my last step, which is incorporating a string matching FuzzyWuzzy capability that can allow for approximate user answers and quiz answers (eg if the answer is "Nixon" and someone enters "Naxon" it's still marked as correct. Here is the code I have

library(fuzzywuzzyR)


    
setwd('C:\\Users\\taylo\\OneDrive\\Documents\\JeopardyQuiz\\data')

jeop3column <- read.csv(file = "jeop3column2.csv")
dim(jeop3column) 
summary(jeop3column)
colnames(jeop3column)

single_cat<- sample(unique(as.character(jeop3column$category)), 1)
single_cat

validate_cat <- function (cat){
    if (nrow(jeop3column[jeop3column$category == cat,]) >= 5){
        return(cat)
    }
    else{
        new_cat <- sample(unique(as.character(jeop3column$category)), 1)
        validate_cat(new_cat)
    }
}

single_cat <- validate_cat(single_cat)
single_cat_df <- jeop3column[jeop3column$category == single_cat, ]
single_cat_df_5 <- single_cat_df[sample(nrow(single_cat_df), 5), ]
single_cat_gen <<- single_cat_df_5 

single_cat_gen
single_cat_gen$answer[1]
single_cat_gen$question[1]



s1 <- "LASIK"
s2 <- "LASIK"


         
init = FuzzMatcher$new()
init$Partial_token_set_ratio(string1 = s1, string2 = s2, force_ascii = TRUE, full_process = TRUE)

I tried to run a Reprex but couldn't figure it out, so the code above is everything I have.

I get this error message when I try and initialize the FuzzMatch$new and then run the Partial_token_set_ratio that SHOULD compare the strings and give me a ratio number...

"Error in init$Partial_token_set_ratio(string1 = s1, string2 = s2, force_ascii = TRUE, :
attempt to apply non-function"

I have Googled the issue and couldn't come up with an answer, I did find this which seems like it could be the same issue, but I was unable to run reticulate and get the check_availability() to equal TRUE.

Anyone have any advice of how I can get rid of the "attempt to apply non-function" error message and get FuzzyWuzzy to work?

Thanks!

-Taylor

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.