vim-language tool add `ignore` terms

Hi, forum members,

I’m facing a similar issue as describe by @Amir here.

But this one seems to me more vim oriented and not general. So…

Here is my question, I got a lot of domains specific terms in my text. As there are so much of them it’s becoming impossible for me to do the proof-reading with LanguageTool.

I’m a vim-languagetool user. In vim, one can use zg to add current “incorrect” word to a kind of ignore file in ~/.vim/spell/en.utf-8-add, in my case.

I see in LanguageTool-4.x/org/languagetool/resource/en/hunspell/spelling.txt we can add kind of “to ignore” things. My current solution is to use :read ~/.vim/spell/en.utf-8-add to append these “to ignore” terms to spelling.txt. As you can see, this is not the trivial solution.

Does someone have an idea of how to communicate these two file? Or can LanguageTool take an extra file for spell checking?

Thanks!

Tong

You could put your technical terms in an external file: Tips and Tricks - LanguageTool Wiki

For each term, write a disambiguation rule to ignore spelling (<disambig action="ignore_spelling">). For examples, look in the English disambiguation.xml file.

Hi, @Mike_Unwalla Thank you for your fast reply!
It’s cool to have this user defined rule accepted. I didn’t know that.
But if I understand correctly. I still have to convert my plain “to ignore” text file (as the spelling.txt or ignore.txt) to a .xml ?

In that case, a simple append would not do the job. I have to put a trigger on my vim ignore.txt, once modification detected. Generate a new ignore.xml for Language Tool…

Can’t Language Tool accept an extra plain text ignore.txt? So that I can directly point it to my native vim ignore file.

I don’t know (I am a rule editor, not a developer). Possibly, one of the LT developers knows.

Currently, no. We could add that, but it would still mean to restart the LT server when the file has changed (when implemented the easy way).

What do you mean by “restart LT server” ?

I’m using this plugin GitHub - rhysd/vim-grammarous: A powerful grammar checker for Vim using LanguageTool.. Every time when I want to do a check. I use :GrammarCheck in vim.

I believe this plugin is calling languagetool-commandline.jar. Does that mean a restart ? If so, it won’t bother me, even it’s the easy way :wink:

Yes, that implies a restart. It also implies checking is rather slow…

Well, I do this all the time, it’s acceptable for me. I saw LT used almost all of my threads. And can take several seconds.

But it’s actually not bad for me, to slow down writing and start thinking a little bit :smile:

Can you point me the direction ? Where/what should I change ? Or do I have to wait for the next release ?

Thanks!

If you want to open a pull request, you’ll need to find the place where spelling.txt is used and extend it to accept another file (which is maybe empty by default).

I’ve been thinking, in LO/OO LT supports modified user-dictionaries (including, but not limited to standard.dict) on the fly. Can’t this be used as a basis?

Hi, that sounds not bad.
But I’m relatively new to LT, is this user-dictionaries a plain text file or a .xml ?
I’d like it to be a plain text file, since that’s what is generated by vim

I’ve just checked and it seems to be plaintext with the first four lines serving as header.
(and it was standard.dic, not .dict as I had believed)

Some hints about how to use it ? Maybe a tutorial ? I haven’t found anything about user-dictionaries, yet…

Actually, I have a concern about this. If I get it right, this file has to be suffixed with .dic, right ? But that is not OK for vim. vim requires the no-check file ends with .add

The ideal solution for me is:
LT accept an external ignore.(whatever). And I can point it directly to the ~/.vim/spell/en.utf-8.add

I’m looking at this part, according to @dnaber, shall I add a loop for the external ignore.txt ?

Looks like the right place, but you’ll need to give it a try.

the idea was to replicate how LT interacts with the content of LO/OO user-dictionaries, so the file-extension shouldn’t matter. (the .dic/.dict thing was just a minor side-note)

unfortunately, I don’t know how this interaction takes place, only that it does.

I did a quick test with my file path hard coded as SPELLING_VIM_IGNORE_FILE.
It didn’t work, the words ignored by vim are always detected as spelling mistake in LT.
Here is the added code

if (SPELLING_VIM_IGNORE_FILE != null) {                                                                                                                                               
     for(String ignoreWord : wordListLoader.loadWords(SPELLING_VIM_IGNORE_FILE)){
       addIgnoreWords(ignoreWord);                                             
     }                                                                         
}

Sorry, I don’t understand what are the LO/OO :joy:
Are you talking about the HashMap wordsToBeIgnoredDictionary ? But I see no interface of this object.

Never heard of LibreOffice/OpenOffice?

Ooook, I did. Just never heard of this abbreviation…

I don’t see how LibreOffice is relevant here. It comes with its own spell checker. LT spell checking is turned off in LO, just the non-spelling rules are active. Thus I don’t see why LT even needs to ignore words in LO.