manuskript icon indicating copy to clipboard operation
manuskript copied to clipboard

Feature Request: Adding remote Server Language Tool To Manuskript (And other enchancements)

Open TheShadowOfHassen opened this issue 3 years ago • 6 comments

So @Mannshoch opened issue #1102 because he wanted to be able to set Manuskript to his local Language Tool Server. Manuskript can't do that however. I added how to install language tool it in the wiki to fulfill the issue, but I decided to also open an issue so the developers can easily keep track of his feature request.

It's a good idea, it'd probably the ability to disable rules like the LibreOffice extension can. But I'd like that feature to the current manuskript as well. Some of the "Errors" it finds in my stories are only if you're writing research papers. It may also speed up the checking time because even though spell check lags at big files. I know all spell checks does and that's something that can be cleaned up but this could help.

According to the pypi site here: https://pypi.org/project/language-tool-python/ you can connect to remote servers (and even to the official language tool one. I haven't looked at the code but I imagine at least part of it could be done easily it you knew Qt, if someone wants to work on it its fine but this may be something that could should until a spell check rewrite happens be it during the Gtk rewrite or not because the waiting time is kind of ridiculous.

I think ideally we should have options to connect to the official language tool server, maybe the premium version also, but also the custom server and the way Manuskript does it now also. Also for all three there should be the ability to disable rules and access any other language tool settings.

TheShadowOfHassen avatar Jan 03 '23 23:01 TheShadowOfHassen

Mokup for a settings page for LanguageTool grafik

Mannshoch avatar Jan 04 '23 11:01 Mannshoch

One thing I want to point out before anyone starts implementing such a configuration: I think this could be a neat feature. However the default should probably be using the internal instance. So it's easier to start plotting and writing.

Another thing I want to add regarding remote servers (official servers or premium servers were mentioned): Currently spell checking is executed every time text gets changed and it will check the whole section (in most cases this will be a scene, maybe a chapter when you don't split chapters into scenes - one markdown file). That's pretty bad for multiple reasons but it scales horribly for any remote server connection as well. Because when you type anything it will dispatch spell checking every key press in worst case. This can be fine when language tool is running locally and the internal instance will only use IPC for communication. But having a socket connection (to local network or even through internet) will add noticeable amounts of latency with the current implementation.

So before this issue is handled, I would suggest improving the handling of spell checking upfront. Otherwise I don't think it's much beneficial unfortunately.

First step would probably to make spell checking asynchronous (maybe I even did that already... can't remember for sure though ^^'). Second step would be to scan the text for paragraphs, sentences or similar grammatically separated regions to only check the changed region after adjusting the given text. So a text file only needs to be checked fully once and the further iterations should only introduce small changes.

At least there's already some kind of cache done. I definitely remember adding that in the past. So after spell checking a text file once, the result will stay in memory and it won't get processed again until its content changes. ^^'

TheJackiMonster avatar Jan 04 '23 21:01 TheJackiMonster

I agree with you. The standard should be a local setup with minimal amount of disk space using. The question of whether data should be transmitted via the Internet must take data protection into account.

If you wish an auto setup without anything to click for users, I would prefer if a minimal setup of LanguageTool is shipped with manuskript. If you could live with a user feedback, whether the user has to agree a download of the minimal components, then you could ship manuskript without LanguageTool.

In any case, please avoid Internet connection without the knowledge of the user.

Mannshoch avatar Jan 05 '23 08:01 Mannshoch

There has been some efforts to simplify spell checking in GTK TextView widgets using the library libspelling. Might be useful to reduce our code base.

TheJackiMonster avatar Jul 15 '23 13:07 TheJackiMonster

But it's only for GTK 4.

Actually, I've written a spell check backend for textview(as well as a markdown). As well as a new Language Tool python wrapper because I didn't like the fact that Language_Tool_Python was Greater GPL (And I might want to eventually make something not GNU GPL

I was wondering if we wanted to use all three for the GTK port, the only caveat is that all are pretty new, and any improvments we made to them I'd want to put upstream. (The Markdown and Spell Check are more like copy and paste code sets than modules, and I want to license MIT the Language Tool wrapper I'm going to license Lesser GPL) and yes with them you can set up remote servers, in fact I also wrote a python UI for hosting a language tool UI.

TheShadowOfHassen avatar Jul 18 '23 11:07 TheShadowOfHassen