Daniel Naber <daniel.na...@languagetool.org> wrote:

> On 2015-10-14 14:01, Dominique Pellé wrote:
...
>> It would also be useful if each group captured in the regexp
>> could be re-used with \1 \2 \3 etc. (or <match no="1"/> ...)  inside
>> the <message> or <suggestion>.
>
> That's possible already.

Hi

Using mark="1" and \1 does not completely work with <regexp></regexp>.

I recently added the French rule DENUE_DENUDE but I could
not get the suggestion to work, so I commented it out the
suggestion for now.  The rule is...

    <rule id="DENUE_DENUDE" name="dénué et dénudé">
      <regexp mark="1">\b(?:(dénudée?s?) (?:de |d['´‘’′])(?:toute?s?
)?(?:âme|apitoiement|ambigu[ïi]té|ambition|beauté|cause|charme|charisme|clarté|compassion|compétence|confort|connaissance|conscience|consistance|constance|contenu|contrepartie|crainte|créativité|culture|cynisme|difficulté|discrimination|envergure|intér[êe]t|émotion|esthétique|éthique|enjeux?|expertise|fantaisie|fondement|gentillesse|go[uû]t|grâce|haine|humanité|motif|imagination|inspiration|intention|inventivité|légitimité|logique|objectivité|maturité|méchanceté|mérite|paix|piété|plan|pertinence|peur|plaisir|politesse|préjugé|principe|professionnalisme|psychologie|qualité|raison|réalisme|remord|respect|revendication|rigueur|risque|sagesse|savoir|sens|sentiment|science|scrupule|soupçon|stress|sympathie|tact|talent|tendresse|toxicité|tromperie|valeur|vertu|violence|vision)s?)\b</regexp>
      <!-- FIXME: The suggestion does not work somehow. -->
      <!-- <message>Confusion probable entre « \1 » et <suggestion><match
no="1" regexp_match="^(....)"
regexp_replace="dénu"/></suggestion>.</message>
      <example correction="dénué">Un film <marker>dénudé</marker> de tout
intérêt.</example>
      <example correction="dénuée">Une personne <marker>dénudée</marker> de
toute compassion.</example>
      <example correction="dénuée">Une histoire <marker>dénudée</marker>
d’intérêt.</example>
      <example correction="dénués">Des hommes <marker>dénudés</marker> de
compassion.</example>
      -->
      <message>Confusion probable entre « dénudé » et « dénué ».</message>
      <url>http://bdl.oqlf.gouv.qc.ca/bdl/gabarit_bdl.asp?id=2542</url>
      <example correction="">Un film <marker>dénudé</marker> de tout
intérêt.</example>
      <example correction="">Une personne <marker>dénudée</marker> de toute
compassion.</example>
      <example correction="">Une histoire <marker>dénudée</marker>
d’intérêt.</example>
      <example correction="">Des hommes <marker>dénudés</marker> de
compassion.</example>
    </rule>

The rule as above appears to work, it highights only
the expected captured word \1  (i.e. the word dénudé):

$ echo "Un film dénudé de tout intérêt." | java -jar
./languagetool-standalone/target/LanguageTool-3.3-SNAPSHOT/LanguageTool-3.3-SNAPSHOT/languagetool-commandline.jar
-l fr -v
Expected text language: French
Working on STDIN...
2648 rules activated for language French
2648 rules activated for language French
<S> Un[un/D m s] film[film/N m s] dénudé[dénuder/V ppa m s,dénuder/J m s]
de[de/P] tout[tout/N m s] intérêt[intérêt/N m s].[./M fin,</S>]<P/>
Disambiguator log:

un[1]: Un[un/N m s*,un/D m s*] -> Un[un/D m s*]
RP-D_N_AMBIG[1]: Un[un/D m s*] -> Un[un/D m s*]

N[3]: film[film/N m s] -> film[film/N m s]
RP-D_N_AMBIG[1]: film[film/N m s] -> film[film/N m s]

RB-PREPOSITION[1]: de[de/P] -> de[de/P]

N[4]: tout[tout/N m s,tout/D m s,tout/A] -> tout[tout/N m s]

N[3]: intérêt[intérêt/N m s] -> intérêt[intérêt/N m s]

1.) Line 1, column 9, Rule ID: DENUE_DENUDE[1]
Message: Confusion probable entre « dénudé » et « dénué ».
Un film dénudé de tout intérêt.
        ^^^^^^

However, suggestions do not work. If I uncomment the
green part and comment out the red part, I get this:

$ echo "Un film dénudé de tout intérêt." | java -jar
./languagetool-standalone/target/LanguageTool-3.3-SNAPSHOT/LanguageTool-3.3-SNAPSHOT/languagetool-commandline.jar
-l fr -v
Expected text language: French
Working on STDIN...
2648 rules activated for language French
2648 rules activated for language French
<S> Un[un/D m s] film[film/N m s] dénudé[dénuder/V ppa m s,dénuder/J m s]
de[de/P] tout[tout/N m s] intérêt[intérêt/N m s].[./M fin,</S>]<P/>
Disambiguator log:

un[1]: Un[un/N m s*,un/D m s*] -> Un[un/D m s*]
RP-D_N_AMBIG[1]: Un[un/D m s*] -> Un[un/D m s*]

N[3]: film[film/N m s] -> film[film/N m s]
RP-D_N_AMBIG[1]: film[film/N m s] -> film[film/N m s]

RB-PREPOSITION[1]: de[de/P] -> de[de/P]

N[4]: tout[tout/N m s,tout/D m s,tout/A] -> tout[tout/N m s]

N[3]: intérêt[intérêt/N m s] -> intérêt[intérêt/N m s]

1.) Line 1, column 9, Rule ID: DENUE_DENUDE[1]
Message: Confusion probable entre « dénudé » et 'dénudé de tout intérêt'.
Suggestion: dénudé de tout intérêt
Un film dénudé de tout intérêt.
        ^^^^^^

So the correct word is underlined, but the suggestion
is incorrect.  I expected the suggestion "dénué"
but instead I get "dénudé de tout intérêt".

Regards
Dominique
------------------------------------------------------------------------------
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel

Reply via email to