languagetool-org / languagetool

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

[pt] Issue with pronouns and verbal agreement and comma(!?) #6529

Open ricardojosehlima opened 2 years ago

ricardojosehlima commented 2 years ago

LT correctly corrects the lack of verbal agreement in (1), (2) and (3):

(1) Eles(pl.) pode(sg.) fazer tudo. (2) Nós(pl.) escreve(sg.) aqui. (3) Se os meninos(pl.) pode(sg.), ela também pode.

However, there is something happening when we add a comma after the verb. None of the cases below are corrected: (4) Se eles(pl.) pode(sg.), nós podemos. (5) E se elas(pl.) vai(sg.), nós vamos também. (6) Nós(pl.) pode(sg.), vocês não.

But the comma cannot be the (sole) reason for the problem. The cases below are corrected by LT: (7) As moças(pl.) vai(sg.), a gente fica. (8) Os meninos(pl.) pode(sg.), a gente não.

These two are at the start of the sentence, but (6) also is - however, it has a pronoun...

Maybe there are different things going on. One is the comma, other the pronouns ("eles", "nós")?

marcoagpinto commented 2 years ago

@ricardojosehlima

I have been revising the thesis supervisor document and haven't had time to do anything else in the past hours.

I will have a look at this ticket in this day or in the next.

Sorry for not doing much.

marcoagpinto commented 2 years ago

@ricardojosehlima

This will take some time, since depending on the pronoun it will trigger different rules.

I was looking at one of the rules, and the antipatterns I created years ago are terrible.

I am about to start rewriting the antipatterns, and after I am done with them, I will check the comma issue.

ricardojosehlima commented 2 years ago

Ok! if there's something I can do to help, feel free to ask.

marcoagpinto commented 2 years ago

@ricardojosehlima

I am about to finish rewriting the antipatterns for "eles"/"elas".

What takes longer is the tests.

marcoagpinto commented 2 years ago

@ricardojosehlima

Hello!

Here is the fix: https://github.com/languagetool-org/languagetool/commit/5d1a2e1f03e9c062ca1766cc5cdb93be05a9afb7

It now works with:

(1) Eles pode fazer tudo.
(2) Nós escreve aqui.
(3) Se os meninos pode, ela também pode.

(4) Se eles pode, nós podemos.
(5) E se elas vai, nós vamos também.
(6) Nós pode, vocês não.

Results:

2reference.txt

3.txt

It only produced two new hits if you do a diff:

E o que são estes atos covardes e bárbaros, de onde eles vem, onde acontecem e quais são as suas características, isto é, de que modos eles atuam?
As mãos tentando os nós desapertar, / salpicadas as fitas sobre a fronte / de peçonhenta baba, horrendos gritos / ele vai desferindo, ...

And the second one is a false positive, since "nós" isn't used there as a pronoun.

I have also rewritten and removed several antipattern (WIP).

ricardojosehlima commented 2 years ago

Awesome!