Back to LanguageTool Homepage - Privacy - Imprint

Antipattern not working as expected with exclamation mark

I am trying to create a version of the standard language tool that fixes lowercase letters at the start of sentences, but wish to have exceptions. In this case, I want the antipattern to stop the rule working when I’m a Celebrity … Get Me Out of Here! is mentioned. I would expect this rule to work but it doesn’t. Why not?

                  <token spacebefore="no">!</token>
                  <token regexp="yes" case_sensitive='yes'>([a-z]+)</token>
                  <token postag="SENT_START"/>
                  <marker><token regexp="yes" case_sensitive='yes'>([a-z]+)</token></marker>
                  <message>Missing uppercase at the start of a sentence: <suggestion><match no="2" regexp_match="([a-z]+)" regexp_replace="$1" case_conversion="startupper"/></suggestion></message>

The problem is that Get Me Out of Here! will end a sentence, and you cannot have cross-sentence checks in XML rules. I can’t think of a good workaround other than first having an exception for sentence splitting in segment.srx. Once that works, your rule should work, too.