问题
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)
but hunspell("bing")
still determine "bing" is incorrect.
Anyone have experience with this before? Thanks.
回答1:
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)
来源:https://stackoverflow.com/questions/56043887/problem-with-adding-custom-words-to-hunspell-dictionary-in-r