本文介绍了在R中的hunspell词典中添加自定义单词的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够弄清楚如何在R中的hunspell词典中添加自定义单词.但是,我不确定为什么它不用于拼写检查.这是我用的:

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. 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)

但是hunspell("bing")仍然确定"bing"不正确.

but hunspell("bing") still determine "bing" is incorrect.

任何人都曾经有过这种经历吗?谢谢.

Anyone have experience with this before? Thanks.

推荐答案

dictionary()函数返回可以使用的新字典.它不会更改默认行为或任何其他内容.你可以做

The dictionary() function returns a new dictionary that you can use. 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)

这篇关于在R中的hunspell词典中添加自定义单词的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 04:15