Using "inflected" and "case_sensitive" simultaneously


I was trying to write a rule that uses inflected=“yes” and case_sensitive=“yes” at the same time, but it seems the case sensitivity is ignored in this case. There are a few rules in the default en/grammar.xml that use both; for instance this simple one at least does not work as expected:

<rule id="SAFE_GUARD_COMPOUND" name="safe guard (safeguard)">
    <token case_sensitive="yes" regexp="yes">[Ss]afe</token>
    <token case_sensitive="yes" inflected="yes">guard</token>
  <message>This word is normally spelled as one.</message>
  <example correction="safeguard">She kept a savings to <marker>safe guard</marker> against debt and emergencies.</example>


$ echo "Safe Guards"  | java -jar languagetool-commandline.jar -l en-GB
Expected text language: English (GB)
Working on STDIN...
1.) Line 1, column 1, Rule ID: SAFE_GUARD_COMPOUND[1] premium: false prio=1
Message: This word is normally spelled as one.
Suggestion: SafeGuards
Safe Guards

Is it a bug in LT, or should we consider that inflected=“yes” also produces (lower|upper)case variants?

Thanks for noticing. It looks like a bug, or at least it can be confusing. This issue has a potential workaround which could be used: 'case_sensitive' with 'inflected' gives unexpected results for a word at the start of a sentence · Issue #657 · languagetool-org/languagetool · GitHub. It’s probably the best approach to use the workaround.

Thank you for the link, I had missed this issue in github. I was using a similar workaround and was hoping I could make it cleaner. I’ll stick to it then.