【发布时间】:2018-10-14 13:31:30
【问题描述】:
当我在 hunspell 中选择不同的字典时,我观察到了奇怪的行为。我希望用澳大利亚英语对我的文本进行拼写检查。但是当我选择“en_AU”字典时,我会收到其他没有意义的拼写错误。
> require(hunspell)
> hunspell("Couldn't be more delighted." , dict = "en_AU", ignore = dic_ignore)
[[1]]
[1] "Couldn"
> hunspell("Couldn't be more delighted." , dict = "en_US", ignore = dic_ignore)
[[1]]
character(0)
我不明白为什么 en_AU 字典会这样。
如何组合这两个字典? 我尝试将它们组合起来不起作用:
#this doesn't work
> reviews <- reviews[, possible_errors_2 := hunspell(review_parsed, dict = c("en_US", "en_AU"), ignore = dic_ignore)]
Warning message:
In if (!file.exists(dict)) { :
the condition has length > 1 and only the first element will be used
编辑:我想这涉及到两个嵌套问题:1)为什么第一个字典不能正常工作? “不能”在澳大利亚英语中有效 <: r>
【问题讨论】:
-
您的组合示例有错字,应该是
dict = c("en_AU", "en_US")。我还没有投票关闭,因为修复错字似乎确实使它起作用,但也给出了一个警告,表明你不应该将多个字典传递给函数 - 不确定向量是否传递给dict应该工作。 -
这很愚蠢。我会编辑
标签: r dictionary hunspell spelling