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

[GL] Add intents to query the current date and time #2679

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
21 changes: 21 additions & 0 deletions responses/gl/HassGetCurrentDate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
language: gl
responses:
intents:
HassGetCurrentDate:
default: >
{% set months = {
1: 'xaneiro',
2: 'febreiro',
3: 'marzo',
4: 'abril',
5: 'maio',
6: 'xuño',
7: 'xullo',
8: 'agosto',
9: 'septembro',
10: 'outubro',
11: 'novembro',
12: 'decembro',
} %}
{% set weekday = [ 'luns', 'martes', 'mércoles', 'xoves', 'venres', 'sábado', 'domingo' ] %}
É {{ weekday[slots.date.weekday()] }}, {{slots.date.day}} de {{ months[slots.date.month] }} de {{ slots.date.year }}
49 changes: 49 additions & 0 deletions responses/gl/HassGetCurrentTime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
language: gl
responses:
intents:
HassGetCurrentTime:
default: >
{% set next_hour = 0 %}
{% set minute_str = "" %}
{% if slots.time.minute > 0: %}
{% if slots.time.minute == 15: %}
{% set minute_str = "e cuarto" %}
{% elif slots.time.minute == 30: %}
{% set minute_str = "e media" %}
{% elif slots.time.minute < 30: %}
{% set minute_str = 'e {0:01d}'.format(slots.time.minute) %}
{% else: %}
{% set next_hour = 1 %}
{% if slots.time.minute == 45: %}
{% set minute_str = "menos cuarto" %}
{% else: %}
{% set minute_str = 'menos {0:01d}'.format(60 - slots.time.minute) %}
{% endif %}
{% endif %}
{% endif %}
{% if slots.time.hour + next_hour > 12: %}
{% set hour12 = slots.time.hour + next_hour - 12 %}
{% elif slots.time.hour + next_hour == 0: %}
{% set hour12 = 12 %}
{% else: %}
{% set hour12 = slots.time.hour + next_hour %}
{% endif %}
{% if hour12 == 1 : %}
É a
{% else: %}
Son as
{% endif %}
{{hour12}} {{minute_str}}
{% if slots.time.hour == 0: %}
da medianoite
{% elif slots.time.hour < 4: %}
da madrugada
{% elif slots.time.hour < 12: %}
da mañá
{% elif slots.time.hour == 12: %}
di mediodía
{% elif slots.time.hour < 21: %}
da tarde
{% else: %}
da noite
{% endif %}
29 changes: 14 additions & 15 deletions sentences/gl/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,30 @@ lists:
wildcard: true

expansion_rules:
acende: "(acende | activa)"
algun: "(algún|algunha|algúns|algunhas)"
area: "[en | no | na | de | do | da] {area}"
brightness: "{brightness}[%| porcento]"
cal_e_a_medida_do_sensor: "([dime ]<cal> [é (a|o)] [(cantidade|medida)|nivel (de|da|do)] | cant(o|a)[s]) <class> (de|do|da|en|no|na|dende|<que_marca>) <nome> [<area>]"
cal_e: "([<dime> ]cal é [o |a ]|[<dime> ]cales son [os |as ]|[<dime> ]c(o|ó)mo (vai|está|marcha|se atopa)[n] [o |a |os |as ])"
cal: "(qu[e|é]|cal|cales)"
cancela: "cancel(a[r])"
crea: "(cre(a|ar))"
dime: "(d(í|i)[s|ga]me|sabes[ me][ d(e|i)cir])"
elimina: "(elimin(a|ar)|borr(a|ar))"
engadir: "(engada | engade)"
esta: "(está|están|existe|existen|hai)"
establece: "(pon|establec(e|er)|axust(a|ar)|configur(a|ar)|cambi(a[r]))"
inicia: "(inici(a|ar)|come[n](za|zar)|emp[i]e(za|zar))"
crea: "(cre(a|ar))"
nome: "[o | a | os | as] {name}"
meu: "(o meu|a miña|os meus|as miñas)"
algun: "(algún|algunha|algúns|algunhas)"
nome: "[o | a | os | as] {name}"
para: "(para|pra)"
area: "[en | no | na | de | do | da] {area}"
brightness: "{brightness}[%| porcento]"
cal: "(que|cal|cales)"
cal_e: "(cal é [o |a ]|cales son [os |as ]|c(o|ó)mo (vai|está|marcha|se atopa)[n] [o |a |os |as ])"
esta: "(está|están|existe|existen|hai)"
acende: "(acende | activa)"
engadir: "(engada | engade)"
por: "(por | pol(o|a)[s])"
poñer: "(poña | pon | meta | mete)"
por: "(por | pol(o|a)[s])"
que_marca: "([que] (marca|indica|mide) | (indicad|medid|marcad)(a|o) <por> |[que] está (a (indicar | medir | marcar)|(indicando|medindo|marcando)))"
temp: "[a] (temperatura)"
temperature: "{temperature} [graos] [{temperature_unit}]"
todos: "(todos|todas|tódolos|tódalas)"
que_marca: "([que] (marca|indica|mide) | (indicad|medid|marcad)(a|o) <por> |[que] está (a (indicar | medir | marcar)|(indicando|medindo|marcando)))"
cal_e_a_medida_do_sensor: "(<cal> [é (a|o)] [(cantidade|medida)|nivel (de|da|do)] | cant(o|a)[s]) <class> (de|do|da|en|no|na|dende|<que_marca>) <nome> [<area>]"
# Temporizadores
temporizador: "[o |a ](temporizador|conta atrás)"
temporizadores: "[o |a |(o|a)s ](temporizador[es]|conta[s] atrás)"
Expand Down Expand Up @@ -166,5 +167,3 @@ skip_words:
- "podes"
- "podería"
- "poderías"
- "dime"
- "dígame"
8 changes: 8 additions & 0 deletions sentences/gl/homeassistant_HassGetCurrentDate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
language: gl
intents:
HassGetCurrentDate:
data:
- sentences:
- "[<dime> ]qué (día|fecha|data) é[ hoxe]"
- "[<dime> ](a|en) qué (día|fecha|data) estamos[ hoxe]"
- "<dime> a (fecha|data)[ actual| de hoxe]"
7 changes: 7 additions & 0 deletions sentences/gl/homeassistant_HassGetCurrentTime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: gl
intents:
HassGetCurrentTime:
data:
- sentences:
- "[<dime> ]qué hora é[ agora]"
- "<dime> a hora[ actual]"
6 changes: 3 additions & 3 deletions sentences/gl/homeassistant_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ intents:
HassGetState:
data:
- sentences:
- "<cal> é [o estado] [do|da] <nome> [<area>]"
- "[<dime> ]<cal> é [o estado] [do|da] <nome> [<area>]"
- "en que estado <esta> <nome> [<area>]"
- "como <esta> <nome> [<area>]"
response: one
Expand All @@ -30,9 +30,9 @@ intents:
response: all

- sentences:
- <cal> {on_off_domains:domain} <esta> {on_off_states:state} [<area>]
- "[<dime> ]<cal> {on_off_domains:domain} <esta> {on_off_states:state} [<area>]"
response: which

- sentences:
- (cantos|cantas) {on_off_domains:domain} <esta> {on_off_states:state} [<area>]
- "[<dime> ](cantos|cantas) {on_off_domains:domain} <esta> {on_off_states:state} [<area>]"
response: how_many
11 changes: 11 additions & 0 deletions tests/gl/homeassistant_HassGetCurrentDate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: gl
tests:
- sentences:
- "qué día é hoxe"
- "dime a qué data estamos"
- "dime en qué fecha estamos"
- "dime a fecha"
- "dime a data actual"
intent:
name: HassGetCurrentDate
response: É martes, 17 de septembro de 2013
10 changes: 10 additions & 0 deletions tests/gl/homeassistant_HassGetCurrentTime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: gl
tests:
- sentences:
- "qué hora é"
- "dime a hora actual"
- "dime a hora"
- "dime qué hora é"
intent:
name: HassGetCurrentTime
response: É a 1 e 2 da madrugada
3 changes: 2 additions & 1 deletion tests/gl/homeassistant_HassGetState.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ tests:

- sentences:
- "que luces están acendidas?"
- "dígame cales luces están acendidas?"
- "dime qué luces están acendidas?"
- "dime cales luces están acendidas?"
intent:
name: HassGetState
slots:
Expand Down