Back to LanguageTool Homepage - Privacy - Imprint

Add new words to the dictionary and ignore list at runtime

(vers) #1


I’m writing a text editor that uses LanguageTool as library. I’d like to give the user the possibility of adding words to the dictionary and to the ignore list (right click -> “Add word to the dictionary” or “Ignore this word”). These new words should also be available as suggestions. Is there a way to do this at runtime?

After taking a look at the LanguageTool API, I’ve found the method addWord(String) in the class org.languagetool.rules.spelling.hunspell.Hunspell.Dictionary. Is this the right way to add new words? How do I access the runtime dictionary? Is somehow referenced by JLanguageTool?

Thanks in advance.

(Daniel Naber) #2

I’ve documented this now at, but I think the words will not be used as suggestions. The addWord() method in org.languagetool.rules.spelling.hunspell.Hunspell.Dictionary might be the right method for some, but not for all languages. Also, it’s not accessible from outside or maybe it is somehow, but I wouldn’t recommend using it, it’s supposed to be internal.

(vers) #3

That works! The users will now be able to decide if they want to ignore certain words. Thanks a lot

Is there any other way of adding new words to the dictionary at runtime that doesn’t involve using the addWord() method in org.languagetool.rules.spelling.hunspell.Hunspell.Dictionary and so that the new words are also used as suggestions? Initially the only two languages that would need to be supported are English and German.

(Daniel Naber) #4

Using the words also as suggestions is not yet supported at runtime. I see this makes sense, but I’m busy with other issues, so patches would be welcome.

(vers) #5

Oki doki. I’ll see what I can do.