I’d like the users of my application to add words to the Dutch vocabulary at run-time through an HTTP post request to LT Server. Implementing adding to the ignored wordlist was pretty easy, but adding to the vocabulary (so I can provide replacement suggestions) is giving me headaches.
As a proof-of-concept I’ve hacked my way around the LanguageTool codebase to get this to work. I’ve noticed that the vocabulary is compiled into a binary format from the spelling.txt file that’s included in the language module for Dutch.
I’ve replaced loading spelling.txt from the resource path with a regular file on my local filesystem and I’ve added a call to LanguageToolHttpHandler that allows me to update this file. (I know this is hacky, but it seemed like an easy way to verify this idea.) While LT is able to load and use the wordlist this way, new words that are added to it using the added call to LanguageToolHttpHandler are not picked up. That is, LT does loop over the updated list, but it seems to ignore the new words.
I’ve checked whether there is some kind of caching involved that keeps me from getting the desired behavior. I’ve removed the cache in CachingWordListLoader, and simply force reloading from the filesystem on each call to loadWordsFromPath(). I’ve also disabled JLanguageTool’s internal ResultCache and the LoadingCache named dictCache in MorfologikMultiSpeller, but I’m still not getting the desired behavior.
I think LT is written in a way that doesn’t allow this because of performance implication. However, if we assume that performance isn’t an issue for me, I would be very happy to get some pointers that would help me getting this implemented. Thanks!