Creating custom rules

I watched the video Create a new LanguageTool rule and I wondered if in this case it would be better to be able to define the rule on if the word is being used as an adjective or not rather than if a NNP follows?

Generally I am trying to learn more about writing rules myself and found Tips and Tricks | dev.languagetool.org quite useful.

But if I am trying to write a rule that f.e. a company wants to be referred in the female fom (ie. “XYZ ist eine Parterin”), I was a bit unsure how to approach this as I didn’t want to build the rule around “Parterin” but rather that XYZ is being referred. Otherwise I have to build an endless list (ie. “Arbeitgeber” for “XYZ ist eine Arbeitgeberin”).

Any advice here?

I guess the standard rule is somewhere here https://raw.githubusercontent.com/languagetool-org/languagetool/1e740fc3eed858e43ef218bb209b3f055ec0d9d0/languagetool-language-modules/de/src/main/resources/org/languagetool/rules/de/grammar.xml under “Evtl. keine Übereinstimmung von Kasus, Genus oder Numerus”

You could maybe write a pattern that finds any phrase “XYZ” + “…” + masc. noun (SUB:.*:SIN:MAS). You probably want to have a large test corpus to run these rules against before you activate them in production.