Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic support for LanguageTool via 'language_check' as advanced spellchecker #747

Merged
merged 1 commit into from Feb 19, 2021
Merged

Conversation

TheJackiMonster
Copy link
Collaborator

This should fix Issue #142. At the moment it is only very basic but if "language_check" is installed, it can be selected as dictionary which enables additional to the spellchecking some grammar- and style-checking.

Some additional mistakes in grammar and style can be solved via context-menu like the misspelling but some will only show some information. Others are just underlined/marked currently.

I would like to try to improve the performance before it gets merged since it has way more noticeable loading times at start of the program and during chapter/scene changing. ^^'

@obw
Copy link
Contributor

obw commented Mar 29, 2020

When I understood this correctly, this use the public avail webservice.

It should be configurable to a local install of langtool for advance users.

Why:

  1. It's faster
  2. No Internet is needed while checking
  3. Privacy

Needed fields in the configuration basic version and external start of the langtool:

  • Local / public
  • when local: Port of the Service

Better version, in which Manuskript started langtool :

  • Local / public
  • when local: Port of the Service
  • Path to the langtool jar
  • Path to java

Also thanks for your effort, this is a real enhancement for me;)

@TheJackiMonster
Copy link
Collaborator Author

I thought so too but on Archlinux at least it installs a version of LanguageTool with language_check locally and opens a java-process running it.

I will try to test it on Windows too, so that it won't be too complicated to setup. ^^'

@TheJackiMonster
Copy link
Collaborator Author

Without changing anything in the source I got a massive performance boost just by updating to the newest release of language_check (1.1 currently). It's still slower than the other dictionaries but I think it's usable if you don't swap scenes every second.
I should add that the java process which runs LanguageTool needs some memory (as expected from Java). It is at around 2.2 GB on my machine during testing and I don't know if it increases over longer usage. I wouldn't recommend using this on a small netbook without the memory capacity. ^^'

@obw
Copy link
Contributor

obw commented Mar 29, 2020

@TheJackiMonster this was something to be expected...

On both of my machines not Problem (8 or 16GB), but performance is a problem, when it's make Manuskript overall slower, that is definitely a Problem...

One of my bigger Projects (Around 500k Words), the startup of Manuskript alone is evil, two Minutes upward, also when I go to some of the older Parts, I could make Tea in the time of switching:(...

This is something we must work on soon...

@TheJackiMonster
Copy link
Collaborator Author

@obw Wow, my biggest project is only about 33k words.. So I guess we will only know how slow it is, when you try the final merge. ^^'
I think performance could be optimized for the whole project in a separate PR. So this will only focus on the actual feature for now.

@obw
Copy link
Contributor

obw commented Mar 29, 2020

@TheJackiMonster I think, you are right, with a own Performance Ticket...

But I mention it, so that we all aware of it...

@TheJackiMonster
Copy link
Collaborator Author

Okay, I implemented some sort of cache for the checking with LanguageTool. So once the text was opened it can reopened faster because as long as nothing gets changed, the tool does not have to check the text again. The results are saved in memory until you close the whole application. But I think it's fine since the process of the tool alone needs much memory and it does only stores a list of suggestions for errors and others. ^^

@TheJackiMonster
Copy link
Collaborator Author

Okay, I think everything is ready for review and merge now. I have added tooltips which present the messages of the suggestions for correction. Every match has a different color based on its type and the selection which was always selecting whole words picks the correct part of the text if nothing was selected on purpose. The colors aren't perfect at the moment but most matches have the type 'uncategorized' anyway. Settings for customization would probably need another, so I will leave this open for now.

@TheJackiMonster
Copy link
Collaborator Author

Okay, I added a commit to prevent Manuskript from crashing when selecting LanguageCheck as dictionary-library and Java is not installed. I basically disabled it as option as long as Java isn't installed properly. Java is definitive required to run LanguageTool locally.
The other thing I had to fix was: Some tooltips I added for errors and such were shown on hovering over words even when spellcheck was disabled in the menu. So I prevented that...

@TheJackiMonster TheJackiMonster merged commit ca5a987 into olivierkes:develop Feb 19, 2021
@TheJackiMonster TheJackiMonster deleted the languagetool branch February 19, 2021 15:08
@TheJackiMonster TheJackiMonster added this to the 0.12.0 milestone Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Add spell check for Chinese. Italian spellchecker
2 participants