languagetool icon indicating copy to clipboard operation
languagetool copied to clipboard

[pt] Rule idea: “dar exemplo” → “exemplificar” — 2024-01-07

Open marcoagpinto opened this issue 1 year ago • 2 comments

Hello @ricardojosehlima

I was so eager at it that I created another rule.

My concern is if it should work with plural: <token regexp='yes'>um|uns|algum|alguns</token> or only singular: <token regexp='yes'>um|algum</token>

If it works with plural, then all results are valid, I believe:

Portuguese (Portugal): 24 total matches
Portuguese (Portugal): 811131 total sentences considered
Portuguese (Portugal): ø0.00 rule matches per sentence

2.txt

       <rulegroup id='DAR_EXEMPLO_EXEMPLIFICAR' name="Simplificar: 'Dar exemplo' → exemplificar" default="temp_off">
            <!-- IDEA shorten_it -->

            <!-- #1 - Without d[ao]s? -->
            <rule>
                <pattern>
                    <marker>
                        <token inflected='yes'>dar</token>
                        <token regexp='yes'>um|uns|algum|alguns</token>
                        <token regexp='yes'>exemplos?</token>
                    </marker>
                    <token postag='_PUNCT|SPS00|CC|CS' postag_regexp='yes'/>
                </pattern>
                <message>&simplify_msg;</message>
                <suggestion><match no='1' postag='V.+' postag_regexp='yes'>exemplificar</match></suggestion>
                <example correction="exemplificou">A Ana <marker>deu um exemplo</marker>.</example>
            </rule>

            <!-- #2 - With d[ao]s? -->
            <rule>
                <pattern>
                    <marker>
                        <token inflected='yes'>dar</token>
                        <token regexp='yes'>um|uns|algum|alguns</token>
                        <token regexp='yes'>exemplos?</token>
                        <token regexp='yes'>d[ao]s?</token>
                    </marker>
                </pattern>
                <message>&simplify_msg;</message>
                <suggestion><match no='1' postag='V.+' postag_regexp='yes'>exemplificar</match> <match no='4' postag='SPS00:DA0(..)0' postag_replace='DA0$10'>o</match></suggestion>
                <example correction="exemplificou a">A Ana <marker>deu um exemplo da</marker> equação.</example>
                <example correction="exemplificou o">O Rui <marker>deu um exemplo do</marker> problema.</example>
            </rule>

        </rulegroup>

Thanks!

😛 😛 😛 😛 😛 😛

marcoagpinto avatar Jan 07 '24 09:01 marcoagpinto

Looks cool! But for pt-br it serves for formal, academic and so on

ricardojosehlima avatar Jan 07 '24 22:01 ricardojosehlima

Thank you, my dear Brother Ricardo!

❤️ ❤️ ❤️ ❤️ ❤️

marcoagpinto avatar Jan 08 '24 05:01 marcoagpinto