European Portuguese (PT-PT) rule contributions

@marcoagpinto

Tested with warnings in testrules.sh.
Suggestions commented out in rule id=“ERRO_DE_CONCORDNCIA_DO_PLURAL_O_OS” until I figure a solution for the warnings.

Code below just needs Crtl-C + Ctrl-V.

<!-- Concordance error plural - AS > A --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-15 --> <rule id="ERRO_DE_CONCORDNCIA_DO_FEMININO_PLURAL_AS_A" name="Erro de concordância do feminino singular"> <pattern> <marker> <token postag='D[AI]0FP0|NCFP000|AQ0FP0' postag_regexp='yes'> <exception postag='CC|CS|RG|RN|SPS00' postag_regexp='yes'></exception></token> <token postag='NCFS000|AQ0FS0' postag_regexp='yes'> <exception postag='P[ID][0123][CFM][SP]000|CC|CS|RG|RN|SPS00' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância do plural. <suggestion><match no="1" postag="(D[AI]0FS0|NCFS000|AQ0FS0)" postag_regexp="yes"/> <match no="2"/></suggestion> ou <suggestion><match no="1"/> <match no="2" postag="(NCFP000|AQ0FP0)" postag_regexp="yes"/></suggestion>. </message> <example correction='A vaca|As vacas'><marker>As vaca</marker> são malhadas.</example> </rule>

<!-- Concordance error plural - A > AS --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-15 --> <rule id="ERRO_DE_CONCORDNCIA_DO_FEMININO_PLURAL_A_AS" name="Erro de concordância do feminino plural"> <pattern> <marker> <token postag='D[AI]0FS0|NCFS000|AQ0FS0' postag_regexp='yes'> <exception postag='CC|CS|RG|RN' postag_regexp='yes'></exception></token> <token postag='NCFP000|AQ0FP0' postag_regexp='yes'> <exception postag='P[ID][0123][CFM][SP]000|CC|CS|RG|RN|SPS00' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância do plural: <suggestion><match no="1" postag="(D[AI]0FP0|NCFP000|AQ0FP0)" postag_regexp="yes"/> <match no="2"/></suggestion> ou <suggestion><match no="1"/> <match no="2" postag="(NCFS000|AQ0FS0)" postag_regexp="yes"/></suggestion>. </message> <example correction='As vacas|A vaca'><marker>A vacas</marker> são malhadas.</example> </rule>

<!-- Concordance error plural - OS > O --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-15 --> <rule id="ERRO_DE_CONCORDNCIA_DO_MASCULINO_PLURAL_OS_O" name="Erro de concordância do masculino plural"> <pattern> <marker> <token postag='D[AI]0MP0|NCMP000|AQ0MP0' postag_regexp='yes'> <exception postag='CC|CS|RG|RN|SPS00' postag_regexp='yes'></exception></token> <token postag='NCMS000|AQ0MS0' postag_regexp='yes'> <exception postag='P[ID][0123][CFM][SP]000|CC|CS|RG|RN|SPS00' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância do plural. <suggestion><match no="1" postag="(D[AI]0MS0|NCMS000|AQ0MS0)" postag_regexp="yes"/> <match no="2"/></suggestion> ou <suggestion><match no="1"/> <match no="2" postag="(NCMP000|AQ0MP0)" postag_regexp="yes"/></suggestion>. </message> <example correction='O cão|Os cães|Os cãos'><marker>Os cão</marker> está no pasto.</example> </rule>

`










Erro de concordância do plural.

  </message>
 <example correction=''><marker>O cães</marker> estão no pasto.</example>
</rule>

`

@tiagosantos

I will commit your rules shortly, but when you have the chance, please try to fix the suggestion issue as it looks bad in the stand-alone tool :frowning:

Also, your:
<!-- DOUBLE FINAL STOP -->
rule doesn’t pass the TESTRULES PT test, and, it is already built-in into LanguageTool so there is no need for the rule.

@tiagosantos

https://github.com/languagetool-org/languagetool/commit/b528690ae92b25be8fa3785d0899365567e8d8ab

Rules committed!

I also added exceptions to my rule: “essa” > “esse”.

<regexp type="exact">[.][.]</regexp> should work (I haven’t tested it).

If a rule fails the test and it still works that means it only works by chance. It might fail with the next update of LT or because of other reasons.

@marcoagpinto

The existing ponctuation rule only suggests a change to a single final stop, not ellipsis. This is just one of a set of other pontuation rules. After I make it comply with testrules.sh I submit the remaining ones.
At least in my built (LO with LT 3.5) the pontuation rules are disabled by default and, even after I ativate them in the options they do not cover all the cases (commas, exclamation marks, hiphens, parentesis, etc.)[quote=“tiagosantos, post:21, topic:1107”]
<!-- <suggestion><match no=“1” postag=“(D[AI]0MP0|NCMP000|AQ0MP0)” postag_regexp=“yes”/> <match no=“2”/></suggestion> ou <suggestion><match no=“1”/> <match no=“2” postag=“(NCMS000|AQ0MS0)” postag_regexp=“yes”/></suggestion>. –>
[/quote]

That line is commented out so it is not used. If it causes problems elsewhere just delete it. I left it there so others can look at it and find the issue (or a possible underlying bug).

Many thanks Marco!.

Great! I will test it a give the feed back.

Sorry for being so argumentative. I am still getting the hang of this and I understand that the standards for inclusion in LT have to be higher than for personal use.

@dnaber
I believe all punctuation rules for dots and such should come built-in in LanguageTool to avoid creating XML rules.

Are there any plans to incorporate them?

Thanks!

The rules should be there, everybody is free to extend them. I don’t have any plans for that.

I was able to test now the stand-alone tool with the changes. It is actually faster to test the changes there.
I have not seen any problem with suggestions to my rules. The one that presented issues does not show suggestions, as I meantioned before.

Can you be more specific about what is the problem you see?

Testing on LT standalone the java pontuation rules work fine. I was only testing on LibreOffice and the problem is there, where XML rules work.

The help screen for that rule will have to remain like that until the bug is found. There is no wrong suggestion presented to the user, so, consider it a non implemented feature, like many others. :wink:

Now I send you verbal concordance rules. Tey were tested in LO and LT. Thanks to Daniel Naber assistance, they now also have URLs explaning the rules.

<!-- Concordance error person - I + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-16 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_1S" name="Erro de concordância do número do verbo"> <pattern> <marker> <token>eu</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][23]S0|VM[CIS][CFIMPS][123]P0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]1S0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Eu passeiam</marker> na praia.</example> </rule>

<!-- Concordance error person - You (Singular) + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-16 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_2S" name="Erro de concordância do número do verbo"> <pattern> <marker> <token>tu</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][13]S0|VM[CIS][CFIMPS][123]P0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]2S0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Tu passeiam</marker> na praia.</example> </rule>

<!-- Concordance error person - He/She/It + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-16 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_3S" name="Erro de concordância do número do verbo"> <pattern> <marker> <token regexp="yes">ele|ela|você</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][12]S0|VM[CIS][CFIMPS][123]P0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]3S0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Ela passeiam</marker> na praia.</example> </rule>

<!-- Concordance error person - We + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-16 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_1P" name="Erro de concordância do número do verbo"> <pattern> <marker> <token>nós</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][23]P0|VM[CIS][CFIMPS][123]S0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]1P0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Nós passeiam</marker> na praia.</example> </rule>

<!-- Concordance error person - You (Plural) + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-15 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_2P" name="Erro de concordância do número do verbo"> <pattern> <marker> <token>vós</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][13]P0|VM[CIS][CFIMPS][123]S0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]2P0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Vós passeiam</marker> na praia.</example> </rule>

<!-- Concordance error person - They + Verb --> <!-- Created by Tiago F. Santos, Portuguese rule, 2016-10-16 --> <rule id="ERRO_DE_CONCORDNCIA_DO_NMERO_DO_VERBO_3P" name="Erro de concordância do número do verbo"> <pattern> <marker> <token regexp="yes">eles|elas|vocês</token> <token min="0" max="2" postag='CS|RG|RN' postag_regexp='yes'/> <token postag='VM[CIS][CFIMPS][12]P0|VM[CIS][CFIMPS][123]S0' postag_regexp='yes'> <exception postag='VM[CIS][CFIMPS]3P0' postag_regexp='yes'></exception></token> </marker> </pattern> <message>Erro de concordância verbal.</message> <url>http://www.infoescola.com/portugues/concordancia-verbal/</url> <example correction=''><marker>Eles passeia</marker> na praia.</example> </rule>

Regarding the corrections, there is indeed, in some cases, a suggestion of “o” being changed to “oo” (not a portuguese dictionary word)

Word “oo” is in the dictionary with postag “NCMP000”.
If this is unacceptable, we need remove this word from the dictionary, or remove “NCMP000” from suggestion like this:
<suggestion><match no="1" postag="(D[AI]0MP0|AQ0MP0)" postag_regexp="yes"/> <match no="2"/></suggestion></message>
and rewrite correction in example.

@Yakov
The Portuguese morphological dictionary is full of typos, just like I said before.

For several times I found wrong suggestions and when I analysed the words, they had incorrect tags in the dictionary.