[pt] Portuguese rule contribution/discussion

@tiagosantos

Here it is the topic URL, so that it stays in this thread:

Hello @tiagosantos

I have been unable to disable the lowercase suggestion of months and cardinal places:

Every time I tick the check box it gets automatically unticked when I return to the settings.

Is there something that can be done?

Thanks!

I can not reproduce this issue. Try ticking the category first and see if it works. I believe this will be enough.

However, if it doesn’t solve, this has to be a Java implementation related bug, not specific to Portuguese.
In this case, the best way is to make a general bug report in GitHub. It might be useful later.

@tiagosantos

Tiago!

Could you create a rule for “demais” and “de mais”?

I will give you an example of the rings translation document:
“Os anĂ©is ajustĂĄveis sĂŁo tamanho Ășnico. Se, apĂłs ajustares a dentição ao limite, os anĂ©is continuarem pequenos demais, remove entĂŁo cuidadosamente a barra junto do lado liso com uma lĂąmina afiada e pule a junta com uma lima para as unhas (vĂȘ o diagrama).”

I tried using “de mais” and “demais” and I get no suggestion.

I tried the FLIP on-line from Priberam and they too don’t make any suggestion.

PS-> You were right regarding the Capitalization rules. I have been able to remove hits in months names and such.

Thanks!

Kind regards,

Think about the logic and tell the logic that separates both expressions. I will implement it.
This may help:

You’re welcome.

@tiagosantos

I have been trying to make this rule work but it gives an error when I type: TESTRULES PT

It suggests replacing “montes de” with “imensa(s)” and “imenso(s)”
(informal language/slang).

It simply checks for a VERB + MONTES DE + NOUN.

Could you take a look at my code and make a fix here and there and merge it into grammar.xml?

Thanks!

  <rulegroup id="MONTES DE" name="Linguagem Informal - imenso(s) - imensa(s)">
      <!-- MONTES DE imenso -->
    <rule>
      <pattern>
		<token inflected='yes' postag="VMN0000"></token>
		<marker>
          <token>montes</token>
          <token>de</token>
		</marker>  
		<token postag="NCMS000"></token>
      </pattern>
      <message>Substitua por <suggestion>imenso</suggestion>.</message>
      <example correction="imenso">Perdi <marker>montes de</marker> tempo.</example>
      <!-- MONTES DE imensos -->
    <rule>
      <pattern>
		<token inflected='yes' postag="VMN0000"></token>
		<marker>
          <token>montes</token>
          <token>de</token>
		</marker>  
		<token postag="NCMP000"></token>
      </pattern>
      <message>Substitua por <suggestion>imensos</suggestion>.</message>
      <example correction="imensos">Perdi <marker>montes de</marker> contactos.</example>	  
    </rule>
      <!-- MONTES DE imensa -->
    <rule>
      <pattern>
		<token inflected='yes' postag="VMN0000"></token>
		<marker>
          <token>montes</token>
          <token>de</token>
		</marker>  
		<token postag="NCFS000"></token>
      </pattern>
      <message>Substitua por <suggestion>imensa</suggestion>.</message>
      <example correction="imensa">Perdi <marker>montes de</marker> gordura.</example>
      <!-- MONTES DE imensas -->
    <rule>
      <pattern>
		<token inflected='yes' postag="VMN0000"></token>
		<marker>
          <token>montes</token>
          <token>de</token>
		</marker>  
		<token postag="NCFP000"></token>
      </pattern>
      <message>Substitua por <suggestion>imensas</suggestion>.</message>
      <example correction="imensas">Perdi <marker>montes de</marker> horas.</example>	  
    </rule>
  </rulegroup>

Many thanks for this rule, Marco.
The logic is almost correct. The problem is that inflected=‘yes’ only applies to the words inside the token parameter, not inside the tag, nor with the postags.

This: <token inflected='yes' postag="VMN0000"></token> should become <token postag_regexp='yes' postag="V.+"/>.

I believe this will do it. To improve, you can also generelise the Noun. For example, in the first subrule: <token postag="NCMP000"></token> use <token postag_regexp='yes' postag="N.MP.+"/> and it will work with diminutives, aumentatives, superlatives and proper nouns.

By the way, I was able to add one case from the ‘de mais’ ‘demais’ rule, but I believe that is a rare confusion case. Check git for details.

Test if it works as you expected and, if you wish I will push it after testing to the repo.

@tiagosantos

<rule id='DEMAIS_DE_MAIS' name="ConfusĂŁo: 'de mais'  + 'demais'">

I have just tested it and it seems good :slight_smile:

Tiago, could you commit my rule with your improvements?

Thank you very much!

Kind regards,

@tiagosantos

I added a new mistranslation rule regarding “medicina tradicional chinesa”.

Do you know if “chinesa” should start uppercase?

Thanks!

Great. That section needs more rules.

@tiagosantos

What about a rule:
“À minha mãe e ao meu pai” -> “Aos meus pais”
?

There could be more ways of writing it (the redundancy part).

That is a great one. There is already a group that addresses non sexist redundancies, but I believe it doesn’t address that situation. That rule would be a great complement.

Could you create it, please? :slight_smile:
“a minha mãe e o meu pai”
“a minha mãe e pai”
“à minha mãe e ao meu pai”
“à minha mãe e pai”

:slight_smile: :slight_smile:

Not on my list of priorities.
:slight_smile:

Cool, I will do it myself tonight then.

What name should I give to the rule and which category?

Thanks!

Awesome. The other are called “Redundñcia no neuro” or something similar. Make the rules, push them and we can improve later if needed.

Done!

Thanks!

:slight_smile: :slight_smile: :slight_smile:

@tiagosantos

“As culturas Ocidentais, por sua vez, procuram a cura mágica para tudo.”

“por sua vez” it suggests “REFORMULAR” if I well remember.

Could you suggest:
https://www.sinonimos.com.br/por-sua-vez

Thanks!

That information is in this file:

https://raw.githubusercontent.com/languagetool-org/languagetool/master/languagetool-language-modules/pt/src/main/resources/org/languagetool/rules/pt/cliches.txt

That is a work that really needs to be done, but I never seem to find motivation to do it.
You just have to replace REFORMULAR with any apropriate expression. No coding knowledge required. Just plain text.

Are you going to do it?

Done!

Is this okay:
por sua vez=por seu lado
?

EDIT:
I just noticed that we can add more than one suggestion:
por sua vez=por seu lado|por seu turno|no que lhe diz respeito|no que lhe concerne