Spell check from the command line - is it possible?

Is it possible to use the algorithms and dictionaries of LibreOffice to spell a txt (plain text) file from the command line?

The question has been asked before at:

https://ask.libreoffice.org/t/commandline-spellcheck-with-libreoffice-dictionary/515

but the answer in there (accepted by Alex Kemp) is incorrect - they point to the use of Huspell which may use the same algorithm, but not the same dictionaries. Take for example, Vero, for the Portuguese language:

 https://pt-br.libreoffice.org/projetos/vero/

it has its own dictionary which is different from Hunspell.

I think, you should better ask the developers of Vero if they provide any option for command line.

Hunspell is a program that uses dictionary files that have to be built according to a set of rules. Lots of those dictionary files have been put together by people not associated with the developers of Hunspell. So, you can replace the dictionary supplied with Hunspell by one you made yourself or by the one that came with Vero, provided that it was built with the rules set by Hunspell. If Vero is based on Myspell, you can expect problems.

@gabix, Vero is just an example that shows that Alex Kemp accepted the wrong answer for the previous question. I am interested in this question in the most generic form - that is - for any dictionary installed on LibreOffice.

On second thoughts: how is this related to LibreOffice?

@anon87010807: it’s obvious he wants to leverage LO to spellcheck another file without starting LO.

Spell checking is an interactive process, so you need some kind of interface. Either use Libre, or the interface provided by Hunspell, which is a program developed independently from Libre. So - download a Hunspell executable, and any dictionaries you want to use with it, read the documentation of Hunspell so you know how to add the dictionaries and go for it.

He said Hunspell doesn’t understand LO’s dicts.

He’s vague about that - all he says is that the dictionaries are different, not that Hunspell can’t understand them.

He says, word for word, Hunspell might use same algo but not same dictionaries.

Downloaded Vero - it’s a set of dictionary and hyphenation files, If hunspell doesn’t recognize it, it would be unusable in LibreOffice. Btw, it’s not been updated for over a year.
Your last comment makes no sense - if hunspell can’t deal with the dictionaries that come with Libre, you’d get a tsunami of complaints about the spell checker not working.

@pauloney, there is no generic answer, because, as I understand, spellcheck extensions can use various formats for their respective dictionaries. For Hunspell dictionaries, perhaps, an option would be to use LanguageTool (a stand-alone version, not an extension), but conversion will be required first (provided by LanguageTool).

Thanks to all that helped understand a bit better the relationship between Vero and Hunspell and other dicts. After some digging I found out that dicts being distributed by Hunspell are the same ones available for Vero (and so LO). This, in itself, is a bit of a concern because Vero seems to be open source, but there is no public-mailing list, no discussion board and no source-repository. As a project that feeds onto LO and Hunspell that situation is less than satisfactory.

Words being added to the Hunspell dics are not being added to Aspell which is NOT the tradition in dictionary maintenance. Hunspell dict was initially upstreamed from Aspell. The only connection to the project is e-mail to the lead maintainer, the project has not been updated in a number of years and the lead stop answering e-mails. Not good! May be time to fork it.

Hunspell is a spell checking program developed by a Hungarian programmer. Anyone can build dictionary files for it for any language.

Vero is a set of dictionary files for use with Hunspell, and maybe Aspell or Myspell as well, and hyphenation rules. You can’t use it as a stand-alone program, because it isn’t a program like Hunspell. To answer your question: it uses the rules defined in Hunspell, but it will have other words and the like in its dictionary than the dictionary set that comes with LibreOffice by default.

So, download a Hunspell executable for Windows, park it on your computer (you don’t have to install it like you’d do with other software), read the documentation to learn to work with it and to find out how and where to put dictionary files, then run it from the command line. I’m not sure if you can use it to parse text files, you will need some interface for dealing with unrecognized or misspelled words anyway, don’t expect that it will resolve errors automatically, it won’t.