From 306bae80e555219814bccf7c412e57c026662a47 Mon Sep 17 00:00:00 2001 From: Mathieu B Date: Mon, 2 Aug 2021 23:07:06 +0200 Subject: [PATCH] improved timer skill --- jarvis/skills/daily/timer/__init__.py | 12 ++++++++---- .../daily/timer/vocab/fr-fr/start_timer.intent | 4 ++-- .../skills/daily/timer/vocab/fr-fr/time_unit.entity | 10 ---------- 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity diff --git a/jarvis/skills/daily/timer/__init__.py b/jarvis/skills/daily/timer/__init__.py index 84040cb..d5d1e9c 100644 --- a/jarvis/skills/daily/timer/__init__.py +++ b/jarvis/skills/daily/timer/__init__.py @@ -9,17 +9,21 @@ class TimerSkill(Skill, metaclass=SkillRegistering): def __init__(self, data=dict): super().__init__("TimerSkill", data) + def register(self): + super(TimerSkill, self).register() + + @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 'duration' in data: + print(extract_duration(data['duration']), languages_utils.get_language()) if 'name' in data: - print("Start timer for {} {} named {}".format(data['amount'], data['time_unit'], data['name'])) + print("Start timer for {} named {}".format(data['duration'], data['name'])) pass else: - print("Start timer for {} {} without name".format(data['amount'], data['time_unit'])) + print("Start timer for {} without name".format(data['duration'])) # TODO : ask for name pass else: 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 9cb99f1..54c6e38 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|pour dans|pour) {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) {duration} +(Mets|Lance|Démarre) un (minuteur|timer) (de|pour dans|pour) {duration} (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 deleted file mode 100644 index 79f7934..0000000 --- a/jarvis/skills/daily/timer/vocab/fr-fr/time_unit.entity +++ /dev/null @@ -1,10 +0,0 @@ -seconde -secondes -minute -minutes -heure -heures -quart d'heure -quart-heure -demi heure -demi-heure \ No newline at end of file