What is the purpose of immunization? What should it do or not do?

‘Immunizing words from matching’ (Developing a Disambiguator | dev.languagetool.org) implies that immunization makes a word or a phrase ‘invisible’. As if it does not exist. It is not possible for a rule to match the immunized text.

In standalone LT, I added this disambiguation rule at the end of disambiguation:

    <rule id="IMMUNIZE" name="Immunize text">
      <pattern>
        <marker>
          <token>*</token>
          <token spacebefore="no" regexp="yes">[a-z]+</token>
          <token>*</token>
        </marker>
      </pattern>
     <disambig action="immunize"/>
    </rule>

Testrules gives no warnings.

The screen shot shows that grammar rule IN_A_TROUBLE finds only the sentence that does not contain the immunized text. Shouldn’t it also find the error in the second sentence? Why are the disambiguations different

I asked a similar question some years ago, but I did not get an answer (Immunization for disambiguation: empty line affects the disambiguation). Thus, I ask again.

No, as immunization doesn’t really make the text invisible as if it would not exist. A better way to think of it is that the errors are first found, but then not returned to the user.

1 Like

@dnaber, thank you for your clarification.

I added an enhancement request: [en] Enhance the disambiguator to allow the 'hiding' of text · Issue #9160 · languagetool-org/languagetool · GitHub