07-07-2016, 01:02 PM | #1 | |||
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
[LanguageTool]: Grammar check
[LanguageTool]: Grammar check
Updated: August 8, 2023 Current Version: "0.4.6" This plugin is a very simple LanguageTool wrapper, which allows you to check the grammar of the currently loaded epub. It's a validation plugin that'll flag paragraphs with grammar errors. It does not come with a GUI like the LibreOffice version. For example, if you check the following sentence: I Can Has Cheezburger? you'll get the following validation panel message: Quote:
System requirements Since LanguageTool is a Java tool, you'll need to install Java. It also requires Sigil 0.9.x. (Linux users will also need to install the bs4 and lxml Python libaries.) You'll also need to download the latest LanguageTool desktop version and unzip it. Remember the location of the folder that contains languagetool-commandline.jar, because you'll later need to select that file. Optionally, if you want to use n-gram data sets for spellchecking, you'll need to download the huge n-gram data files (En, De, ES, FR, NL, HE, IT, RU, ZH) and define the path via ngramIndexDir. (Using this option will significantly slow down LanguageTool!) Installation 1. Select Manage Plugins from the Plugins menu. In the Manage Plugins dialog box, select Use Bundled Python, if it isn't already selected. 2. Click Add Plugin and select LanguageTool_v0.4.6.zip. This will install the plugin, which you can select via Plugins > Validation > LanguageTool. By default, the plugin will only check the currently selected file, to check all files click the Text folder or change "allFiles": false to "allFiles": true in the LanguageTool.json preference file. Preferences You can change the following settings via plugin preference settings. (All of these settings need to be terminated with a comma unless it's the last line in the .json file.) A typical LanguageTool.json file looks like this: Code:
{ "clipboard_copy": true, "allFiles": false, "update_check": false, "ltPath": "C:/Program Files/LanguageTool-4.5/languagetool-commandline.jar", "disabledRules": "MORFOLOGIK_RULE_EN_US,ENGLISH_WORD_REPEAT_BEGINNING_RULE,WHITESPACE_RULE,COMMA_PARENTHESIS_WHITESPACE", "disabledCategories": "REDUNDANCY" } clipboard_copy if enabled, messages will be copied to the clipboard; default: false allFiles if enabled, all files will be checked; default: false update_check if enabled, the plugin will check the LT website for updates; default: true ltPath path to languagetool-commandline.jar ngramIndexDir path to the n-gram directory b) LanguageTool preferences (for more information on these parameters see this website) enabledRules disabledRules enabledCategories disabledCategories enabledOnly In addition to these settings, the plugin will also look for a user-rules.xml file in the plugin folder. (You can test this feature by renaming en_user-rules.xml to user-rules.xml. If you rename this file to user-rules.xml, LanguageTool will flag all split infinitives in English epubs.) For example, if you check the following sentence: She used to secretly admire him. LT will display the following message: Quote:
If you want to use ngrams for grammar checking, you'll need to add the following entry at the beginning of LanguageTool.json: Code:
"ngramIndexDir": "C:/ngrams",
C:/ngrams/en/1grams C:/ngrams/en/2grams C:/ngrams/en/3grams Obviously, the values in Magenta need to be changed to match the actual installation folders. Python also requires slashes (/) or double back-slashes (\\) for Windows folder names. Note that n-gram checking is very slow. However, it can detect some errors that rules can't detect. For example, if you check the following sentence: Don't go their. it'll report: Quote:
Depending on the book type, you might get lots of false positives. You can filter them out via the disabledRules and disabledCategories settings. Note that the plugin will use the language defined in the epub metadata section for all files in the epub, regardless of lang or xml:lang attributes. If you define an unsupported language code, LanguageTool will fail. Supported language codes are: Spoiler:
By default, LanguageTool will also do a spellcheck. However, since Sigil has a much more advanced spellchecker, this option should be disabled. For US English it's already disabled by default via the MORFOLOGIK_RULE_EN_US rule. For other languages different rules will need to be added to the disabledRules setting. Update Check setting By default, the plugin will connect to the LanguageTool Github web site to check for LanguageTool updates. If you don't want the plugin to connect to the Internet, change the following LanguageTool.json setting to false. Code:
"update_check": true Last edited by Doitsu; 08-05-2023 at 04:58 AM. Reason: Updated for Qt 6.5.2 and Python 3.11.3 |
|||
07-10-2016, 07:08 PM | #2 |
Zealot
Posts: 100
Karma: 1204
Join Date: Jun 2012
Device: Bookari (née Mantano Reader) on Android; Kindle Fire HD
|
This is very cool. The interface is a bit rough (the LanguageTool messages are truncated, as discussed in another thread), but it’s already usable. Thank you!
|
Advert | |
|
07-31-2016, 08:21 AM | #3 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
I've attached a new version to the first post that'll indicate the column number (= cursor position) of the word or phrase that LT has flagged.
This should make it easier to locate these words or phrases in long paragraphs. For an example, see the attached screenshot. |
11-01-2016, 10:12 AM | #4 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
New version 0.4 with cursor positioning support released
I attached an updated version for Sigil 0.9.7 with cursor positioning support to the first post.
I.e., if you click an error message it'll move the cursor to the word that was flagged. (Occasionally, the cursor position might be off by a couple characters.) This should make it easier to find the words flagged by LanguageTool. BTW, the LanguageTool developers have released a new standalone LanguageTool version: LanguageTool 0.3.6 Last edited by Doitsu; 01-23-2017 at 11:35 AM. |
02-04-2017, 01:40 AM | #5 | |
Gregg Bell
Posts: 2,265
Karma: 3917588
Join Date: Jan 2013
Location: Itasca, Illinois
Device: Kindle Touch 7, Sony PRS300, Fire HD8 Tablet
|
Quote:
|
|
Advert | |
|
02-04-2017, 03:49 AM | #6 | |
null operator (he/him)
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR Last edited by BetterRed; 02-04-2017 at 04:11 AM. |
|
02-04-2017, 09:17 AM | #7 |
Grand Sorcerer
Posts: 5,640
Karma: 23191067
Join Date: Dec 2010
Device: Kindle PW2
|
It looks like you're missing a python package that is required for all Sigil plugins that come with a GUI.
To fix this error either search in Synaptic or your distro's package manager for python3-tk and install it. If you can't find it enter the following command in a terminal window: Code:
sudo apt-get install python3-tk Last edited by Doitsu; 02-04-2017 at 10:19 AM. |
02-05-2017, 09:00 PM | #8 | |
Gregg Bell
Posts: 2,265
Karma: 3917588
Join Date: Jan 2013
Location: Itasca, Illinois
Device: Kindle Touch 7, Sony PRS300, Fire HD8 Tablet
|
Quote:
|
|
02-05-2017, 09:02 PM | #9 | |
Gregg Bell
Posts: 2,265
Karma: 3917588
Join Date: Jan 2013
Location: Itasca, Illinois
Device: Kindle Touch 7, Sony PRS300, Fire HD8 Tablet
|
Quote:
|
|
02-05-2017, 10:04 PM | #10 |
Resident Curmudgeon
Posts: 76,465
Karma: 136564696
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
|
02-05-2017, 10:30 PM | #11 | |
null operator (he/him)
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
Mine came as a zip (LanguageTool-3.5.zip), which I unpacked into a LanguageTool-3.5 sub-directory in my _Utilities/Productivity directory. So when I got that request from the Sigil plugin, I navigated to _Utilities\Productivity\LanguageTool-3.5 and selected the file languagetool.jar, which is what it's asking for, see top right corner of your screen shot. BR |
|
02-05-2017, 11:19 PM | #12 |
Grand Sorcerer
Posts: 28,040
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Having tkinter installed is a requirement for a complete, Sigil plugin framework. It automatically comes with the Windows and Mac Sigil installer packages, and it's clearly indicated in the Linux build instructions that it should be installed if users want a complete plugin framework.
|
02-07-2017, 08:17 PM | #13 | |
Gregg Bell
Posts: 2,265
Karma: 3917588
Join Date: Jan 2013
Location: Itasca, Illinois
Device: Kindle Touch 7, Sony PRS300, Fire HD8 Tablet
|
Quote:
|
|
02-08-2017, 12:19 AM | #14 |
Gregg Bell
Posts: 2,265
Karma: 3917588
Join Date: Jan 2013
Location: Itasca, Illinois
Device: Kindle Touch 7, Sony PRS300, Fire HD8 Tablet
|
It gave me a different window this time. I got as close as this (screenshot) and got stuck. And it was asking for a file and the Language Tool was a folder. Am I supposed to enter something into that box? 'Cause when I clicked on the Language Tool folder and 'open' it did nothing.
|
02-08-2017, 01:04 AM | #15 | |
null operator (he/him)
Posts: 21,006
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Quote:
BR |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What does 'Well-Formed Check EPUB' actually check? | bookman156 | Sigil | 21 | 03-20-2016 07:31 PM |
Grammar issues (again).... | mukoan | Writers' Corner | 25 | 06-28-2013 03:26 PM |
Trusting Words grammar check? | jhempel24 | Writers' Corner | 23 | 01-30-2013 03:52 PM |
Are DRM books with check in/check out allowed? | i8abug | Library Management | 4 | 05-31-2012 03:27 PM |
Seriously thoughtful English (or US) grammar | Sweetpea | Lounge | 26 | 10-21-2011 11:17 PM |