Back to LanguageTool Homepage - Privacy - Imprint

Adding words to spelling.txt in a Grails project

(Maxim Isakov) #1

Hey Daniel,

I am able to use the LanguageTool Java API just fine in my grails project, however the use case for the grammar checker is in a specific professional field with many words that I must add to the existing dictionary. On the Improving Spell Checking section of your website it says to add words to spelling.txt but since LanguageTool is a dependency in my project I cannot edit spelling.txt

Is there a way to programmatically edit spelling.txt through the API, or add words to the list of correct words or to the dictionary?


(Daniel Naber) #2

You can use addIgnoreTokens() to keep words from being checked. For that, you need to iterate all rules (getAllActiveRules()) to find the spelling rule first.

(Maxim Isakov) #3

I would like to be able to get spelling suggestions for the words I am adding. How can I accomplish this?

(Daniel Naber) #4

I don’t think this is possible. We build a binary dictionary on-the-fly when starting LT, and it takes its words from the standard dictionary (already in Morfologik binary format) and from the plain text file. But that happens only on start-up.