languagetool-org / languagetool

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

[fr] J_N agreement missing spot #5999

Open Rebecca-auque opened 2 years ago

Rebecca-auque commented 2 years ago

Les chats ont leurs propres démarcation territoriale. → Les chats ont leurs propres démarcations territoriales.

jaumeortola commented 2 years ago

To detect the error in this sentence, we need to disable these two antipatterns:

<antipattern>
    <!-- Perhaps better as tags in disambiguation: _GN_... -->
    <unify>
        <feature id="number"/>
        <feature id="gender"/>
        <token postag="[NZ].*" postag_regexp="yes"/>
        <token postag="J.*|V ppa.*" postag_regexp="yes"/>
    </unify>
</antipattern>
<antipattern>
    <!-- Perhaps better as tags in disambiguation: _GN_... -->
    <unify>
        <feature id="number"/>
        <feature id="gender"/>
        <token postag="D.*" postag_regexp="yes"/>
        <!-- <exception regexp="yes">mon|ton|son</exception>-->
        <token postag="N.*" postag_regexp="yes"/>
    </unify>
</antipattern>

This change causes 9 test failures. We could try to fix all those failures, but perhaps it is easier to write a new rule for this kind of errors.

Rebecca-auque commented 2 years ago

Okay, thank you for the explaination. For the time being I just created a rule to solve the specific issue 'leurs propres démarcation'.

jaumeortola commented 2 years ago

I think this new rule D_J_N (the rule J_N but with a determiner before the adjective) will generalize well.

jaumeortola commented 2 years ago

A different approach: create a rule for adjective + noun, but only with adjectives usually found before a noun so that we are sure they are adjectives that have to agree with the next noun. Currently, we have this list in disambiguation.xml: propre|sale|vrai|petit|bon|meilleur|mauvais|nouveau|grand|vieux|long|ancien|haut|seul|beau|superbe @udomai @Rebecca-auque: Could you help me expand this list? It cannot be done with LanguageTool itself because the disambiguation is not good enough. In French, adjectives before noun are less common than in other languages (Spanish). The list doesn't need to be large.

Rebecca-auque commented 2 years ago

Here is a list of some adjectives: important|gentil|méchant|parfait|grave|rare|énorme|lourd|futur|ancien|cher|majeur|simple|joli|mineur|meme|immense|minsucule|lointain|proche|infime|gigantesque|étrange|hideux|ravissant|magnifique|sombre|timide|sympathique|généreux|fidèle|loyal.