diff --git a/__init__.py b/__init__.py index 3b79933e..ab83435a 100644 --- a/__init__.py +++ b/__init__.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import calendar import datetime import os import re @@ -28,6 +29,7 @@ from ovos_utils.time import now_local, get_next_leap_year from ovos_utterance_normalizer import UtteranceNormalizerPlugin from ovos_workshop.decorators import intent_handler +from ovos_workshop.resource_files import ResourceFile from ovos_workshop.skills import OVOSSkill from timezonefinder import TimezoneFinder @@ -216,6 +218,48 @@ def _mentions_current_weekend(self, utterance: str) -> bool: normalized_utterance = utterance.casefold() return any(phrase in normalized_utterance for phrase in current_weekend_phrases) + def _load_cached_entity(self, name: str): + """Load and cache a locale entity resource.""" + cache_key = f"{self.lang}:{name}.entity" + if cache_key not in self.resources.static: + entity_resource = ResourceFile(self.resources.types.entity, name) + values = [] + if entity_resource.file_path: + with open(entity_resource.file_path, encoding="utf-8") as f: + for line in f: + line = line.strip() + if line and not line.startswith("#"): + values.append(line) + self.resources.static[cache_key] = values + return self.resources.static[cache_key] + + def _get_requested_weekday(self, message): + """Extract the requested weekday from intent-matched entities.""" + weekday_name = (message.data.get("weekday") or "").strip().lower() + if not weekday_name: + return None + + weekdays = [day.lower() for day in self._load_cached_entity("weekday")] + try: + weekday_index = weekdays.index(weekday_name) + except ValueError: + return None + return weekday_index, self._render_weekday(weekday_index) + + def _render_weekday(self, weekday_index: int) -> str: + """Render a localized weekday from a weekday index.""" + reference_monday = datetime.datetime(2024, 1, 1) + return nice_weekday(reference_monday + datetime.timedelta(days=weekday_index), + lang=self.lang) + + def _get_leap_year_query_scope(self, utterance: str) -> str: + """Return whether the user asked about the current, next, or either year.""" + if self.voc_match(utterance, "leap.year.scope.either", lang=self.lang): + return "either" + if self.voc_match(utterance, "leap.year.scope.next", lang=self.lang): + return "next" + return "current" + @staticmethod def _get_timezone_from_builtins(location_string: str) -> Optional[datetime.tzinfo]: """Attempt to resolve a timezone from a location name using geocoding. @@ -474,7 +518,7 @@ def handle_query_date(self, message, response_type="simple"): now = self.get_datetime() # session aware try: dt, utt = extract_datetime(utt, anchorDate=now, lang=self.lang) or (now, utt) - except Exception as e: + except Exception: self.log.exception(f"failed to extract date from '{utt}'") dt = now @@ -565,17 +609,56 @@ def handle_weekday(self, message): anchorDate=now, lang=self.lang) or (None, None) if not dt: self.speak_dialog("extract.date.error") + return + + if dt >= now: + dialog = "weekday.at.date.future" else: - if dt >= now: - dialog = "weekday.at.date.future" - else: - dialog = "weekday.at.date.past" - # TODO - "today" should never trigger this intent, but if it does, - # should we handle it better? nice_date will return "today" in that case - self.speak_dialog(dialog, { + dialog = "weekday.at.date.past" + # TODO - "today" should never trigger this intent, but if it does, + # should we handle it better? nice_date will return "today" in that case + self.speak_dialog(dialog, { "date": nice_date(dt, lang=self.lang, now=now), "weekday": nice_weekday(dt, lang=self.lang)}) + @intent_handler("weekday.matches.date.intent") + def handle_weekday_match(self, message): + """Handle yes/no questions about whether a date matches a weekday.""" + now = self.get_datetime() # session aware + utterance = message.data.get("utterance", "") + weekday = self._get_requested_weekday(message) + dt, _ = extract_datetime(message.data.get("date") or utterance, + anchorDate=now, lang=self.lang) or (None, None) + if not dt or weekday is None: + self.speak_dialog("extract.date.error") + return + + expected_weekday, expected_name = weekday + data = { + "date": nice_date(dt, lang=self.lang, now=now), + "weekday": expected_name, + "actual_weekday": nice_weekday(dt, lang=self.lang) + } + if dt.date() > now.date(): + dialog = ( + "weekday.matches.date.future.yes" + if dt.weekday() == expected_weekday + else "weekday.matches.date.future.no" + ) + elif dt.date() == now.date(): + dialog = ( + "weekday.matches.date.today.yes" + if dt.weekday() == expected_weekday + else "weekday.matches.date.today.no" + ) + else: + dialog = ( + "weekday.matches.date.past.yes" + if dt.weekday() == expected_weekday + else "weekday.matches.date.past.no" + ) + self.speak_dialog(dialog, data) + @intent_handler("what.month.is.it.intent") def handle_current_month(self, message): """ @@ -660,6 +743,42 @@ def handle_query_next_leap_year(self, message): next_leap_year = get_next_leap_year(year) self.speak_dialog('next.leap.year', {'year': next_leap_year}) + @intent_handler("is.leap.year.intent") + def handle_is_leap_year(self, message): + """Handle yes/no questions about leap years.""" + utterance = message.data.get("utterance", "") + now = self.get_datetime() + current_year = now.year + next_year = current_year + 1 + scope = self._get_leap_year_query_scope(utterance) + + if scope == "either": + if calendar.isleap(current_year): + self.speak_dialog("leap.year.either.yes", + {"year": current_year}) + elif calendar.isleap(next_year): + self.speak_dialog("leap.year.either.yes", + {"year": next_year}) + else: + self.speak_dialog("leap.year.either.no", + {"year": get_next_leap_year(next_year + 1)}) + return + + if scope == "next": + if calendar.isleap(next_year): + self.speak_dialog("leap.year.next.yes", {"year": next_year}) + else: + self.speak_dialog("leap.year.next.no", + {"year": get_next_leap_year(next_year)}) + return + + if calendar.isleap(current_year): + self.speak_dialog("leap.year.current.yes", + {"year": current_year}) + else: + self.speak_dialog("leap.year.current.no", + {"year": get_next_leap_year(current_year)}) + ###################################################################### # GUI / Faceplate def show_date(self, dt: datetime.datetime, location: str): diff --git a/locale/en-US/dialog/leap.year.current.no.dialog b/locale/en-US/dialog/leap.year.current.no.dialog new file mode 100644 index 00000000..e7e5e501 --- /dev/null +++ b/locale/en-US/dialog/leap.year.current.no.dialog @@ -0,0 +1 @@ +No, {year} is not a leap year. diff --git a/locale/en-US/dialog/leap.year.current.yes.dialog b/locale/en-US/dialog/leap.year.current.yes.dialog new file mode 100644 index 00000000..8c157e47 --- /dev/null +++ b/locale/en-US/dialog/leap.year.current.yes.dialog @@ -0,0 +1 @@ +Yes, {year} is a leap year. diff --git a/locale/en-US/dialog/leap.year.either.no.dialog b/locale/en-US/dialog/leap.year.either.no.dialog new file mode 100644 index 00000000..a26eac77 --- /dev/null +++ b/locale/en-US/dialog/leap.year.either.no.dialog @@ -0,0 +1 @@ +No. The next leap year after that will be {year}. diff --git a/locale/en-US/dialog/leap.year.either.yes.dialog b/locale/en-US/dialog/leap.year.either.yes.dialog new file mode 100644 index 00000000..8c157e47 --- /dev/null +++ b/locale/en-US/dialog/leap.year.either.yes.dialog @@ -0,0 +1 @@ +Yes, {year} is a leap year. diff --git a/locale/en-US/dialog/leap.year.next.no.dialog b/locale/en-US/dialog/leap.year.next.no.dialog new file mode 100644 index 00000000..0f49055e --- /dev/null +++ b/locale/en-US/dialog/leap.year.next.no.dialog @@ -0,0 +1 @@ +No, {year} will not be a leap year. diff --git a/locale/en-US/dialog/leap.year.next.yes.dialog b/locale/en-US/dialog/leap.year.next.yes.dialog new file mode 100644 index 00000000..5fa6d854 --- /dev/null +++ b/locale/en-US/dialog/leap.year.next.yes.dialog @@ -0,0 +1 @@ +Yes, {year} will be a leap year. diff --git a/locale/en-US/dialog/weekday.matches.date.future.no.dialog b/locale/en-US/dialog/weekday.matches.date.future.no.dialog new file mode 100644 index 00000000..b6180a6b --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.future.no.dialog @@ -0,0 +1 @@ +No, {date} will be {actual_weekday}, not {weekday}. diff --git a/locale/en-US/dialog/weekday.matches.date.future.yes.dialog b/locale/en-US/dialog/weekday.matches.date.future.yes.dialog new file mode 100644 index 00000000..bf5fbc05 --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.future.yes.dialog @@ -0,0 +1 @@ +Yes, {date} will be {weekday}. diff --git a/locale/en-US/dialog/weekday.matches.date.past.no.dialog b/locale/en-US/dialog/weekday.matches.date.past.no.dialog new file mode 100644 index 00000000..c9594c1d --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.past.no.dialog @@ -0,0 +1 @@ +No, {date} was {actual_weekday}, not {weekday}. diff --git a/locale/en-US/dialog/weekday.matches.date.past.yes.dialog b/locale/en-US/dialog/weekday.matches.date.past.yes.dialog new file mode 100644 index 00000000..cbc0302e --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.past.yes.dialog @@ -0,0 +1 @@ +Yes, {date} was {weekday}. diff --git a/locale/en-US/dialog/weekday.matches.date.today.no.dialog b/locale/en-US/dialog/weekday.matches.date.today.no.dialog new file mode 100644 index 00000000..55c3620e --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.today.no.dialog @@ -0,0 +1 @@ +No, {date} is {actual_weekday}, not {weekday}. diff --git a/locale/en-US/dialog/weekday.matches.date.today.yes.dialog b/locale/en-US/dialog/weekday.matches.date.today.yes.dialog new file mode 100644 index 00000000..d4a95fc4 --- /dev/null +++ b/locale/en-US/dialog/weekday.matches.date.today.yes.dialog @@ -0,0 +1 @@ +Yes, {date} is {weekday}. diff --git a/locale/en-US/intents/is.leap.year.intent b/locale/en-US/intents/is.leap.year.intent new file mode 100644 index 00000000..33f0ee23 --- /dev/null +++ b/locale/en-US/intents/is.leap.year.intent @@ -0,0 +1,4 @@ +is next year a leap year +is this year a leap year +is this year a leap year or next +is this year a leap year or the next one diff --git a/locale/en-US/intents/next.leap.year.intent b/locale/en-US/intents/next.leap.year.intent index dad67101..27d6fcbd 100644 --- a/locale/en-US/intents/next.leap.year.intent +++ b/locale/en-US/intents/next.leap.year.intent @@ -1,9 +1,5 @@ can you tell me when next leap year is can you tell me when the next leap year is -is next year a leap year -is this year a leap year -is this year a leap year or next -is this year a leap year or the next one tell me when next leap year is tell me when the next leap year is what date is the next leap year @@ -41,4 +37,4 @@ when will we have leap year again when will we have a leap year again when will we see leap year again when will we see a leap year again -which year is the next leap year \ No newline at end of file +which year is the next leap year diff --git a/locale/en-US/intents/weekday.for.date.intent b/locale/en-US/intents/weekday.for.date.intent index bf769860..02b16696 100644 --- a/locale/en-US/intents/weekday.for.date.intent +++ b/locale/en-US/intents/weekday.for.date.intent @@ -32,20 +32,6 @@ do you know which day {date} is do you know which day {date} was do you know which weekday {date} is do you know which weekday {date} was -is {date} a Friday -is {date} a Monday -is {date} a Saturday -is {date} a Sunday -is {date} a Thursday -is {date} a Tuesday -is {date} a Wednesday -is {date} on a Friday -is {date} on a Monday -is {date} on a Saturday -is {date} on a Sunday -is {date} on a Thursday -is {date} on a Tuesday -is {date} on a Wednesday on what day does {date} fall on on what day is {date} on what day of the week does {date} fall on @@ -78,20 +64,6 @@ tell me what day {date} is tell me what day {date} was tell me what weekday {date} is tell me what weekday {date} was -was {date} a Friday -was {date} a Monday -was {date} a Saturday -was {date} a Sunday -was {date} a Thursday -was {date} a Tuesday -was {date} a Wednesday -was {date} on a Friday -was {date} on a Monday -was {date} on a Saturday -was {date} on a Sunday -was {date} on a Thursday -was {date} on a Tuesday -was {date} on a Wednesday what day does {date} fall on what day is {date} what day of the week does {date} fall on @@ -129,4 +101,4 @@ which weekday is {date} which weekday was {date} which weekday will it be on {date} which weekday {date} is -which weekday {date} was \ No newline at end of file +which weekday {date} was diff --git a/locale/en-US/intents/weekday.matches.date.intent b/locale/en-US/intents/weekday.matches.date.intent new file mode 100644 index 00000000..9770e29d --- /dev/null +++ b/locale/en-US/intents/weekday.matches.date.intent @@ -0,0 +1,6 @@ +does {date} fall on a {weekday} +is {date} a {weekday} +is {date} on a {weekday} +was {date} a {weekday} +was {date} on a {weekday} +will {date} be on a {weekday} diff --git a/locale/en-US/vocab/leap.year.scope.either.voc b/locale/en-US/vocab/leap.year.scope.either.voc new file mode 100644 index 00000000..9cf09496 --- /dev/null +++ b/locale/en-US/vocab/leap.year.scope.either.voc @@ -0,0 +1,2 @@ +or next +or the next one diff --git a/locale/en-US/vocab/leap.year.scope.next.voc b/locale/en-US/vocab/leap.year.scope.next.voc new file mode 100644 index 00000000..80e4aeaf --- /dev/null +++ b/locale/en-US/vocab/leap.year.scope.next.voc @@ -0,0 +1 @@ +next year diff --git a/locale/en-US/weekday.entity b/locale/en-US/weekday.entity new file mode 100644 index 00000000..f6473647 --- /dev/null +++ b/locale/en-US/weekday.entity @@ -0,0 +1,7 @@ +monday +tuesday +wednesday +thursday +friday +saturday +sunday diff --git a/locale/fr-FR/dialog/leap.year.current.no.dialog b/locale/fr-FR/dialog/leap.year.current.no.dialog new file mode 100644 index 00000000..67f4fee8 --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.current.no.dialog @@ -0,0 +1 @@ +Non, {year} n'est pas une année bissextile. diff --git a/locale/fr-FR/dialog/leap.year.current.yes.dialog b/locale/fr-FR/dialog/leap.year.current.yes.dialog new file mode 100644 index 00000000..50d469a8 --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.current.yes.dialog @@ -0,0 +1 @@ +Oui, {year} est une année bissextile. diff --git a/locale/fr-FR/dialog/leap.year.either.no.dialog b/locale/fr-FR/dialog/leap.year.either.no.dialog new file mode 100644 index 00000000..37c113e6 --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.either.no.dialog @@ -0,0 +1 @@ +Non. La prochaine année bissextile après cela sera {year}. diff --git a/locale/fr-FR/dialog/leap.year.either.yes.dialog b/locale/fr-FR/dialog/leap.year.either.yes.dialog new file mode 100644 index 00000000..50d469a8 --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.either.yes.dialog @@ -0,0 +1 @@ +Oui, {year} est une année bissextile. diff --git a/locale/fr-FR/dialog/leap.year.next.no.dialog b/locale/fr-FR/dialog/leap.year.next.no.dialog new file mode 100644 index 00000000..0ac7365d --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.next.no.dialog @@ -0,0 +1 @@ +Non, {year} ne sera pas une année bissextile. diff --git a/locale/fr-FR/dialog/leap.year.next.yes.dialog b/locale/fr-FR/dialog/leap.year.next.yes.dialog new file mode 100644 index 00000000..62860b18 --- /dev/null +++ b/locale/fr-FR/dialog/leap.year.next.yes.dialog @@ -0,0 +1 @@ +Oui, {year} sera une année bissextile. diff --git a/locale/fr-FR/dialog/weekday.matches.date.future.no.dialog b/locale/fr-FR/dialog/weekday.matches.date.future.no.dialog new file mode 100644 index 00000000..41dc8d75 --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.future.no.dialog @@ -0,0 +1 @@ +Non, {date}, ce sera {actual_weekday}, pas {weekday}. diff --git a/locale/fr-FR/dialog/weekday.matches.date.future.yes.dialog b/locale/fr-FR/dialog/weekday.matches.date.future.yes.dialog new file mode 100644 index 00000000..b97b3972 --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.future.yes.dialog @@ -0,0 +1 @@ +Oui, {date}, ce sera {weekday}. diff --git a/locale/fr-FR/dialog/weekday.matches.date.past.no.dialog b/locale/fr-FR/dialog/weekday.matches.date.past.no.dialog new file mode 100644 index 00000000..a72c7179 --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.past.no.dialog @@ -0,0 +1 @@ +Non, {date}, c'était {actual_weekday}, pas {weekday}. diff --git a/locale/fr-FR/dialog/weekday.matches.date.past.yes.dialog b/locale/fr-FR/dialog/weekday.matches.date.past.yes.dialog new file mode 100644 index 00000000..0a826402 --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.past.yes.dialog @@ -0,0 +1 @@ +Oui, {date}, c'était bien {weekday}. diff --git a/locale/fr-FR/dialog/weekday.matches.date.today.no.dialog b/locale/fr-FR/dialog/weekday.matches.date.today.no.dialog new file mode 100644 index 00000000..7fdfbd33 --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.today.no.dialog @@ -0,0 +1 @@ +Non, {date}, c'est {actual_weekday}, pas {weekday}. diff --git a/locale/fr-FR/dialog/weekday.matches.date.today.yes.dialog b/locale/fr-FR/dialog/weekday.matches.date.today.yes.dialog new file mode 100644 index 00000000..422ec1bd --- /dev/null +++ b/locale/fr-FR/dialog/weekday.matches.date.today.yes.dialog @@ -0,0 +1 @@ +Oui, {date}, c'est {weekday}. diff --git a/locale/fr-FR/intents/is.leap.year.intent b/locale/fr-FR/intents/is.leap.year.intent new file mode 100644 index 00000000..98950c8f --- /dev/null +++ b/locale/fr-FR/intents/is.leap.year.intent @@ -0,0 +1,12 @@ +cette année est-elle bissextile +cette année est-elle bissextile ou l'an prochain +cette année est-elle bissextile ou l'année prochaine +cette année est-elle bissextile ou la prochaine +est-ce que cette année est bissextile +est-ce que cette année est bissextile ou l'an prochain +est-ce que cette année est bissextile ou l'année prochaine +est-ce que cette année est bissextile ou la prochaine +est-ce que l'an prochain est bissextile +est-ce que l'année prochaine est bissextile +l'an prochain est-il bissextile +l'année prochaine est-elle bissextile diff --git a/locale/fr-FR/intents/weekday.matches.date.intent b/locale/fr-FR/intents/weekday.matches.date.intent new file mode 100644 index 00000000..b22c4d90 --- /dev/null +++ b/locale/fr-FR/intents/weekday.matches.date.intent @@ -0,0 +1,4 @@ +est-ce que {date} tombe un {weekday} +le {date} tombe-t-il un {weekday} +le {date} tombait-il un {weekday} +le {date} tombera-t-il un {weekday} diff --git a/locale/fr-FR/vocab/leap.year.scope.either.voc b/locale/fr-FR/vocab/leap.year.scope.either.voc new file mode 100644 index 00000000..2da07c09 --- /dev/null +++ b/locale/fr-FR/vocab/leap.year.scope.either.voc @@ -0,0 +1,4 @@ +ou la prochaine +ou l'année prochaine +ou l'an prochain +ou la suivante diff --git a/locale/fr-FR/vocab/leap.year.scope.next.voc b/locale/fr-FR/vocab/leap.year.scope.next.voc new file mode 100644 index 00000000..d31a6e77 --- /dev/null +++ b/locale/fr-FR/vocab/leap.year.scope.next.voc @@ -0,0 +1,2 @@ +année prochaine +an prochain diff --git a/locale/fr-FR/weekday.entity b/locale/fr-FR/weekday.entity new file mode 100644 index 00000000..e65d2fdf --- /dev/null +++ b/locale/fr-FR/weekday.entity @@ -0,0 +1,7 @@ +lundi +mardi +mercredi +jeudi +vendredi +samedi +dimanche diff --git a/translations/en-us/dialogs.json b/translations/en-us/dialogs.json index a7d7b6d6..fb8a78e2 100644 --- a/translations/en-us/dialogs.json +++ b/translations/en-us/dialogs.json @@ -79,6 +79,42 @@ "This year is {year}", "The current year is {year}", "We're in {year} right now" + ], + "/dialog/leap.year.current.no.dialog": [ + "No, {year} is not a leap year." + ], + "/dialog/leap.year.current.yes.dialog": [ + "Yes, {year} is a leap year." + ], + "/dialog/leap.year.either.no.dialog": [ + "No. The next leap year after that will be {year}." + ], + "/dialog/leap.year.either.yes.dialog": [ + "Yes, {year} is a leap year." + ], + "/dialog/leap.year.next.no.dialog": [ + "No, {year} will not be a leap year." + ], + "/dialog/leap.year.next.yes.dialog": [ + "Yes, {year} will be a leap year." + ], + "/dialog/weekday.matches.date.future.no.dialog": [ + "No, {date} will be {actual_weekday}, not {weekday}." + ], + "/dialog/weekday.matches.date.future.yes.dialog": [ + "Yes, {date} will be {weekday}." + ], + "/dialog/weekday.matches.date.past.no.dialog": [ + "No, {date} was {actual_weekday}, not {weekday}." + ], + "/dialog/weekday.matches.date.past.yes.dialog": [ + "Yes, {date} was {weekday}." + ], + "/dialog/weekday.matches.date.today.no.dialog": [ + "No, {date} is {actual_weekday}, not {weekday}." + ], + "/dialog/weekday.matches.date.today.yes.dialog": [ + "Yes, {date} is {weekday}." ] -} \ No newline at end of file +} diff --git a/translations/en-us/entities.json b/translations/en-us/entities.json index 6dd525df..10a31da5 100644 --- a/translations/en-us/entities.json +++ b/translations/en-us/entities.json @@ -165,5 +165,14 @@ "Friday", "Saturday", "Sunday" + ], + "weekday.entity": [ + "monday", + "tuesday", + "wednesday", + "thursday", + "friday", + "saturday", + "sunday" ] } diff --git a/translations/en-us/intents.json b/translations/en-us/intents.json index c8e9c105..0bd3c202 100644 --- a/translations/en-us/intents.json +++ b/translations/en-us/intents.json @@ -9,10 +9,12 @@ "when will we (have|get|see) [a] leap year again", "when is (February 29th|Feb 29) happening (again|next)", "(what|when) is the next year that has (February 29th|366 days|an extra day [in February])", - "is (next year|this year) a leap year", - "is this year a leap year or (next|the next one)", "(what|which) year is the next leap year" ], + "/intents/is.leap.year.intent": [ + "is (next year|this year) a leap year", + "is this year a leap year or (next|the next one)" + ], "/intents/time.until.intent": [ "how (long|much time|much longer) (is left|do we have) (before|until) {date}", "how far (away|off) is {date} [from (today|now)]", @@ -59,13 +61,20 @@ "(which|what) (day of the week|weekday) (was|is) {date}", "(do you know|[can you] tell me) the (day of the week|weekday) for {date}", "what’s the (day of the week|weekday) for {date}", - "(was|is) {date} [on] a (Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)", "[on] (what|which) (day|day of the week|weekday) does {date} fall on", "[on] (what|which) (day|day of the week|weekday) (was|will it be on) {date}", "[on] (what|which) (day|day of the week|weekday) (was|is) {date}", "[can you] tell me what (day|day of the week|weekday) {date} (was|is)", "[(I want to|do you) know] (which|what) (day|day of the week|weekday) {date} (was|is)" ], + "/intents/weekday.matches.date.intent": [ + "does {date} fall on a {weekday}", + "is {date} a {weekday}", + "is {date} on a {weekday}", + "was {date} a {weekday}", + "was {date} on a {weekday}", + "will {date} be on a {weekday}" + ], "/intents/what.weekday.is.it.intent": [ "(which|what) (day of the week|weekday) is (it|today)", "(do you know|[can you] tell me) the (day of the week|weekday)", @@ -132,4 +141,4 @@ "is it already (noon|midnight|[one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve]) [in {location}]", "is it already (morning|afternoon|evening|night) [in {location}]" ] -} \ No newline at end of file +} diff --git a/translations/fr-fr/dialogs.json b/translations/fr-fr/dialogs.json index 529ea4e3..b25eaec3 100644 --- a/translations/fr-fr/dialogs.json +++ b/translations/fr-fr/dialogs.json @@ -36,6 +36,24 @@ "/dialog/extract.date.error.dialog": [ "Je n'ai pas compris \u00e0 quelle date vous faites r\u00e9f\u00e9rence." ], + "/dialog/leap.year.current.no.dialog": [ + "Non, {year} n'est pas une ann\u00e9e bissextile." + ], + "/dialog/leap.year.current.yes.dialog": [ + "Oui, {year} est une ann\u00e9e bissextile." + ], + "/dialog/leap.year.either.no.dialog": [ + "Non. La prochaine ann\u00e9e bissextile apr\u00e8s cela sera {year}." + ], + "/dialog/leap.year.either.yes.dialog": [ + "Oui, {year} est une ann\u00e9e bissextile." + ], + "/dialog/leap.year.next.no.dialog": [ + "Non, {year} ne sera pas une ann\u00e9e bissextile." + ], + "/dialog/leap.year.next.yes.dialog": [ + "Oui, {year} sera une ann\u00e9e bissextile." + ], "/dialog/month.current.dialog": [ "Le mois actuel est {month}", "Le mois en cours est {month}", @@ -71,6 +89,24 @@ "Nous sommes {weekday}", "C'est {weekday}" ], + "/dialog/weekday.matches.date.future.no.dialog": [ + "Non, {date}, ce sera {actual_weekday}, pas {weekday}." + ], + "/dialog/weekday.matches.date.future.yes.dialog": [ + "Oui, {date}, ce sera {weekday}." + ], + "/dialog/weekday.matches.date.past.no.dialog": [ + "Non, {date}, c'était {actual_weekday}, pas {weekday}." + ], + "/dialog/weekday.matches.date.past.yes.dialog": [ + "Oui, {date}, c'était bien {weekday}." + ], + "/dialog/weekday.matches.date.today.no.dialog": [ + "Non, {date}, c'est {actual_weekday}, pas {weekday}." + ], + "/dialog/weekday.matches.date.today.yes.dialog": [ + "Oui, {date}, c'est {weekday}." + ], "/dialog/year.current.dialog": [ "L'ann\u00e9e actuelle est {year}", "L'ann\u00e9e en cours est {year}", diff --git a/translations/fr-fr/entities.json b/translations/fr-fr/entities.json index d7d59516..9fb10149 100644 --- a/translations/fr-fr/entities.json +++ b/translations/fr-fr/entities.json @@ -143,5 +143,14 @@ "aujourd'hui", "demain", "hier" + ], + "weekday.entity": [ + "lundi", + "mardi", + "mercredi", + "jeudi", + "vendredi", + "samedi", + "dimanche" ] } diff --git a/translations/fr-fr/intents.json b/translations/fr-fr/intents.json index c12b69f9..46d682c2 100644 --- a/translations/fr-fr/intents.json +++ b/translations/fr-fr/intents.json @@ -17,6 +17,26 @@ "dis-moi les dates du week-end dernier", "peux-tu me dire quand \u00e9tait le week-end dernier" ], + "/intents/is.leap.year.intent": [ + "cette année est-elle bissextile", + "cette année est-elle bissextile ou l'an prochain", + "cette année est-elle bissextile ou l'année prochaine", + "cette année est-elle bissextile ou la prochaine", + "est-ce que cette année est bissextile", + "est-ce que cette année est bissextile ou l'an prochain", + "est-ce que cette année est bissextile ou l'année prochaine", + "est-ce que cette année est bissextile ou la prochaine", + "est-ce que l'an prochain est bissextile", + "est-ce que l'année prochaine est bissextile", + "l'an prochain est-il bissextile", + "l'année prochaine est-elle bissextile" + ], + "/intents/weekday.matches.date.intent": [ + "est-ce que {date} tombe un {weekday}", + "le {date} tombe-t-il un {weekday}", + "le {date} tombait-il un {weekday}", + "le {date} tombera-t-il un {weekday}" + ], "/intents/what.time.is.it.intent": [ "quelle heure est-il", "quelle heure est-il \u00e0 {location}",