I would try it like this: <!-- HÁ n SEGUNDOS/MINUTOS/HORAS/DIAS/SEMANAS/MESES/ANOS ATRÁS (remove "ATRÁS") --> <rule id="HA-ATRAS" name="há n tempo atrás"> <pattern> <token>há</token> <token min="1" max="3"/> <token regexp="yes">segundos?|minutos?|horas?|dias?|semanas?|mês|meses|anos?</token> <marker> <token>atrás</token> </marker> </pattern> <message>Com o verbo haver não é necessário usar "atrás".</message> <example correction="">Há n segundos <marker>atrás</marker>.</example> </rule>
In other words, replace 'atrás' with an empty string. I am not sure if this leaves an undesired space character before the period, though. Also, IIRC rule ids should not contain accented characters. I couldn't test my version though, since I don't have Java installed on this office machine. Am 17.08.2016 um 14:05 schrieb Marco A.G.Pinto: > Thanks, Jan, I use "1" and "3" but TESTRULES PT gives an error in: > <message>Com o verbo haver não é necessário usar "atrás": <suggestion>\1 > \2 \3</suggestion>.</message> > > Can you help? > > Thanks! > > On 17/08/2016 12:36, Jan Schreiber wrote: >> Marco, >> >> I think you could replace >> <token></token> >> from your original version with the following: >> <token min="0" max="3"/> >> (Replace 0 with 1 if necessary.) >> >> Best, >> Jan >> >> Am 17.08.2016 um 13:25 schrieb Marco A.G.Pinto: >>> Yakov, >>> >>> It didn't work. >>> >>> I tried it in the stand-alone tool after using *TESTRULES PT*, with the >>> sentences: >>> *Isso aconteceu à quase 20 anos!** >>> **Isso aconteceu à quase vinte e três anos!** >>> **Há 10 anos atrás** >>> **Há quarenta e dois anos atrás* >>> >>> Rules I changed: >>> * <!-- HÁ n SEGUNDOS/MINUTOS/HORAS/DIAS/SEMANAS/MESES/ANOS ATRÁS >>> (remove "ATRÁS") -->** >>> ** <rule id="HÁ-ATRÁS" name="há n tempo atrás">** >>> ** <pattern>** >>> ** <token skip="1">há</token>** >>> ** <token skip="1"></token>** >>> ** <token >>> regexp="yes">segundos?|minutos?|horas?|dias?|semanas?|mês|meses|anos?</token>** >>> ** <token>atrás</token>** >>> ** </pattern>** >>> ** <message>Com o verbo haver não é necessário usar "atrás": >>> <suggestion>\1 \2 \3</suggestion>.</message>** >>> ** <example correction="Há n segundos"><marker>Há n segundos >>> atrás</marker>.</example>** >>> ** </rule>** >>> ** >>> ** >>> ** ** >>> ** <!-- À QUASE há quase -->** >>> ** <rule id="À_QUASE" name="há quase">** >>> ** <pattern>** >>> ** <marker>** >>> ** <token>à</token> ** >>> ** </marker> ** >>> ** <token skip="1">quase</token> ** >>> ** <token skip="1"></token>** >>> ** <token >>> regexp="yes">segundos?|minutos?|horas?|dias?|semanas?|mês|meses|anos?</token>** >>> ** </pattern>** >>> ** <message>Substituir «à» por <suggestion>há</suggestion>.</message>** >>> ** <example correction="há">Conheço a Ana <marker>à</marker> quase >>> 30 anos.</example>** >>> ** </rule> * >>> >>> >>> Thanks! >>> >>> Kind regards, >>> >Marco A.G.Pinto >>> ----------------------- >>> >>> >>> On 17/08/2016 11:35, Yakov Reztsov wrote: >>>> Hello! >>>> One of the options is add *skip="1":* >>>> >>>> <!-- HÁ n SEGUNDOS/MINUTOS/HORAS/DIAS/SEMANAS/MESES/ANOS ATRÁS (remove >>>> "ATRÁS") --> >>>> <rule id="HÁ-ATRÁS" name="há n tempo atrás"> >>>> <pattern> >>>> <token skip="1">há</token> >>>> <token skip="1" ></token> >>>> <token >>>> regexp="yes">segundos?|minutos?|horas?|dias?|semanas?|mês|meses|anos?</token> >>>> <token>atrás</token> >>>> </pattern> >>>> <message>Com o verbo haver não é necessário usar "atrás": >>>> <suggestion>\1 \2 \3</suggestion>.</message> >>>> <example correction="Há n segundos"><marker>Há n segundos >>>> atrás</marker>.</example> >>>> </rule> >>>> >>>> Среда, 17 августа 2016, 10:59 +03:00 от "Marco A.G.Pinto" <>: >>>> >>>> Hello! >>>> >>>> I want to improve the following rule: >>>> >>>> * <!-- HÁ n SEGUNDOS/MINUTOS/HORAS/DIAS/SEMANAS/MESES/ANOS >>>> ATRÁS (remove "ATRÁS") -->** >>>> ** <rule id="HÁ-ATRÁS" name="há n tempo atrás">** >>>> ** <pattern>** >>>> ** <token>há</token>** >>>> ** <token></token>** >>>> ** <token >>>> >>>> regexp="yes">segundos?|minutos?|horas?|dias?|semanas?|mês|meses|anos?</token>** >>>> ** <token>atrás</token>** >>>> ** </pattern>** >>>> ** <message>Com o verbo haver não é necessário usar "atrás": >>>> <suggestion>\1 \2 \3</suggestion>.</message>** >>>> ** <example correction="Há n segundos"><marker>Há n segundos >>>> atrás</marker>.</example>** >>>> ** </rule>* >>>> >>>> >>>> I want the token after "há" to accept up to three words. >>>> >>>> For example: >>>> "há *vinte e três* dias atrás" >>>> >>>> What changes shall I make? >>>> >>>> Thanks! >>>> >>>> Kind regards, >>>> >Marco A.G.Pinto >>>> ----------------------- >>>> >>>> -- >>>> >>>> >>>> -- >>>> >>>> Yakov Reztsov >>> -- >>> >>> > > > -- > > > ------------------------------------------------------------------------------ > > > > _______________________________________________ > Languagetool-devel mailing list > Languagetool-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/languagetool-devel > ------------------------------------------------------------------------------ _______________________________________________ Languagetool-devel mailing list Languagetool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/languagetool-devel