Back to LanguageTool Homepage - Privacy - Imprint

Libreoffice & doProofreading() method

Hi, I’ve been working on a small uni project comprising a simple grammar checker for a minority language to be used inLibreOffice.

It’s mostly written in perl but the job of handling the proofreading is coded in java and works quite like your languagetool but on a far lesser level.

It’s all working quite well apart from one problem…it (LibreOffice) takes a very long time to process the errors when the doProofreading() method returns the ‘ProofreadingResult’

Here is some output showing the time taken from return from doProofreading() until reEntry into doProofreading() …or ‘time in LibreOffice’

Time in LO : 57620 ms
Time in LO : 1544 ms
Time in LO : 1432 ms
Time in LO : 3891 ms
Time in LO : 2985 ms
Time in LO : 6764 ms
Time in LO : 3686 ms
Time in LO : 1261 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 2 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 0 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms
Time in LO : 1 ms

This is a very typical pattern…first few returns are very slow…then it flies!!

The contents of the text have no bearing on the performance…if I take one of the ‘slow paragraphs’ &
put it at the bottom of the text it performs as expected (<=1ms).

Also for a larger text there are more ‘slow paragraphs’ it is not always 8 as in this case.

I would really appreciate any advice you could give me on this as I’m completely flummoxed as to why this could be happening…all ProofreadingResults are being created in exactly the same manner.

As I say, the results are good, but it’s so slow as to render it useless…please help if you can!!!

Thanks a million for any help you can give,

Which version of LibreOffice are you using? It’s common that the first run is slow as Java needs to be initialized first, but 1 minute is indeed too much. Is your (Java) code available somewhere to look at?

Hi Daniel,

thanks for your getting back to me, but I just this minute figured it out…I was also implementing XSpellChecker in my Main class (even though I wasn’t using it) …this is what was causing the delay.

Thanks again for your help.

Hi Daniel, sorry to bother you again but maybe you could help me out…

I just realized why I had XSpellChecker implemented, it was because when I don’t the ‘Text Language’ in the SpellingAndGrammar Dialogue is blank…which in turn means that the language of any corrections I make through the SpellingAndGrammar Dialogue is ‘Multiple Languages’ instead of the desired ‘Irish’ (ga-IE)

Do you have any idea how I can change the Text Language in the SpellingAndGrammar Dialogue without implementing XSpellChecker ???

Again any help would be greatly appreciated.

I don’t know, but did you have a look at how LT implements all the interfaces? The code is at There are also XML files (Addons.xcu, description.xml, Linguistic.xcu) that might be relevant for this.

I’ll give that a go, thanks again.