languagetool-org / languagetool

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

[pt] De baixo/cima de → Por baixo/cima de #7106

Closed marcoagpinto closed 2 years ago

marcoagpinto commented 2 years ago

@ricardojosehlima

Hello!

Look at this very old rule:

    <rule id='DE_CIMA_DE' name="por cima de">
      <!--      Created by Marco A.G.Pinto, Portuguese rule      -->
      <pattern>
        <marker>
          <token inflected='yes'>passar</token>
          <token>de</token>
          <token regexp='yes'>baixo|cima</token>
          <token>de</token>
        </marker>
      </pattern>
      <message>Substitua por <suggestion>\1 por \3 \4</suggestion>.</message>
      <example correction="passou por cima de">O carro <marker>passou de cima de</marker> uma bola.</example>
    </rule>

Can it accept any verb?

The last “de” could also use da/das/do/dos?

Do you have a better idea for the suggestion message?

❤️ ❤️ ❤️ ❤️ ❤️ ❤️ ❤️

Thank you, dear brother!

ricardojosehlima commented 2 years ago

Hi, Other verbs, not sure: Vou ficar em cima da mesa (not por cima). And yes, do/da/dos/das O gato vai passar por cima dos livros.

marcoagpinto commented 2 years ago

Ahhhh… it is easy to check, I will use all verbs, and we will look at the results to see which ones are valid.

Tonight I will do it.

marcoagpinto commented 2 years ago

@ricardojosehlima

I have improved it: https://github.com/languagetool-org/languagetool/commit/f540cf80ecc5cc46934d4bf4c5a0fda147e3287e

    <!-- DE BAIXO/CIMA DE por baixo/cima de -->
    <rule id='DE_BAIXO_CIMA_DE' name="De baixo/cima de → Por baixo/cima de">
      <!-- Created by Marco A.G.Pinto with Ricardo Joseh Lima suggestions, Portuguese rule 2022-09-20 (Checked/Enhanced) (25-JUL-2022+) -->
      <pattern>
        <token regexp='yes' inflected='yes'>atravessar|correr|ir|passar|transpor|transitar</token>
        <marker>
          <token>de</token>
        </marker>
        <token regexp='yes'>baixo|cima</token>
        <token regexp="yes">d[aeo]s?</token>
      </pattern>
      <message>Neste caso emprega-se 'por' em vez de 'de'.</message>
      <suggestion>por</suggestion>
      <example correction="por">O carro passou <marker>de</marker> cima de uma bola.</example>
    </rule>

I tried with V.+ and all results were false positives:

0_all_false_positives.txt

So, I went to Priberam and typed “atravessar” and it suggested similar verbs, and I used: <token regexp='yes' inflected='yes'>atravessar|correr|ir|passar|transpor|transitar</token>

It gives zero hits in 600 000 sentences, but I believe that these verbs should all do the job.

Thanks!