Back to LanguageTool Homepage - Privacy - Imprint

[pt] Portuguese rule contribution/discussion


(Marco A.G.Pinto) #21

@tiagosantos

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


(Marco A.G.Pinto) #22

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!


(Tiago F. Santos) #23

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.


(Marco A.G.Pinto) #24

@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,


(Tiago F. Santos) #25

Think about the logic and tell the logic that separates both expressions. I will implement it.
This may help:
https://ciberduvidas.iscte-iul.pt/consultorio/perguntas/quando-e-demais-e-quando-e-de-mais/24806

You're welcome.


(Marco A.G.Pinto) #26

@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>

(Tiago F. Santos) #27

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.


(Marco A.G.Pinto) #28

@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,


(Marco A.G.Pinto) #29

@tiagosantos

I added a new mistranslation rule regarding "medicina tradicional chinesa".

Do you know if "chinesa" should start uppercase?

Thanks!


(Tiago F. Santos) #30

Great. That section needs more rules.

https://ciberduvidas.iscte-iul.pt/consultorio/perguntas/portugues-com-inicial-maiuscula-ou-minuscula/14333


(Marco A.G.Pinto) #31

@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).


(Tiago F. Santos) #32

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.


(Marco A.G.Pinto) #33

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:


(Tiago F. Santos) #34

Not on my list of priorities.
:slight_smile:


(Marco A.G.Pinto) #35

Cool, I will do it myself tonight then.

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

Thanks!


(Tiago F. Santos) #36

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


(Marco A.G.Pinto) #37

Done!

Thanks!

:slight_smile: :slight_smile: :slight_smile:


(Marco A.G.Pinto) #38

@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:

Thanks!


(Tiago F. Santos) #39

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?


(Marco A.G.Pinto) #40

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