Back to LanguageTool Homepage - Privacy - Imprint

Help with skip='-1'

I have a rulegroup that finds any inflection of the word ‘disburse’ when it should probably be ‘disperse’ by identifying trigger words in the same sentence. The first rule finds ‘disburse’ in front of certain other words in the sentence and the second after those words. Is there a way to do this with just one rule and not two?

<rule>
<pattern>
<marker><token inflected="yes" regexp="yes" skip='-1'>disburse</token></marker>
 <token regexp="yes">crowds?|people|seeds|widely|protesters|demonstrators?|rioters|groups|demonstrations?|</token>
</pattern>
<message><suggestion><match no="1" postag="(V.*)" postag_regexp="yes" postag_replace="$1">disperse</match></suggestion></message>
</rule>
<rule>
<pattern>
<token regexp="yes"  skip='-1'>crowds?|people|seeds|widely|protesters|demonstrators?|rioters|groups|demonstrations?|</token>
<marker><token inflected="yes" regexp="yes">disburse</token></marker>
</pattern>

<message><suggestion><match no="1" postag="(V.*)" postag_regexp="yes" postag_replace="$1">disperse</match></suggestion></message>
</rule>

I don’t think so, but <or> (https://dev.languagetool.org/development-overview#or-and) could maybe make the rule more compact.

The rule “wrong word in context” does this in a more compact way. You need to add a line to this file:

But if you need specific exceptions later, you will be better off with the two XML rules.