Date Rule for French (Canada)
Allows dialogue authors to retrieve a date. Dates are composed of three main elements that are always returned by the library: Day, Month, and Year. If some main elements are not mentioned in an utterance, it is derived or assumed by the module based on the context of the utterance and the rule in use. In some cases, other elements are returned by the library, for example, DayOfWeek, AlternativeDay, AlternativeWeek, and AlternativeYear.
The following three types of dates can be retrieved. Future and past dates for each type can be retrieved.
Date Type | Description |
---|---|
Precise Date | A precise date (Day, Month, and Year) for which the elements are either uttered or derived (or assumed) from the context of the utterance. |
U.S. Holiday | The precise date of a U.S. holiday. |
Evaluated Relative Date | The precise date is computed, based on an utterance that contains no specific date elements, and using the context of the utterance. |
Date Recognition Notes:
- Recognizes the phrases "cet an," "l'an dernier," and "l'année prochaine."
- Recognizes "cet/cette," "dernier" and "prochain/prochaine" as qualifiers to date elements (for example, holidays, days, months, years and days of week).
- Recognizes short forms of the year element, for example, "quatre-vingt-dix-huit" is returned as 1998 when the utterance is in the context of the year element.
- Assumes the form mm dd yy for integer date utterances.
- Returns noreco for obvious invalid dates (for example, "février trente").
- Recognizes "février vingt neuf"; however, it will be marked as an invalid date for years that are not leap years. (See the following example.)
Precise Date
Rules
- Date. When the Date rule is activated, the following rules are also activated.
- precise_date
- USHoliday
- evaluated_relative_date
- DateFuture. When the DateFuture rule is activated, the following rules are also activated.
- precise_date_future
- USHoliday_future
- evaluated_relative_date_future
- DatePast. When the DatePast rule is activated, the following rules are also activated.
- precise_date_past
- USHoliday_past
- evaluated_relative_date_past
The Date, DateFuture, and DatePast rules are also exposed to dialogue authors. These rules can be activated in dialogues requiring certain restrictions on the date being retrieved.
Usage
<ruleref uri="cmnrules.cfg#Date" />
<ruleref uri="cmnrules.cfg#DateFuture" />
<ruleref uri="cmnrules.cfg#DatePast" />
Using the DateFuture rule as an example, the grammar can be
<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0"
xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
<rule id="Rule1">
<ruleref uri="cmnrules.cfg#DateFuture" />
<tag>$ = $$</tag>
</rule>
</grammar>
Rules
- precise_date
- precise_date_future. The precise_date_future rule favors future dates if there is any ambiguity. It accepts the exact same set of sentences as rule precise_date.
- precise_date_past. The precise_date_past rule favors past dates if there is any ambiguity. It accepts the exact same set of sentences as rule precise_date.
Usage
<ruleref uri="cmnrules.cfg#precise_date" />
<ruleref uri="cmnrules.cfg#precise_date_future" />
<ruleref uri="cmnrules.cfg#precise_date_past" />
Using the precise_date rule as an example, the grammar can be
<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0"
xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
<rule id="Rule1">
<ruleref uri="cmnrules.cfg#precise_date" />
<tag>$ = $$</tag>
</rule>
</grammar>
JScript Objects
$precise_date.Year : $Year
$precise_date.Month._value : integer
$precise_date.Month._attributes.name : string ("Derived", "Assumed", "Common")
$precise_date.Day._value : integer
$precise_date.Day._attributes.name : string ("Common")
$precise_date._attributes.name : string ("PreciseDate")
Examples: precise_date rule
Example 1
User says: le premier juillet deux mille. All three main elements of the date are recognized.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le premier juillet deux mille" utteranceConfidence="1.000">
<Year confidence="1.000" name="CompleteForm" text="deux mille">2000</Year>
<Month confidence="1.000" text="juillet" name="Common">7</Month>
<Day confidence="1.000" text="le premier" name="Common">1</Day>
</SML>
Example 2
User says: premier mai quatre-vingt-dix-huit All three main elements of the date are recognized.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="premier mai quatre-vingt-dix-huit" utteranceConfidence="1.000">
<Year confidence="1.000" name="ShortForm" text="quatre-vingt-dix-huit">1998</Year>
<Month confidence="1.000" text="mai" name="Common">5</Month>
<Day confidence="1.000" text="premier" name="Common">1</Day>
</SML>
Example 3
User says: le premier juillet Two of the three main elements of the date are recognized. The year returned is the current year.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le premier juillet" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2002</Year>
<Month confidence="1.000" text="juillet" name="Common">7</Month>
<Day confidence="1.000" text="le premier" name="Common">1</Day>
</SML>
Example 4
Assume the current date is Monday, August 19, 2002. User says: le cinq du mois prochain
One of the three main elements of the date is recognized. The year returned is the current year. The month returned is relative to the current month.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le cinq du mois prochain" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000" text="du mois prochain">2002</Year>
<Month confidence="1.000" name="Derived" text="du mois prochain">9</Month>
<Day confidence="1.000" text="cinq" name="Common">5</Day>
</SML>
Example 5
Assume the current date is Wednesday, February 6, 2002. User says: le cinq
One of the three main elements of the date is recognized. The year returned is the current year. The month returned is the current month.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le cinq" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2002</Year>
<Month confidence="1.000" name="Assumed">2</Month>
<Day confidence="1.000" text="cinq" name="Common">5</Day>
</SML>
Example 6
User says: le vingt-neuf février deux mille quatre This is a valid leap year date.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le vingt-neuf février deux mille quatre" utteranceConfidence="1.000">
<Year confidence="1.000" name="CompleteForm" text="deux mille quatre">2004</Year>
<Month confidence="1.000" text="février" name="Common">2</Month>
<Day confidence="1.000" text="vingt-neuf" name="Common">29</Day>
</SML>
Examples: precise_date_future rule
Example 1
Assume the current date is Monday, August 19, 2002. User says: le premier janvier
Two of the three main elements of the date are recognized. Because the active rule favors future dates, the year is returned as the year in which the month next occurs.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le premier janvier" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2003</Year>
<Month confidence="1.000" text="janvier" name="Common">1</Month>
<Day confidence="1.000" text="le premier" name="Common">1</Day>
</SML>
Example 2
Assume the current date is Wednesday, February 6, 2002. User says: le cinq
One of the three main elements of the date is recognized. Because the active rule favors future dates, the month returned is the month in which the day ("the 5th") next occurs. The year returned is the current year.
SML returned by the recognition engine:
<SML confidence="1.000" name="PreciseDate" text="le cinq" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2003</Year>
<Month confidence="1.000" name="Assumed">3</Month>
<Day confidence="1.000" text="cinq" name="Common">5</Day>
</SML>
U.S. Holiday
Recognizes the following U.S. holidays:
le Nouvel An, La Saint-Valentin, la Journée de la Saint-Valentin, la Journée du Président, la Journée Martin Luther King, la Fête américaine des combattants de guerre, le Jour d'indépendance américaine, la Journée Christophe Colomb, la veille de Noël, le Jour de Noël, le Vendredi Saint, le Jour de l'An, Pâques, le Lundi de Pâques, la Fête des Mères, la Fête des Pères, la Fête du Travail, la Journée de l'Action-de-Grace, Noël, la veille du Nouvel An |
Rules
- USHoliday
- USHoliday_future. The USHoliday_future rule favors future dates if there is any ambiguity. It accepts the same set of sentences as the USHoliday rule.
- USHoliday_past. The USHoliday_past rule favors past dates if there is any ambiguity. It accepts the same set of sentences as the USHoliday rule.
Usage
<ruleref uri="cmnrules.cfg#USHoliday" />
<ruleref uri="cmnrules.cfg#USHoliday_future" />
<ruleref uri="cmnrules.cfg#USHoliday_past" />
Using the USHoliday rule as an example, the grammar can be
<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0"
xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
<rule id="Rule1">
<ruleref uri="cmnrules.cfg#USHoliday" />
<tag>$ = $$</tag>
</rule>
</grammar>
JScript Objects
$USHoliday.Year : $Year
$USHoliday.Month._value : integer
$USHoliday.Month._attributes.name : string ("Derived")
$USHoliday.Day._value : integer
$USHoliday.Day._attributes.name : string ("Derived")
$USHoliday.Holiday : string ("Christmas", "Easter", "LaborDay"...)
$USHoliday._attributes.name : string ("Holiday")
Examples: USHoliday
Example 1
Assume the current date is Monday, August 19, 2002. User says: Noël
The USHoliday rule Date Library returns the date of the next Christmas. The USHoliday_future rule would return the same date.
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="Noël" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">12</Month>
<Day name="Derived" confidence="1.000">25</Day>
<Holiday confidence="1.000" text="Noël">Christmas</Holiday>
</SML>
Example 2
Assume the current date is Monday, August 19, 2002. User says: pâques dernier
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="pâques dernier" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">3</Month>
<Day name="Derived" confidence="1.000">31</Day>
<Holiday confidence="1.000" text="pâques">Easter</Holiday>
</SML>
Example 3
Assume the current date is Monday, August 19, 2002. User says: dimanche de pâques l'année prochaine
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="dimanche de pâques l'année prochaine" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2003</Year>
<Month name="Derived" confidence="1.000">4</Month>
<Day name="Derived" confidence="1.000">20</Day>
<Holiday confidence="1.000" text="pâques">Easter</Holiday>
</SML>
Example 4
Assume the current date is Monday, August 19, 2002. User says: cette fête des mères
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="cette fête des mères" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">5</Month>
<Day name="Derived" confidence="1.000">12</Day>
<Holiday confidence="1.000" text="fête des mères">MothersDay</Holiday>
</SML>
Example 5
Assume the current date is Monday, August 19, 2002. User says: la fête du travail l'année prochaine
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="la fête du travail l'année prochaine" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2003</Year>
<Month name="Derived" confidence="1.000">9</Month>
<Day name="Derived" confidence="1.000">1</Day>
<Holiday confidence="1.000" text="la fête du travail">LaborDay</Holiday>
</SML>
Examples: USHoliday_future rule
Example 1
Assume current date is Monday, August 19, 2002. User says: nouvel année
SML returned by the recognition engine:
<SML confidence="1.000" name="Holiday" text="nouvel année" utteranceConfidence="1.000">
<Year name="Assumed" confidence="1.000">2003</Year>
<Month name="Derived" confidence="1.000">1</Month>
<Day name="Derived" confidence="1.000">1</Day>
<Holiday confidence="1.000" text="nouvel année">NewYear</Holiday>
</SML>
Evaluated Relative date
Rules
- evaluated_relative_date
- evaluated_relative_date_future
- evaluated_relative_date_past
Usage
<ruleref uri="cmnrules.cfg#evaluated_relative_date" />
<ruleref uri="cmnrules.cfg#evaluated_relative_date_future" />
<ruleref uri="cmnrules.cfg#evaluated_relative_date_past" />
Using the evaluated_relative_date rule as an example, the grammar can be
<grammar version="1.0" mode="voice" root="Rule1" tag-format="semantics-ms/1.0"
xml:lang="fr-CA" xmlns="http://www.w3.org/2001/06/grammar"
xmlns:sapi="https://schemas.microsoft.com/Speech/2002/06/SRGSExtensions">
<rule id="Rule1">
<ruleref uri="cmnrules.cfg#evaluated_relative_date" />
<tag>$ = $$</tag>
</rule>
</grammar>
JScript Objects
$evaluated_relative_date.Year : $Year
$evaluated_relative_date.Month._value : integer
$evaluated_relative_date.Month._attributes.name : string ("Derived")
$evaluated_relative_date.Day._value : integer
$evaluated_relative_date.Day._attributes.name : string ("Derived")
$evaluated_relative_date._attributes.name : string ("EvaluatedRelativeDate")
$evaluated_relative_date.AlternativeDateCode : string ("Yesterday", "tomorrow")
$evaluated_relative_date.AlternativeYear : $Year
$evaluated_relative_date.AlternativeMonth._value : integer
$evaluated_relative_date.AlternativeMonth._attributes.name : string ("Derived")
$evaluated_relative_date.AlternativeDay._value : integer
$evaluated_relative_date.AlternativeDay._attributes.name : string ("Derived")
Examples: evaluated_relative_date rule
Example 1
Assume the current date is Monday, August 19, 2002. User says: aujourd'hui
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="aujourd'hui" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">19</Day>
</SML>
Example 2
Assume the current date is Monday, August 19, 2002. User says: il y a deux jours
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="il y a deux jours" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">17</Day>
</SML>
Example 3
Assume the current date is Monday, August 19, 2002. User says: mercredi
Because the evaluated_relative_date rule was not provided a preference, the Date rule returns the date for the Wednesday occurring during the same week (Monday through Sunday) as the current date.
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mercredi" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">21</Day>
</SML>
Example 4
Assume the current date is Monday, August 19, 2002. User says: mercredi prochain
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mercredi prochain" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">21</Day>
</SML>
Example 5
Assume the current date is Monday, August 19, 2002. User says: un mois après mercredi prochain
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="un mois après mercredi prochain" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">9</Month>
<Day name="Derived" confidence="1.000">21</Day>
</SML>
Examples: evaluated_relative_date_future rule
Example 1
Assume the current date is Monday, August 19, 2002. User says: mercredi
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mercredi" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">21</Day>
</SML>
Example 2
Assume the current date is Wednesday, August 21, 2002. User says: mercredi
Because the rule is a future rule, the Date ruleset interprets the utterance as referring to the next occurring Wednesday.
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mercredi" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">28</Day>
</SML>
Example 3
Assume the current date is Monday, August 19, 2002. User says: mercredi prochain
The Date ruleset interprets the utterance as referring to the next occurring Wednesday.
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mercredi prochain" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">21</Day>
</SML>
Example 4
Assume current date is Monday, August 19, 2002. User says: mardi prochain
Because the day spoken is so near (in the future) to the current day, the Date ruleset returns the next occurring Tuesday and the Tuesday after as an alternative.
SML returned by the recognition engine:
<SML confidence="1.000" name="EvaluatedRelativeDate" text="mardi prochain" utteranceConfidence="1.000">
<Year name="Derived" confidence="1.000">2002</Year>
<Month name="Derived" confidence="1.000">8</Month>
<Day name="Derived" confidence="1.000">27</Day>
</SML>