Hi. This is an introduction to the language tool rule editor.
LanguageTool is an open source style and grammar checker.
It finds errors by searching a text for error patterns.
This rule editor lets you write those error patterns.
In other words, if you know how to use this rule editor,
you can help make the LanguageTool more powerful.
I'll now show you how to use it.
First, make sure the correct language is set.
Now, you need to think of a specific error that you want LanguageTool to detect
Think of a sentence with this error and enter it to the wrong sentence field.
For this example, I'll use the error:
"Sorry for my bed [sic] English"
where "bad" is misspelt (as "bed")
I will also enter the correct version of this sentence
into the corrected sentence field
Click on the button.
A new section opens where we can specify the error pattern.
But first, the rule editor lets you know
that LanguageTool already finds the error in our example sentence.
As this is just an example, I will ignore this message.
Now comes the main part – the error pattern.
You can see in initial error patterns just one word: "bed".
But "bed" itself is a correct word.
If our pattern only contained this word,
LanguageTool would complain about any sentence with the word "bed".
That's obviously not useful at all.
What I want is to say that "bed" is only wrong in specific contexts.
In this case, it is only wrong followed by the word "English",
so i click the "add token to pattern" link
and here I add the word "English".
This pattern will now match all sentences
where the word "bed" with an "e" is directly followed by the word "English".
I will try out the rule now.
For that, I give the rule a name.
This name is what a user of LanguageTool will see in the configuration dialogue,
and I'll add a message.
This is what the LanguageTool user will see if the rule matches a sentence.
So it should be a short helpful text.
I'll put single quotes ('') around the correct word to mark it as a suggestion.
The other fields are optional and we'll leave them just blank for now.
Now when clicking the "evaluate error pattern button"
both my example sentences get checked
plus a few thousand other test sentences, for example from Wikipedia.
Everything is ok so far
and the rule editor displays the snippet of XML code.
This is the code that LanguageTool needs to use your rule.
If you think your rule is useful for future versions of LanguageTool,
please send it to the developers.
There's a link here with contact information.
Now let's have a look at what happens if your rule doesn't quite work.
Assume for example your rule was only one word:
"Bed" with an "e".
If I evaluate this rule, I get a lot of matches,
and these matches don't seem to have errors.
This is a clear sign that the pattern is not strict enough
so one might want to add another word.
So for now, we've only looked at matching simple words.
But you can also match regular expressions by clicking the "Regex" check box.
For example, match English or French by using a pipe [ | ] symbol.
You can also match words by their part of speech.
Click the "part of speech" radio button and enter the text field.
For some languages, a help will show up about the parts of speech that can be addressed.
This help will tell you for example that
"NNP" is the code for singular proper nouns in English.
If you evaluate the rule with this,
it will also work as the word "English" is detected as a singular proper noun.
If you use a part of speech that doesn't match, the rule editor will let you know.
Like this, you can see the part of speech of the example sentence here.
So this was our short introduction to the rule editor.
We hope you use it to create new error patterns to make LanguageTool more powerful.
If you have questions, feel free to contact us on the forum.
You can find the link on LanguageTool.org (https://languagetool.org/)
This video was subtitled by safetex@ymail.com