Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SK] implement cancel & cancelAll timer intents #2846

Merged
merged 4 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions responses/sk/HassCancelAllTimers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
language: sk
responses:
intents:
HassCancelAllTimers:
default: >
{% if slots.canceled < 1: %}
Žiadny časovač nebol zrušený.
{% elif slots.canceled == 1: %}
1 časovač zrušený.
{% elif slots.canceled > 1 and slots.canceled < 5 : %}
{{ slots.canceled }} časovače zrušené.
{% else: %}
{{ slots.canceled }} časovačov zrušených
{% endif %}
area: >
{% if slots.canceled < 1: %}
Žiadny časovač v {{ slots.area }} nebol zrušený.
{% elif slots.canceled == 1: %}
1 časovač v {{ slots.area }} bol zrušený.
{% elif slots.canceled > 1 and slots.canceled < 5: %}
{{ slots.canceled }} časovače v {{ slots.area }} boli zrušené.
{% else: %}
{{ slots.canceled }} časovačov v {{ slots.area }} bolo zrušených.
{% endif %}
5 changes: 5 additions & 0 deletions responses/sk/HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: sk
responses:
intents:
HassCancelTimer:
default: "Časovač zrušený"
16 changes: 8 additions & 8 deletions responses/sk/HassStartTimer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ responses:
intents:
HassStartTimer:
default: >
{% set foneticNumbers = ({"pol":30,"štvrť":15,"trištvrte":45,"jedno":1,"dvoj":2,"troj":3,"štvor":4,"minútu":1,"hodinu":1}) %}
{% set h = foneticNumbers.get(slots.hours,slots.hours | int) if slots.hours is defined else none %}
{% set m = foneticNumbers.get(slots.minutes,slots.minutes | int) if slots.minutes is defined else none %}
{% set s = foneticNumbers.get(slots.seconds,slots.seconds | int) if slots.seconds is defined else none %}
{% set foneticNumbers = ({"pol":"30","štvrť":"15","trištvrte":"45","jedno":"1","dvoj":"2","troj":"3","štvor":"4","minútu":"1","hodinu":"1","minútový":"1","hodinový":"1"}) %}
{% set h = foneticNumbers.get(slots.hours | lower,slots.hours) | int if slots.hours is defined else none %}
{% set m = foneticNumbers.get(slots.minutes | lower,slots.minutes) | int if slots.minutes is defined else none %}
{% set s = foneticNumbers.get(slots.seconds | lower,slots.seconds) | int if slots.seconds is defined else none %}
{% set unitSuffixes = ({1:"u",2:"y",3:"y",4:"y"}) %}
{% set h_text = '' if not h else ((h if h > 1 else '') ~ (' hodin' ~ unitSuffixes.get(h) if h < 5 else ' hodín')) %}
{% set m_text = '' if not m else ((m if m > 1 else '') ~ ' minút' ~ unitSuffixes.get(m,'')) %}
Expand All @@ -16,10 +16,10 @@ responses:
{% set name = (" " ~ slots.name | trim) if slots.name is defined else '' %}
Časovač{{ name }} nastavený na {{ text }}
command: >
{% set foneticNumbers = ({"pol":30,"štvrť":15,"trištvrte":45,"jedno":1,"dvoj":2,"troj":3,"štvor":4,"minútu":1,"hodinu":1}) %}
{% set h = foneticNumbers.get(slots.hours,slots.hours | int) if slots.hours is defined else none %}
{% set m = foneticNumbers.get(slots.minutes,slots.minutes| int) if slots.minutes is defined else none %}
{% set s = foneticNumbers.get(slots.seconds,slots.seconds| int) if slots.seconds is defined else none %}
{% set foneticNumbers = ({"pol":30,"štvrť":15,"trištvrte":45,"jedno":1,"dvoj":2,"troj":3,"štvor":4,"minútu":1,"hodinu":1,"minútový":1,"hodinový":1}) %}
{% set h = foneticNumbers.get(slots.hours | lower,slots.hours) | int if slots.hours is defined else none %}
{% set m = foneticNumbers.get(slots.minutes | lower,slots.minutes) | int if slots.minutes is defined else none %}
{% set s = foneticNumbers.get(slots.seconds | lower,slots.seconds) | int if slots.seconds is defined else none %}
{% set unitSuffixes = ({1:"u",2:"y",3:"y",4:"y"}) %}
{% set h_text = '' if not h else ((h if h > 1 else '') ~ (' hodin' ~ unitSuffixes.get(h) if h < 5 else ' hodín')) %}
{% set m_text = '' if not m else ((m if m > 1 else '') ~ ' minút' ~ unitSuffixes.get(m,'')) %}
Expand Down
13 changes: 11 additions & 2 deletions sentences/sk/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ lists:
to: 100
timer_range_fonetic:
values:
- in: "jedno|minútu|hodinu"
- in: "jedno|minút(u|ový)|hodin(u|ový)"
out: 1
- in: "dvoj"
out: 2
Expand Down Expand Up @@ -177,7 +177,8 @@ expansion_rules:
volume: "{volume:volume_level}[[ ]%| percent]"
# Timers
timer_set: "nasta(v[te|iť]|l)"
timer_type: "(časovač|stopky)"
timer_cancel: "(zruš[í|te|iť]|zastav(í|te|iť))"
timer_type: "(časovač[e]|stopky)"
timer_unit_second: "sek(únd|(und(a|u|y|ov(ý|é|ej))))"
timer_unit_minute: "minút[a|u|y|ov(ý|é|ej)]"
timer_unit_hour: "hod(ín|(in(a|u|y|ov(ý|é|ej))))"
Expand All @@ -188,5 +189,13 @@ expansion_rules:
timer_duration_minutes: "(<timer_value_minute> <timer_unit_minute> [[a] <timer_value_second> <timer_unit_second>])|([<timer_value_minute> a ]{timer_parts:seconds} <timer_unit_minute>)|({timer_range_fonetic:minutes} [a {timer_parts:seconds}])"
timer_duration_hours: "(<timer_value_hour> <timer_unit_hour> [[a] <timer_value_minute> <timer_unit_minute>] [[a] <timer_value_second> <timer_unit_second>])|([<timer_value_hour> a ]{timer_parts:minutes} <timer_unit_hour>)|({timer_range_fonetic:hours} [a {timer_parts:minutes}])"
timer_duration: "<timer_duration_seconds>|<timer_duration_minutes>|<timer_duration_hours>"

timer_value_start_second: ({timer_range:start_seconds}|{timer_range_fonetic:start_seconds})
timer_value_start_minute: ({timer_range:start_minutes}|{timer_range_fonetic:start_minutes})
timer_value_start_hour: ({timer_range:start_hours}|{timer_range_fonetic:start_hours})
timer_start_seconds: "<timer_value_start_second> <timer_unit_second>"
timer_start_minutes: "(<timer_value_start_minute> <timer_unit_minute> [[a] <timer_value_start_second> <timer_unit_second>])|([<timer_value_start_minute> a ]{timer_parts:start_seconds} <timer_unit_minute>)|({timer_range_fonetic:start_minutes} [a {timer_parts:start_seconds}])"
timer_start_hours: "(<timer_value_start_hour> <timer_unit_hour> [[a] <timer_value_start_minute> <timer_unit_minute>] [[a] <timer_value_start_second> <timer_unit_second>])|([<timer_value_start_hour> a ]{timer_parts:start_minutes} <timer_unit_hour>)|({timer_range_fonetic:start_hours} [a {timer_parts:start_minutes}])"
timer_start: "<timer_start_seconds>|<timer_start_minutes>|<timer_start_hours>"
skip_words:
- "prosím"
10 changes: 10 additions & 0 deletions sentences/sk/homeassistant_HassCancelAllTimers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
language: "sk"
intents:
HassCancelAllTimers:
data:
- sentences:
- "<timer_cancel> <all> <timer_type>"
- sentences:
- "<timer_cancel> <all> <timer_type> <in> <area>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<area> už má optional in area: "[<in> ]{area}" ale to je ok

response: area
10 changes: 10 additions & 0 deletions sentences/sk/homeassistant_HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: "sk"
intents:
HassCancelTimer:
data:
- sentences:
- "<timer_cancel> <timer_start> <timer_type> [ {timer_name:name}]"
- "<timer_cancel> <timer_type> na <timer_start>"
- "<timer_cancel> {area} <timer_type>"
- "<timer_cancel> <timer_type> <in> <area>"
- "<timer_cancel> <timer_type>[ {timer_name:name}[ na <timer_start>]]"
4 changes: 2 additions & 2 deletions sentences/sk/homeassistant_HassStartTimer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ intents:
HassStartTimer:
data:
- sentences:
- "[<timer_set> ]<timer_type> na <timer_duration> [{timer_name:name}]"
- "[<timer_set> ]<timer_type> na <timer_duration>[ {timer_name:name}]"
- "[<timer_set> ]<timer_type> {timer_name:name} na <timer_duration>"
- "[<timer_set> ]<timer_duration> <timer_type> [{timer_name:name}]"
- "[<timer_set> ]<timer_duration> <timer_type>[ {timer_name:name}]"
- sentences:
- "{timer_command:conversation_command} (za|o|do) <timer_duration>"
- "(za|o|do) <timer_duration> {timer_command:conversation_command}"
Expand Down
15 changes: 14 additions & 1 deletion tests/sk/_fixtures.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: "sk"
areas:
- name: "kuchy(ňa|ni|ne|ňu) "
- name: "kuchy(ňa|ni|ne|ňu|nsk(ý|é)) "
id: kitchen
- name: "obývačk(a|e|u|y)"
id: living_room
Expand Down Expand Up @@ -186,3 +186,16 @@ entities:
out: "off"
attributes:
device_class: door
timers:
- name: "pizza"
start_minutes: 15
total_seconds_left: 648
rounded_hours_left: 0
rounded_minutes_left: 10
rounded_seconds_left: 0
- area: "kitchen"
start_minutes: 5
total_seconds_left: 190
rounded_hours_left: 0
rounded_minutes_left: 3
rounded_seconds_left: 0
17 changes: 17 additions & 0 deletions tests/sk/homeassistant_HassCancelAllTimers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
language: sk
tests:
- sentences:
- "zruš všetky časovače"
intent:
name: HassCancelAllTimers
response: "2 časovače zrušené."
- sentences:
- "zruš všetky časovače v kuchyni"
intent:
name: HassCancelAllTimers
slots:
area:
- "kuchyni"
#This is not correct as there is one timer defined for a kitchen but must be like this for tests to pass. It is caused by not correctly resolving area aliases in timer processing for tests.
response: "Žiadny časovač v kuchyni nebol zrušený."
65 changes: 65 additions & 0 deletions tests/sk/homeassistant_HassCancelTimer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
language: sk
tests:
- sentences:
- "zruš časovač"
- "zruš stopky"
intent:
name: HassCancelTimer
response: "Časovač zrušený"
- sentences:
- "zruš časovač na 5 minút"
- "zruš 5 minútový časovač"
intent:
name: HassCancelTimer
slots:
start_minutes: 5
- sentences:
- "zruš časovač pizza na 5 minút"
- "zruš 5 minútový časovač pizza"
intent:
name: HassCancelTimer
slots:
start_minutes: 5
name: pizza
response: "Časovač zrušený"
- sentences:
- "zruš kuchynský časovač"
- "zruš časovač v kuchyni"
intent:
name: HassCancelTimer
slots:
area:
- kuchynský
- kuchyni
response: "Časovač zrušený"
- sentences:
- "zruš časovač pizza"
intent:
name: HassCancelTimer
slots:
name: pizza
response: "Časovač zrušený"
- sentences:
- "zruš časovač na pol minúty"
intent:
name: HassCancelTimer
slots:
start_seconds: 30
response: "Časovač zrušený"
- sentences:
- "zruš časovač na 1 a pol minúty"
- "zruš časovač na minútu a pol"
intent:
name: HassCancelTimer
slots:
start_seconds: 30
start_minutes: 1
response: "Časovač zrušený"
- sentences:
- "zruš časovač na minútu"
- "zruš minútový časovač"
intent:
name: HassCancelTimer
slots:
start_minutes: 1
response: "Časovač zrušený"
1 change: 1 addition & 0 deletions tests/sk/homeassistant_HassStartTimer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ tests:
response: "Časovač nastavený na minútu a 30 sekúnd"
- sentences:
- "časovač na minútu"
- "Minútový časovač"
intent:
name: HassStartTimer
slots:
Expand Down
Loading