2015-12-29 22:07 GMT+01:00 Dominique Pellé <dominique.pe...@gmail.com>:
> 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... > [...snip...] > > 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". > I made a change to fix the suggestion in French rule DENUE_DENUDE in this checkin: https://github.com/languagetool-org/languagetool/commit/c5aafc71e1a753c8876f7c110a9ccba906aa49c6 However, it's probably a workaround, as I would normally expect <match no="1" …> in the suggestion to be replaced by the first capture, just like \1. Instead, <match no="1" ...> in suggestion is replaced by the full part that matches the regexp. Regards Dominique
------------------------------------------------------------------------------
_______________________________________________ Languagetool-devel mailing list Languagetool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-devel