[pt] Problem creating rule - 2021-06-24

@udomai @jaumeortola

Hello!

I am preparing some new rules to add after the official LanguageTool release tomorrow.

I am facing some issues with this powerful rule which I am trying to create:

<rule id='PASSAR_A_VERBO' name="Passar + a + Verbo → Verbo (forma de Passar)">
<!--      Created by Marco A.G.Pinto, Portuguese rule 2021-06-25 (17-MAR-2021+)      -->
	<!--
E assim passando a reduzir as perdas. → E assim reduzindo as perdas.
	-->	
  <pattern>
      <token inflected='yes'>passar</token>
      <token>a</token>
      <token postag='V.+' postag_regexp='yes'/>
  </pattern>
  <message>Esta perífrase pode ser simplificada.</message>
	  <suggestion><match no='1' postag='V.+' postag_regexp='yes'>\3</match></suggestion>
  <example correction="reduzindo">E assim <marker>passando a reduzir</marker> as perdas.</example>
</rule>	

I want to change verb \3 to match verb \1.

Could you give a tip?

Thanks!

Do you mean same postag?

You need to take the lemma from token 3 (reduzir) and the POS tag from token 1 (passando). It can be done with the AdvancedSynthesizerFilter. Add this line before the <message>:

<filter class="org.languagetool.rules.pt.AdvancedSynthesizerFilter" args="lemmaFrom:3 lemmaSelect:V.* postagFrom:1 postagSelect:V.*"/>

It worked!

Thank you!