在 hunspell 函数中使用 'ignore' 参数
Using 'ignore' argument in hunspell function
在 Rstudio 的文本块上 运行ning hunspell_check 时,我试图排除一些单词。
ignore_me <- c("Daniel")
hunspell_check(unlist(some_text), ignore = ignore_me, dict = dictionary("en_GB"))
然而,每当我 运行 我得到以下错误:
Error in hunspell_check(unlist(some_text, dict = dictionary("en_GB"), :
unused argument (ignore = ignore_me))
我环顾了 SO 并搜索了文档,但我正在努力找出哪里出了问题。
看起来您在 some_text
之后漏掉了一个右括号,因此它将 ignore
作为参数传递给 unlist()
而不是 hunspell_check()
。
更新:好的,我认为您正在查看旧版本的文档。至少那是我一开始所做的 (https://www.rdocumentation.org/packages/hunspell/versions/1.1/topics/hunspell_check)。在当前版本 2.9 中,ignore
不再是 hunspell_check()
的参数。相反,在对 dictionary()
:
的调用中使用 add_words
library(hunspell)
some_text <- list("hello", "there", "Daniell")
hunspell_check(unlist(some_text), dict = dictionary("en_GB"))
# [1] TRUE TRUE FALSE
ignore_me <- "Daniell"
hunspell_check(unlist(some_text), dict = dictionary("en_GB", add_words = ignore_me))
# [1] TRUE TRUE TRUE
在 Rstudio 的文本块上 运行ning hunspell_check 时,我试图排除一些单词。
ignore_me <- c("Daniel")
hunspell_check(unlist(some_text), ignore = ignore_me, dict = dictionary("en_GB"))
然而,每当我 运行 我得到以下错误:
Error in hunspell_check(unlist(some_text, dict = dictionary("en_GB"), :
unused argument (ignore = ignore_me))
我环顾了 SO 并搜索了文档,但我正在努力找出哪里出了问题。
看起来您在 some_text
之后漏掉了一个右括号,因此它将 ignore
作为参数传递给 unlist()
而不是 hunspell_check()
。
更新:好的,我认为您正在查看旧版本的文档。至少那是我一开始所做的 (https://www.rdocumentation.org/packages/hunspell/versions/1.1/topics/hunspell_check)。在当前版本 2.9 中,ignore
不再是 hunspell_check()
的参数。相反,在对 dictionary()
:
add_words
library(hunspell)
some_text <- list("hello", "there", "Daniell")
hunspell_check(unlist(some_text), dict = dictionary("en_GB"))
# [1] TRUE TRUE FALSE
ignore_me <- "Daniell"
hunspell_check(unlist(some_text), dict = dictionary("en_GB", add_words = ignore_me))
# [1] TRUE TRUE TRUE