简体   繁体   English

在R中的hunspell词典中添加自定义单词的问题

[英]Problem with adding custom words to hunspell dictionary in R

I was able to figure out how to add custom words into the hunspell dictionary in R. However, I'm not sure why it's not being used in spell checking. 我能够弄清楚如何在R的hunspell词典中添加自定义单词。但是,我不确定为什么不将其用于拼写检查。 Here is what I used: 这是我使用的:

library(hunspell)
#adding custom words into hunspell dictionary
hunspell::dictionary(lang = "en_US", affix = NULL, add_words = "bing", cache = TRUE)

but hunspell("bing") still determine "bing" is incorrect. 但是hunspell("bing")仍然确定“ bing”不正确。

Anyone have experience with this before? 有人对此有经验吗? Thanks. 谢谢。

The dictionary() function returns a new dictionary that you can use. dictionary()函数返回一个可以使用的新字典。 It doesn't change the default behavior or anything. 它不会更改默认行为或任何其他内容。 You can do 你可以做

library(hunspell)
mydict <- dictionary(lang = "en_US", affix = NULL, add_words = "bing", cache = TRUE)
hunspell("bing", dict=mydict)

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

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