Hello @jaumeortola
Can you help?
I don’t know what is wrong with this rule:
<!-- QUE TER COMO OBJETIVO cujo objetivo ser -->
<rule id='QUE_TINHA_COMO_OBJETIVO' name="cujo objetivo era">
<!-- Created by Marco A.G.Pinto, Portuguese rule 2021-03-19 (Enhanced) (17-MAR-2021+) -->
<pattern>
<token>que</token>
<and>
<token inflected='yes'>ter</token>
<token postag='VMII3S0|VMIP3S0' postag_regexp='yes'/>
</and>
<token regexp='yes'>como|por</token>
<token>objetivo</token>
</pattern>
<message>Melhore a redação.</message>
<suggestion>cujo objetivo <match no='2' postag="VMII3S0" postag_regexp="no" postag_replace="VMIP3S0">é</match></suggestion>
<suggestion>cujo objetivo <match no='2' postag="VMIP3S0" postag_regexp="no" postag_replace="VMII3S0">era</match></suggestion>
<example correction="cujo objetivo é|cujo objetivo era">Assim surgiu o Estado Islâmico <marker>que tinha como objetivo</marker> criar um califado mundial.</example>
</rule>
It throws errors in TESTRULES PT:
Testing rule 2600…
Skipped 0 rules for variant language to avoid checking rules more than once
2685 rules tested.
Exception in thread “main” org.languagetool.rules.patterns.PatternRuleTest$PatternRuleTestFailure: Test failure for rule QUE_TINHA_COMO_OBJETIVO[1] in file /org/languagetool/rules/pt/grammar.xml: Incorrect suggestions: Expected ‘cujo objetivo é|cujo objetivo era’, got: ‘cujo objetivo (é)|cujo objetivo (era)’ on input: ‘Assim surgiu o Estado Islâmico que tinha como objetivo criar um califado mundial.’
at org.languagetool.rules.patterns.PatternRuleTest.addError(PatternRuleTest.java:313)
at org.languagetool.rules.patterns.PatternRuleTest.assertSuggestions(PatternRuleTest.java:561)
at org.languagetool.rules.patterns.PatternRuleTest.testBadSentences(PatternRuleTest.java:453)
at org.languagetool.rules.patterns.PatternRuleTest.lambda$testGrammarRulesFromXML$1(PatternRuleTest.java:342)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Later, I will replace “objetivo” with “NC.+|AQ0.+”
Thanks!