improved timer skill

This commit is contained in:
Mathieu B 2021-08-02 23:07:06 +02:00
parent 7c5f0114c9
commit 306bae80e5
3 changed files with 10 additions and 16 deletions

View File

@ -9,17 +9,21 @@ class TimerSkill(Skill, metaclass=SkillRegistering):
def __init__(self, data=dict): def __init__(self, data=dict):
super().__init__("TimerSkill", data) super().__init__("TimerSkill", data)
def register(self):
super(TimerSkill, self).register()
@intent_file_handler("start_timer.intent", "StartTimerIntent") @intent_file_handler("start_timer.intent", "StartTimerIntent")
def handle_start_timer(self, data): def handle_start_timer(self, data):
print(data) print(data)
if 'amount' in data and 'time_unit' in data: if 'duration' in data:
print(extract_duration(data['amount'] + " " + data['time_unit']), languages_utils.get_language()) print(extract_duration(data['duration']), languages_utils.get_language())
if 'name' in data: 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 pass
else: 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 # TODO : ask for name
pass pass
else: else:

View File

@ -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) {duration}
(Mets|Lance|Démarre) un (minuteur|timer) (de|pour dans|pour) {amount} {time_unit} (nommé|appelé|qui s'appelle|et appelle le) {name} (Mets|Lance|Démarre) un (minuteur|timer) (de|pour dans|pour) {duration} (nommé|appelé|qui s'appelle|et appelle le) {name}

View File

@ -1,10 +0,0 @@
seconde
secondes
minute
minutes
heure
heures
quart d'heure
quart-heure
demi heure
demi-heure