[pt] Agreement masculine word+verb+adjective

In Portuguese, when we have the sentence “O menino é alto”, we have the agreement between the noun ‘menino’ and the adjective ‘alto’. However, the corrector cannot get the mistake. I’m trying to create the rule, but I’m not being able to do that, especially because I’m new at developing rules. This is what I have:

<rule id="CONCORDNCIA_SUBSTANTIVO_MASC_PREDICATIVO_GENERO" name="CONCORDNCIA_SUBSTANTIVO_MASC_PREDICATIVO_GENERO">
 <pattern>
  <token regexp='yes' negate='yes'>NCMS000</token>
  <token regexp='yes' negate='yes'>VMIP3S0</token>
  <marker>
  <token regexp='yes' negate='yes'>AQ0FS0</token>
  </marker>
 </pattern>
 <message>Concordância de gênero inadequada.</message>
 <suggestion><match no="3" regexp_match="A..MS3.*" regexp_replace="A..FS3.*"/></suggestion>
 <example correction=''>O homem é alta.</example>
 <example>O homem é alto.</example>
</rule>

Can anybody help out, pelase?

I don’t speak Portuguese, but I see a problem with your syntax: NCMS000 seems to be a part-of-speech tag. In that case, you need to use this syntax: <token postag="NCMS000"/>

I’m not sure why you use negate="yes" in all three tokens. Not sure whether this can work - you’d be looking for three tokens in a row that do not match the ones you have specified.

Also, this page might help you see the difference in analysis of both sentences: Análise de Texto - LanguageTool - if you enter both sentences, it will show the internal part-of-speech tags assigned, which helps writing rules.

Your contribution has worked. Sorry for being so inconvenient, but I’m also having problems about the suggestions. The wrong sentence is “O menino é alta.” Instead of ALTA, it should be ALTO (which is masculine). Could you tell me how to do it, please?

So it seems you need to get from “AQ0FS0” to “AQ0MS0”, right? You could try this (I haven’t tested it):

<match no="3" postag="AQ0FS0" postag_replace="AQ0MS0"/>

or more generally:

<match no="3" postag="A(..)F(..)" postag_regexp="yes" postag_replace="A$1M$2"/>

Looking at existing rules in grammar.xml is also often helpful.

It has worked! Thank you so much.