Hi
I noticed a bug in the date checking rule:
the \1 \2 (etc) substitutions in message do not
work when they appear after \realDay.
I noticed this while writing the Breton date
rule. I had to change the <message> somehow
to so that \realDay appeared at the end of the
message to make it work.
Here is an example in English to illustrate the
bug. If I change the message to put \realDay
before \3 \4 \6 (etc) inside <message>...</message>
as highlighted in red below...
<rule>
<pattern>
<!-- "Monday, October 7, 2014" -->
<token regexp="yes">&weekdays;</token>
<token>,</token>
<token regexp="yes">&months;|&abbrevMonths;</token>
<token regexp="yes">\d\d?</token>
<token>,</token>
<token regexp="yes">\d\d\d\d</token>
</pattern>
<filter class="org.languagetool.rules.en.DateCheckFilter"
args="year:\6 month:\3 day:\4 weekDay:\1"/>
* <message>\realDay should be the day of the date \3 \4, \6
and not a \1.</message>*
<example type='incorrect'>IGD Convention - <marker>Monday,
October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention -
<marker>Wednesday, October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention -
<marker>Thursday, October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention - <marker>Friday,
October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention -
<marker>Saturday, October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention - <marker>Sunday,
October 7, 2014</marker></example>
<example type='incorrect'>IGD Convention - <marker>Sunday,
Oct 7, 2014</marker></example>
<example type='correct'>IGD Convention - <marker>Tuesday,
October 7, 2014</marker></example>
<example type='correct'>IGD Convention - <marker>Tuesday,
Oct 7, 2014</marker></example>
</rule>
... then this is what happens:
$ echo "Monday, October 7, 2014." | \
java -jar
languagetool/languagetool-standalone/target/LanguageTool-2.7-SNAPSHOT/LanguageTool-2.7-SNAPSHOT/languagetool-commandline.jar
-c utf-8 -l en-US
Expected text language: English (US)
Working on STDIN...
1.) Line 1, column 1, Rule ID: DATE_WEEKDAY[2]
Message: Tuesday should be the day of the date *\3 \4, \6 is not a \1.*
Monday, October 7, 2014.
^^^^^^^^^^^^^^^^^^^^^^^
Time: 2324ms for 1 sentences (0.4 sentences/sec)
Instead of "\3 \4, \6 is not a \1" in the message, I would
have expected to see "October 7, 2014 is not a Tuesday".
Regards
Dominique
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
Languagetool-devel mailing list
Languagetool-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/languagetool-devel