简体   繁体   English

R中包'qdap'中的自定义单词

[英]Custom words in Package 'qdap' in R

I am using the qdap package in R to do a spell check. 我在R中使用qdap包进行拼写检查。 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 ? 这些词语是有意义的,但对这些词语的更正是无关紧要的。有没有选项可以让我们的自定义单词列表为此功能不过滤?

The function which_misspelled() contains the argument dictionary = which defaults to qdapDictionaries::GradyAugmented . 函数which_misspelled()包含参数dictionary = ,默认为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 : 如果您想要将单词"gb"识别为正确的拼写,您应该定义一个新的dictionary

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM