<commit_before><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../print.xsl" 
title="Pretty print" ?>
<?xml-stylesheet type="text/css" href="../rules.css" 
title="Easy editing stylesheet" ?>

<!--
 Portuguese (Portugal - postreform) - Grammar and Typo Rules for LanguageTool.

 Copyright © 2016-2017 <NAME> (<EMAIL>)
 Copyright © 2016-2017 <NAME> (www.marcoagpinto.com)

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA

-->

<!DOCTYPE rules [

    <!ENTITY contracoes_MS "ao|do|dum|dele|deste|desse|daquele|disto|disso|daquilo|doutro|no|num|nele|nesse|neste|naquele|nisto|nisso|naquilo|noutro|pelo|algum|mo|to|lho">
    <!ENTITY contracoes_FS "à|da|duma|dela|desta|dessa|daquela|doutra|na|numa|nela|nessa|nesta|naquela|noutra|pela|alguma|ma|ta|lha">
    <!ENTITY contracoes_MP "aos|dos|duns|deles|destes|desses|daqueles|doutros|nos|nuns|neles|nesses|nestes|naqueles|noutros|pelos|alguns|mos|tos|lhos">
    <!ENTITY contracoes_FP "às|das|dumas|delas|destas|dessas|daquelas|doutras|nas|numas|nelas|nessas|nestas|naquelas|noutras|pelas|algumas|mas|tas|lhas">

    <!ENTITY PP_nao_ambiguos "ma|me|mo|mos|ta|te|to|tas|tes|tos|lha|lhe|lho|lhas|lhes|lhos|vos">
    
    <!ENTITY negacoes "não|nunca|ninguém|nada|jamais">

]>
<rules lang="pt" xsi:noNamespaceSchemaLocation="../rules.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- Unification rules retrieved from galician grammar.xml - START-->
    <unification feature="number">
        <equivalence type="singular">
            <token postag="(N..|[ADP]...|V....)S.*" postag_regexp="yes"/>
        </equivalence>

        <equivalence type="plural">
            <token postag="(N..|[ADP]...|V....)P.*" postag_regexp="yes"/>
        </equivalence>
    </unification>

    <unification feature="gender">
        <equivalence type="masc">
            <token postag="(N.|[ADP]..|V...)[MC].*" postag_regexp="yes"/>
        </equivalence>

        <equivalence type="fem">
            <token postag="(N.|[ADP]..|V...)[FC].*" postag_regexp="yes"/>
        </equivalence>
    </unification>

    <unification feature="person">
        <equivalence type="first">
            <token postag="(V...|PP)1.*" postag_regexp="yes"/>
        </equivalence>
        <equivalence type="second">
            <token postag="(V...|PP)2.*" postag_regexp="yes"/>
        </equivalence>
        <equivalence type="third">
            <token postag="(V...|PP)3.*" postag_regexp="yes"/>
        </equivalence>
    </unification>
<!-- Unification rules retrieved from galician grammar.xml - END  -->

<category id="EUROPEAN_PORTUGUESE" name="Português de Portugal">

    <!-- TODO Create a category just for AO45 and another for AO90 as pre-work for switchable settings -->
    <!-- AVÉ, MARIA ave, Maria -->
	<!-- Created by <NAME>, Portuguese rule, 2017-01-09 -->
    <rule id="AVÉ_MARIA" name="AO90: ave Maria">
      <pattern>
		<marker>
			<token>avé</token>
		</marker>	
		<token min="0">,</token>
		<token>Maria</token>
		<token>,</token>
		<token>cheia</token>
		<token>de</token>
		<token>graça</token>
		</pattern>
      <message>Segundo o AO90, deve substituir por <suggestion>ave</suggestion>.</message>
      <example correction="Ave"><marker>Avé</marker>, Maria, cheia de graça.</example>
    </rule>

	<!-- COMPOSTAS Colocações pronominais com três termos	       -->
	<!-- Created by  <NAME> , Portuguese rule, 2016-11-04 -->
  <rule id='HIFENIZADOR_VERBOS_1' name='Colocações pronominais três termos'>
    <pattern>
		<token postag='V.*' postag_regexp='yes'>
			<exception regexp='yes'>como|para|casa</exception></token>
		<token regexp='yes'>m[aeo]s?|t[aeo]s?|s[aeo]|lh[aeo]s?|n[ao]s|vos</token>
		<token regexp='yes'>á|ão|ás|ei|eis|emos|ia|iam|íamos|ias|íeis</token>
    </pattern>
	<message>Palavra composta. Será que quis dizer:</message><suggestion>\1-\2-\3</suggestion>
	<url>https://pt.wikipedia.org/wiki/Coloca%C3%A7%C3%A3o_pronominal</url>
	<example correction='dar-nos-á'>A vida <marker>dar nos á</marker> sempre mais do que achamos que merecemos.</example>
  </rule>


	<!-- COMPOSTAS Colocações pronominais com dois termos	       -->
	<!-- Created by  <NAME> , Portuguese rule, 2016-11-04 -->
  <rulegroup id='HIFENIZADOR_VERBOS_2' name='Colocações pronominais dois termos'>
	<!-- 		Brazilian Portuguese has inverted colocations  -->
   <rule>
    <antipattern>
    		<token regexp='yes'>&negacoes;</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <antipattern>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.[PG].*' postag_regexp='yes'></token>
    </antipattern>
    <pattern>
		<token postag='V.*' postag_regexp='yes'></token>
		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
	<!--NOTE DO NOT INCLUDE a,o,as,os,se,nos,nas,mas. They produce too many
			false positives (Determinants & Contractions)  -->
    </pattern>
	<message>Palavra composta. Será que quis dizer:</message>
	  <suggestion>\1-\2 \3</suggestion>
	  <suggestion>\1 \3-\2</suggestion>
	<url>https://pt.wikipedia.org/wiki/Coloca%C3%A7%C3%A3o_pronominal</url>
	<example correction='vou-te dar|vou dar-te'>Eu <marker>vou te dar</marker> um laptop.</example>
	<example type='correct'>Ela pode ter-me visto na festa.</example>
  </rule>
  <rule>
    <antipattern>
    		<token regexp='yes'>&negacoes;</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <antipattern>
    		<token>-</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
    		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <pattern>
		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
	<!--NOTE DO NOT INCLUDE a,o,as,os,se,nos,nas,mas. They produce too many<commit_msg>[pt-PT] exceptions added<commit_after><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../print.xsl" 
title="Pretty print" ?>
<?xml-stylesheet type="text/css" href="../rules.css" 
title="Easy editing stylesheet" ?>

<!--
 Portuguese (Portugal - postreform) - Grammar and Typo Rules for LanguageTool.

 Copyright © 2016-2017 <NAME> (<EMAIL>)
 Copyright © 2016-2017 <NAME> (www.marcoagpinto.com)

 This library is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

 This library is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public
 License along with this library; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA

-->

<!DOCTYPE rules [

    <!ENTITY contracoes_MS "ao|do|dum|dele|deste|desse|daquele|disto|disso|daquilo|doutro|no|num|nele|nesse|neste|naquele|nisto|nisso|naquilo|noutro|pelo|algum|mo|to|lho">
    <!ENTITY contracoes_FS "à|da|duma|dela|desta|dessa|daquela|doutra|na|numa|nela|nessa|nesta|naquela|noutra|pela|alguma|ma|ta|lha">
    <!ENTITY contracoes_MP "aos|dos|duns|deles|destes|desses|daqueles|doutros|nos|nuns|neles|nesses|nestes|naqueles|noutros|pelos|alguns|mos|tos|lhos">
    <!ENTITY contracoes_FP "às|das|dumas|delas|destas|dessas|daquelas|doutras|nas|numas|nelas|nessas|nestas|naquelas|noutras|pelas|algumas|mas|tas|lhas">

    <!ENTITY PP_nao_ambiguos "ma|me|mo|mos|ta|te|to|tas|tes|tos|lha|lhe|lho|lhas|lhes|lhos|vos">
    
    <!ENTITY negacoes "não|nunca|ninguém|nada|jamais">

]>
<rules lang="pt" xsi:noNamespaceSchemaLocation="../rules.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- Unification rules retrieved from galician grammar.xml - START-->
    <unification feature="number">
        <equivalence type="singular">
            <token postag="(N..|[ADP]...|V....)S.*" postag_regexp="yes"/>
        </equivalence>

        <equivalence type="plural">
            <token postag="(N..|[ADP]...|V....)P.*" postag_regexp="yes"/>
        </equivalence>
    </unification>

    <unification feature="gender">
        <equivalence type="masc">
            <token postag="(N.|[ADP]..|V...)[MC].*" postag_regexp="yes"/>
        </equivalence>

        <equivalence type="fem">
            <token postag="(N.|[ADP]..|V...)[FC].*" postag_regexp="yes"/>
        </equivalence>
    </unification>

    <unification feature="person">
        <equivalence type="first">
            <token postag="(V...|PP)1.*" postag_regexp="yes"/>
        </equivalence>
        <equivalence type="second">
            <token postag="(V...|PP)2.*" postag_regexp="yes"/>
        </equivalence>
        <equivalence type="third">
            <token postag="(V...|PP)3.*" postag_regexp="yes"/>
        </equivalence>
    </unification>
<!-- Unification rules retrieved from galician grammar.xml - END  -->

<category id="EUROPEAN_PORTUGUESE" name="Português de Portugal">

    <!-- TODO Create a category just for AO45 and another for AO90 as pre-work for switchable settings -->
    <!-- AVÉ, MARIA ave, Maria -->
	<!-- Created by <NAME>, Portuguese rule, 2017-01-09 -->
    <rule id="AVÉ_MARIA" name="AO90: ave Maria">
      <pattern>
		<marker>
			<token>avé</token>
		</marker>	
		<token min="0">,</token>
		<token>Maria</token>
		<token>,</token>
		<token>cheia</token>
		<token>de</token>
		<token>graça</token>
		</pattern>
      <message>Segundo o AO90, deve substituir por <suggestion>ave</suggestion>.</message>
      <example correction="Ave"><marker>Avé</marker>, Maria, cheia de graça.</example>
    </rule>

	<!-- COMPOSTAS Colocações pronominais com três termos	       -->
	<!-- Created by  <NAME> , Portuguese rule, 2016-11-04 -->
  <rule id='HIFENIZADOR_VERBOS_1' name='Colocações pronominais três termos'>
    <pattern>
		<token postag='V.*' postag_regexp='yes'>
			<exception regexp='yes'>como|para|casa|nada</exception></token>
		<token regexp='yes'>m[aeo]s?|t[aeo]s?|s[aeo]|lh[aeo]s?|n[ao]s|vos</token>
		<token regexp='yes'>á|ão|ás|ei|eis|emos|ia|iam|íamos|ias|íeis</token>
    </pattern>
	<message>Palavra composta. Será que quis dizer:</message><suggestion>\1-\2-\3</suggestion>
	<url>https://pt.wikipedia.org/wiki/Coloca%C3%A7%C3%A3o_pronominal</url>
	<example correction='dar-nos-á'>A vida <marker>dar nos á</marker> sempre mais do que achamos que merecemos.</example>
  </rule>


	<!-- COMPOSTAS Colocações pronominais com dois termos	       -->
	<!-- Created by  <NAME> , Portuguese rule, 2016-11-04 -->
  <rulegroup id='HIFENIZADOR_VERBOS_2' name='Colocações pronominais dois termos'>
	<!-- 		Brazilian Portuguese has inverted colocations  -->
   <rule>
    <antipattern>
    		<token regexp='yes'>&negacoes;</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <antipattern>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.[PG].*' postag_regexp='yes'></token>
    </antipattern>
    <pattern>
		<token postag='V.*' postag_regexp='yes'>
			<exception regexp='yes'>como|para|casa|nada</exception></token>
		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
	<!--NOTE DO NOT INCLUDE a,o,as,os,se,nos,nas,mas. They produce too many
			false positives (Determinants & Contractions)  -->
    </pattern>
	<message>Palavra composta. Será que quis dizer:</message>
	  <suggestion>\1-\2 \3</suggestion>
	  <suggestion>\1 \3-\2</suggestion>
	<url>https://pt.wikipedia.org/wiki/Coloca%C3%A7%C3%A3o_pronominal</url>
	<example correction='vou-te dar|vou dar-te'>Eu <marker>vou te dar</marker> um laptop.</example>
	<example type='correct'>Ela pode ter-me visto na festa.</example>
  </rule>
  <rule>
    <antipattern>
    		<token regexp='yes'>&negacoes;</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <antipattern>
    		<token>-</token>
    		<token regexp='yes'>&PP_nao_ambiguos;</token>
    		<token postag='V.*' postag_regexp='yes'></token>
    </antipattern>
    <pattern>
		<token regexp='yes'>&PP_nao_ambiguos;</token>
		<token postag='V.*' postag_regexp='yes'></token>
	<!--NOTE DO NOT INCLUDE a,o,as,os,se,nos,nas,mas. They produce too many
{'fraction_non_alphanumeric': 0.1745697753062298, 'fraction_numerical': 0.0145787931164049, 'mean_word_length': 4.087155963302752, 'pattern_counts': {'":': 0, '<': 343, '<?xml version=': 2, '>': 341, 'https://': 4, 'lorem ipsum': 0, 'www.': 6, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5111881', 'n_tokens_mistral': 5193, 'n_tokens_neox': 4861, 'n_words': 953}