Back to LanguageTool Homepage - Privacy - Imprint

How to get the "case-sensitive" of the pattern/tokens of a specific rule?



When I get the RuleMatch object I can easily get the rule with a getRule() call. However, the Rule object does not provide a method for indicating whether a rule is for a case-sensitive match. Do you have any idea?
The reasoning behind this:

  • For a case-sensitive check, the replacement will be case-sensitive as well (ie. following the case of the replacement).
  • For a case-insensitive check, the replacement will honor the original case .

Many thanks!

(Daniel Naber) #2

The rule itself should make sure its suggestions have the proper upper/lower case. But if your rule is of type AbstractPatternRule, you can use getPatternTokens() and each token will have information about case via isCaseSensitive().