languagetool-org / languagetool

Style and Grammar Checker for 25+ Languages
https://languagetool.org
GNU Lesser General Public License v2.1
12.34k stars 1.39k forks source link

[pt] Possible fix for "pode ser possível" #7042

Closed ricardojosehlima closed 2 years ago

ricardojosehlima commented 2 years ago

Although not violating any grammatical rule, "pode ser possível" is stylistically strange, for it repeats "poder" twice in a sense. LT doesn't flag anything wrong with it nor its variants ("poderia ser possível", "podem ser possíveis", and so on). It may be worth a look and seems one of the stylistic rules that @marcoagpinto appreciates and creates.

marcoagpinto commented 2 years ago

@ricardojosehlima

I don't understand.

ricardojosehlima commented 2 years ago

"possível" comes from the verb "poder", if I say "pode ser possível" it is redundant, if it is "possível" I don't need the "pode". Should be "deve ser possível" or simply "é possível".

marcoagpinto commented 2 years ago

Ahhhhh… 😄

I will fix it tonight, or maybe Susana will.

It is in my nightly TO-DO list.

😄 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄 😄

marcoagpinto commented 2 years ago

What is the rule ID, by the way?

Or the sentence that triggers it?

ricardojosehlima commented 2 years ago

LT doesn't flag it, and it should. The pattern could be the verb "poder" and its variants "pode, poderá, poderia, pôde" + ser + possível (also all this, except "ser" in the plural "podem ser possíveis", etc)

marcoagpinto commented 2 years ago

ahhhhh…

marcoagpinto commented 2 years ago

a rule

marcoagpinto commented 2 years ago

If I do it at 5am, is it too long from now?

I am very stressed.

marcoagpinto commented 2 years ago

Well, I only woke up now… 😢 😢 😢 😢 😢 😢 😢

Almost 10am.

Let me code it.

marcoagpinto commented 2 years ago

@ricardojosehlima

I have it working:

    <!-- PODER SER POSSÍVEL deve ser possível -->
    <rule id='PODER_SER_POSSIVEL' name="Redundância: Poder/possível">
      <!-- Created by Ricardo Joseh Lima and improved by Marco A.G.Pinto, Portuguese rule 2022-08-25 (25-JUL-2022+) -->
      <!--
      A vitória pode ser possível. → A vitória deve ser possível.
      -->
      <antipattern>
        <token postag='V....P.+' postag_regexp='yes'/>
        <token>ser</token>
        <token>possíveis</token>
        <example>As vitórias podem ser possíveis.</example>
      </antipattern>
      <pattern>
        <marker>
          <token inflected='yes'>poder</token>
        </marker>  
        <token inflected='yes'>ser</token>
        <token regexp="yes">possível|possíveis</token>        
      </pattern>
      <message>Possível redundância com poder/possível. Substitua por:</message>
      <suggestion><match no='1' postag='VMI.+' postag_regexp='yes'>dever</match></suggestion>
      <example correction="deve">A vitória <marker>pode</marker> ser possível.</example>
    </rule>
Portuguese (Portugal): 8 total matches
Portuguese (Portugal): 582235 total sentences considered
Portuguese (Portugal): ø0.00 rule matches per sentence

Please check if all is okay: 2.txt

Also, if you have any suggestion for the rule name and suggestion message, we could use it.

Thanks!

marcoagpinto commented 2 years ago

https://github.com/languagetool-org/languagetool/commit/27ec76667ed2db2bebd9f27d8072768e3a4553d7

marcoagpinto commented 2 years ago

The pattern could be the verb "poder" and its variants "pode, poderá, poderia, pôde" + ser + possível (also all this, except "ser" in the plural "podem ser possíveis", etc)

The "except "ser" in the plural" confuses me, could you explain better?

Also, I need to add as suggestion: “é possível”, but what about “são possíveis”?

In the 2.txt all sentences use "ser” and not “é”.

marcoagpinto commented 2 years ago

Ahhh... the "é possível" and "são possíveis" is easy to code, I can base the number in "possível/possíveis".

marcoagpinto commented 2 years ago

@ricardojosehlima

https://github.com/languagetool-org/languagetool/commit/6920aeae18113830473e3ecea943db5869d36b9f

3.txt

It now suggests the "é/são possível/possíveis"

marcoagpinto commented 2 years ago

Now it accepts "poder" in infinitive: https://github.com/languagetool-org/languagetool/commit/3dbe4541aa9aec84c328ffea375ac32ca97cc997

ricardojosehlima commented 2 years ago

Good job! And your suggestion is better than mine, it must remain.

marcoagpinto commented 2 years ago

@ricardojosehlima

I must recommit the latest changes as I forgot to update my local copy of grammar.xml and I believe I had damaged the repository.

But I am not sure, I will recommit it tomorrow afternoon.

marcoagpinto commented 2 years ago

or tonight, as I have taken a Xanax and now I feel calm 🤣 🤣 🤣 🤣 🤣 🤣

marcoagpinto commented 2 years ago

@ricardojosehlima

!!!

Xanax and Coca-Cola: https://github.com/languagetool-org/languagetool/commit/3cd9f0762020a0c35422384489fce98a825b4f7f