From 214e8a6a9c1be9150d7821e3cc6180ad23679bef Mon Sep 17 00:00:00 2001 From: Mathieu B Date: Mon, 2 Aug 2021 18:23:11 +0200 Subject: [PATCH] Improved timer skill intent --- jarvis/skills/daily/timer/__init__.py | 15 +++++++++++++++ .../daily/timer/vocab/fr-fr/start_timer.intent | 2 +- .../daily/timer/vocab/fr-fr/time_unit.entity | 6 +++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/jarvis/skills/daily/timer/__init__.py b/jarvis/skills/daily/timer/__init__.py index e1e61f1..84040cb 100644 --- a/jarvis/skills/daily/timer/__init__.py +++ b/jarvis/skills/daily/timer/__init__.py @@ -1,5 +1,8 @@ +from lingua_franca.parse import extract_duration + from jarvis.skills import Skill, SkillRegistering from jarvis.skills.decorators import intent_file_handler +from jarvis.utils import languages_utils class TimerSkill(Skill, metaclass=SkillRegistering): @@ -9,6 +12,18 @@ class TimerSkill(Skill, metaclass=SkillRegistering): @intent_file_handler("start_timer.intent", "StartTimerIntent") def handle_start_timer(self, data): print(data) + if 'amount' in data and 'time_unit' in data: + print(extract_duration(data['amount'] + " " + data['time_unit']), languages_utils.get_language()) + + if 'name' in data: + print("Start timer for {} {} named {}".format(data['amount'], data['time_unit'], data['name'])) + pass + else: + print("Start timer for {} {} without name".format(data['amount'], data['time_unit'])) + # TODO : ask for name + pass + else: + print("No amount and/or time_unit") pass diff --git a/jarvis/skills/daily/timer/vocab/fr-fr/start_timer.intent b/jarvis/skills/daily/timer/vocab/fr-fr/start_timer.intent index af30a60..9cb99f1 100644 --- a/jarvis/skills/daily/timer/vocab/fr-fr/start_timer.intent +++ b/jarvis/skills/daily/timer/vocab/fr-fr/start_timer.intent @@ -1,2 +1,2 @@ (Mets|Lance|Démarre) un (minuteur|timer) (de|pour dans|pour) {amount} {time_unit} -(Mets|Lance|Démarre) un (minuteur|timer) de {amount} {time_unit} (nommé|appelé|qui s'appelle|et appelle le) {name} \ No newline at end of file +(Mets|Lance|Démarre) un (minuteur|timer) (de|pour dans|pour) {amount} {time_unit} (nommé|appelé|qui s'appelle|et appelle le) {name} \ No newline at end of file diff --git a/jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity b/jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity index 05cbff2..79f7934 100644 --- a/jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity +++ b/jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity @@ -3,4 +3,8 @@ secondes minute minutes heure -heures \ No newline at end of file +heures +quart d'heure +quart-heure +demi heure +demi-heure \ No newline at end of file