I’m interested in learning more about programmatically loading a list of words to be ignored as spelling mistakes. I have read that LanguageTool already supports the use of the ‘ignore.txt’ file to load a list of ignored words into a JLanguageTool instance during construction. However, I’m trying to find a way to support a different set of ignored words for every request.
My situation is something like this: I’m using multiple instances of JLanguageTool in a micro-service architecture to accept and correct text as a proofreading service for our larger client-side text editor web application. I want to support many unique users where each unique user can have his or her own list of ignored words. I already have a plan for persisting this data. However, the last piece of the puzzle I want to figure out is how to programmatically load the list of ignored words for a user when a request comes in from that user. It would look something like this…
User A sends text through to my service to be checked.
I programmatically load User A’s ignored words into JLanguageTool.
I check the text with JLanguageTool.
I programmatically unload these ignored words from JLanguageTool.
User B sends text through to my service to be checked.
I programmatically load User B’s ignored words into JLanguageTool.
I check the text with JLanguageTool.
I programmatically unload these ignored words from JLanguageTool.
Is there a way to support this programmatic loading and unloading of ignored words without having to construct a new JLanguageTool instance each time? If not, does language tool support this “multi-user concurrent usage” with regards to user-specific ignored words? If JLanguageTool doesn’t support this “pre-process” loading of ignored words I might have to filter the results returned through the ignored word list in a “post-process” which seems less ideal. Any help would be greatly appreciated; thank you in advance!
Update: It looks like it’s possible to iterate over all the spelling rules and add ignore tokens to each. This may accomplish half of what I’m looking for. However, there does not appear to be a way to remove ignore tokens. Does the class SpellingCheckRule contain something similar to a ‘removeIgnoreTokens()’?