Ashwii Ashwii - 6 days ago 6
R Question

Custom words in Package 'qdap' in R

I am using the qdap package in R to do a spell check. I run the below code and gives an output like this

which_misspelled("I use a 50Gb broadband connection")

> 4 5
>"gb" "broadband"


The words make sense but the corrections for these are irrelevant.Is there any option where we could give our custom words list for this function to not filter on ?

Answer

The function which_misspelled() function contains the argument dictionary = which defaults to qdapDictionaries::GradyAugmented. If your input of words isn't present in there, it will be considered misspelled.

If you want for example the word "gb" to be recognized as correct spelling, you should define a new dictionary :

library(qdap)
dict <- c(qdapDictionaries::GradyAugmented, "gb")
which_misspelled("I use a 50Gb broadband connection", dictionary = dict)
#          5 
#"broadband" 
Comments