I am using the LanguageTool Java API and am trying to use JLanguageTool.disableRule(ruleId) and am running into some problems.
- Rule.getId() is supposed to be unique but that is not always the case. For example with AbstractPatternRule, there is a subId. In fact JLanguageTool.getAllRules() documents the following:
Please note that XML rules that are grouped will appear as multiple rules with the same id. To tell them apart, check if they are of type
AbstractPatternRule, cast them to that type and call their
I have noticed that even with the Id and the subId, some rules are still not unique i.e. there are two PatternRules with an ID of PER_PER_A_PIANO and a subId of 2. There are many more examples of this.
My question is, given a RuleMatch, how can I allow a user to disable just the rule for this RuleMatch. The JLanguageTool.disableRule(ruleId) is not granular enough to disambiguate any Rules that have a subId.