<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="../../../../../../../../../languagetool-core/src/main/resources/org/languagetool/rules/print.xsl" ?>
<?xml-stylesheet type="text/css" href="../../../../../../../../../languagetool-core/src/main/resources/org/languagetool/rules/rules.css"
title="Easy editing stylesheet" ?>
<!--
British English Grammar and Typo Rules for LanguageTool
See tagset.txt for the meaning of the POS tags
Copyright (C) 2012 Marcin Miłkowski (http://www.languagetool.org)

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
USA
-->

<!DOCTYPE rules [
    <!ENTITY hyphen "(?:[-‑])">

    <!ENTITY ambiguous_date '
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes">\d\d\d\d</token>
    '>
    <!-- "7 October 2014" and "7th October 2014" -->
    <!ENTITY date_dmy '
        <token regexp="yes">\d\d?(th)?</token>
        <token regexp="yes">&months;|&abbrevMonths;</token>
        <token regexp="yes">\d\d\d\d</token>
    '>
    <!ENTITY date_dmy_skip '
        <token regexp="yes">\d\d?</token>
        <token regexp="yes">&months;|&abbrevMonths;</token>
        <token regexp="yes" skip="-1">\d\d\d\d</token>
    '>
    <!-- "October 7, 2014" -->
    <!ENTITY date_mdy '
        <token regexp="yes">&months;|&abbrevMonths;</token>
        <token regexp="yes">\d\d?</token>
        <token>,</token>
        <token regexp="yes">\d\d\d\d</token>
    '>
    <!ENTITY date_mdy_skip '
        <token regexp="yes">&months;|&abbrevMonths;</token>
        <token regexp="yes">\d\d?</token>
        <token>,</token>
        <token regexp="yes" skip="-1">\d\d\d\d</token>
    '>
    <!-- "31/10/2014" -->
    <!ENTITY date_dmy_numbers '
        <token regexp="yes">0?[1-9]|[12][0-9]|3[01]</token>
        <token>/</token>
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes">\d\d\d\d</token>
    '>
    <!ENTITY date_dmy_numbers_skip '
        <token regexp="yes">0?[1-9]|[12][0-9]|3[01]</token>
        <token>/</token>
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes" skip="-1">\d\d\d\d</token>
    '>
    <!-- "10/31/2014" -->
    <!ENTITY date_mdy_numbers '
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes">0?[1-9]|[12][0-9]|3[01]</token>
        <token>/</token>
        <token regexp="yes">\d\d\d\d</token>
    '>
    <!ENTITY date_mdy_numbers_skip '
        <token regexp="yes">0?[1-9]|1[0-2]</token>
        <token>/</token>
        <token regexp="yes">0?[1-9]|[12][0-9]|3[01]</token>
        <token>/</token>
        <token regexp="yes" skip="-1">\d\d\d\d</token>
    '>
]>

<rules lang="en-GB" xsi:noNamespaceSchemaLocation="../../../../../../../../../../languagetool-core/src/main/resources/org/languagetool/rules/rules.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <category id="SEMANTICS" name="Semantics" type="inconsistency">
        <rulegroup id="DATE_FUTURE_VERB_PAST_US" name="Future date, but verb in past tense (UK)">
            <rule> <!-- We have visited the client on 27/10/2040 -->
                <pattern>
                    <token inflected="yes" postag="VBD?" postag_regexp="yes" skip="-1">have</token>
                    <token postag="VBN" skip="-1" chunk_re=".-VP">
                        <exception>scheduled</exception>
                        <exception regexp="yes">wed|sat</exception>
                        <exception scope='next' regexp='yes'>before|until|will</exception></token>
                    <marker> &date_dmy_numbers; </marker>
                </pattern>
                <filter class="org.languagetool.rules.en.FutureDateFilter" args="year:\7 month:\5 day:\3"/>
                <message>The given date is in the future, but the verb is in past tense.</message>
                <example correction="">We have visited the client on <marker>27/10/2040</marker>.</example>
                <example correction="">I had already informed the customer on <marker>27/10/2040</marker>.</example>
                <example>We have visited the client on <marker>27/10/2010</marker>.</example>
                <example>I had already informed the customer on <marker>27/10/2010</marker>.</example>
                <example>We will inform the client on 27/10/2010.</example>
                <example>He promised to do it before 30/08/2020.</example>
                <example>The data collected from 8/12/2019 to 8/29/2019 contained a lot of errors.</example><!-- XXX US standard style dates -->
            </rule>
            <rule> <!-- On 27/10/2040, we have visited the client -->
                <pattern>
                    <token>
                        <exception regexp='yes'>before|until</exception></token>
                    <marker> &date_dmy_numbers_skip; </marker>
                    <token inflected="yes" postag="VBD?" postag_regexp="yes" skip="-1">have</token>
                    <token postag="VBN" skip="-1" chunk_re=".-VP">
                        <exception regexp="yes">wed|sat</exception>
                    </token>
                </pattern>
                <filter class="org.languagetool.rules.en.FutureDateFilter" args="year:\6 month:\4 day:\2"/>
                <message>The given date is in the future, but the verb is in past tense.</message>
                <example correction="">On <marker>27/10/2040</marker>, we have visited the client.</example>
                <example correction="">On <marker>27/10/2040</marker>, I had already informed the customer.</example>
                <example>On <marker>27/10/2010</marker>, we have visited the client.</example>
                <example>On <marker>27/10/2010</marker>, I had already informed the customer.</example>
                <example>On 27/10/2010, we will inform the client.</example>
                <example>He promised to do it before 30/08/2020.</example>
            </rule>
            <rule> <!-- We visited the client on 27/10/2040  -->
                <pattern>
                    <token postag="VBD" skip="-1" chunk_re=".-VP">
                        <exception scope='next' regexp='yes'>before|until|will</exception>
                        <exception regexp="yes">wed|sat</exception>
                    </token>
                    <marker> &date_dmy_numbers; </marker>
                </pattern>
                <filter class="org.languagetool.rules.en.FutureDateFilter" args="year:\6 month:\4 day:\2"/>
                <message>The given date is in the future, but the verb is in past tense.</message>
                <example correction="">We visited the client on <marker>27/10/2040</marker>.</example>
                <example correction="">I already informed the customer on <marker>27/10/2040</marker>.</example>
                <example>We visited the client on <marker>27/10/2010</marker>.</example>
                <example>I already informed the customer on <marker>27/10/2010</marker>.</example>
                <example>We will inform the client on 27/10/2010.</example>
                <example>He promised to do it before 30/08/2020.</example>
            </rule>
            <rule> <!-- On 27/10/2040, we visited the client -->
                <pattern>
                    <token>
                        <exception regexp='yes'>before|until</exception></token>
                    <marker> &date_dmy_numbers_skip; </marker>
                    <token postag="VBD" skip="-1" chunk_re=".-VP">
                        <exception regexp="yes">wed|sat</exception>
                    </token>
                </pattern>
                <filter class="org.languagetool.rules.en.FutureDateFilter" args="year:\6 month:\4 day:\2"/>
                <message>The given date is in the future, but the verb is in past tense.</message>
                <example correction="">On <marker>27/10/2040</marker>, we visited the client.</example>
                <example correction="">On <marker>27/10/2040</marker>, I already informed the customer.</example>
                <example>On <marker>27/10/2010</marker>, we visited the client.</example>
                <example>On <marker>27/10/2010</marker>, I already informed the customer.</example>
                <example>On 27/10/2010, we will inform the client.</example>
                <example>He promised to do it before 30/08/2020.</example>
            </rule>
        </rulegroup>
    </category>
</rules>
