| 1 |
language: gl |
| 2 |
responses: |
| 3 |
intents: |
| 4 |
HassGetState: |
| 5 |
|
| 6 |
|
| 7 |
one: | |
| 8 |
{{ state.state_with_unit }} |
| 9 |
|
| 10 |
one_yesno: | |
| 11 |
{% if query.matched %} |
| 12 |
Si |
| 13 |
{% else %} |
| 14 |
Non{% if slots.domain != 'lock' %}, {{ state.state_with_unit }}{% endif %} |
| 15 |
{% endif %} |
| 16 |
|
| 17 |
any: | |
| 18 |
{% if query.matched %} |
| 19 |
{% set match = query.matched | map(attribute="name") | sort | list %} |
| 20 |
{% if match | length > 4 %} |
| 21 |
Si, {{ match[:3] | join(", ") }} e {{ (match | length - 3) }} máis |
| 22 |
{%- else -%} |
| 23 |
Si, |
| 24 |
{% for name in match -%} |
| 25 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} e {% endif -%} |
| 26 |
{{ name }} |
| 27 |
{%- endfor -%} |
| 28 |
{% endif %} |
| 29 |
{% else %} |
| 30 |
Non |
| 31 |
{% endif %} |
| 32 |
|
| 33 |
all: | |
| 34 |
{% macro word_gender(word) %} |
| 35 |
{%- set word_lower = word.strip().lower() -%} |
| 36 |
{%- set known_words = { |
| 37 |
'luz': true |
| 38 |
} -%} |
| 39 |
{%- set feminine_endings = ['a', 'á', 'ión', 'dad', 'tad', 'eza', 'ura'] -%} |
| 40 |
|
| 41 |
{%- if word_lower in known_words -%} |
| 42 |
{%- if known_words[word_lower] -%}feminine{%- else -%}masculine{%- endif -%} |
| 43 |
{%- else -%} |
| 44 |
{%- set is_feminine = false -%} |
| 45 |
{%- for ending in feminine_endings -%} |
| 46 |
{%- if word_lower.endswith(ending) -%} |
| 47 |
{%- set is_feminine = true -%} |
| 48 |
{%- endif -%} |
| 49 |
{%- endfor -%} |
| 50 |
{%- if is_feminine -%}feminine{%- else -%}masculine{%- endif -%} |
| 51 |
{%- endif -%} |
| 52 |
{% endmacro %} |
| 53 |
|
| 54 |
{% macro is_feminine(entity_name) %} |
| 55 |
{%- set first_word = entity_name.strip().split()[0] -%} |
| 56 |
{{- word_gender(first_word) == 'feminine' -}} |
| 57 |
{% endmacro %} |
| 58 |
|
| 59 |
{% macro all_feminine(entity_list) %} |
| 60 |
{%- set ns = namespace(all_feminine=true) -%} |
| 61 |
{%- for entity in entity_list -%} |
| 62 |
{%- if not is_feminine(entity.name) -%} |
| 63 |
{%- set ns.all_feminine = false -%} |
| 64 |
{%- endif -%} |
| 65 |
{%- endfor -%} |
| 66 |
{{- ns.all_feminine -}} |
| 67 |
{% endmacro %} |
| 68 |
|
| 69 |
{% if not query.unmatched %} |
| 70 |
Si |
| 71 |
{% else %} |
| 72 |
{% set no_match = query.unmatched | map(attribute="name") | sort | list %} |
| 73 |
{% if no_match | length > 4 %} |
| 74 |
{% if slots.domain == 'lock' %} |
| 75 |
Non, {{ no_match[:3] | join(", ") }} e {{ (no_match | length - 3) }} máis non están {% if all_feminine(query.unmatched) == true %}pechadas{% else %}pechados{% endif %} |
| 76 |
{% else %} |
| 77 |
Non, {{ no_match[:3] | join(", ") }} e {{ (no_match | length - 3) }} máis non están {{ slots.state }} |
| 78 |
{% endif %} |
| 79 |
{%- else -%} |
| 80 |
Non, |
| 81 |
{% for name in no_match -%} |
| 82 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} e {% endif -%} |
| 83 |
{{ name }} |
| 84 |
{%- endfor %} non {% if no_match | length > 1 %}están{% else %}está{% endif %} {% if slots.domain == 'lock' %}{% if all_feminine(query.unmatched) == true %}{% if no_match | length > 1 %}pechadas{% else %}pechada{% endif %}{% else %}{% if no_match | length > 1 %}pechados{% else %}pechado{% endif %}{% endif %}{% else %}{{ slots.state }}{% endif %} |
| 85 |
{% endif %} |
| 86 |
{% endif %} |
| 87 |
|
| 88 |
which: | |
| 89 |
{% if not query.matched %} |
| 90 |
{% if slots.domain == 'lock' %}{% if query.unmatched and all_feminine(query.unmatched) == true %}Ningunha{% else %}Ningún{% endif %}{% else %}Ningún{% endif %} |
| 91 |
{% else %} |
| 92 |
{% set match = query.matched | map(attribute="name") | sort | list %} |
| 93 |
{% if match | length > 4 %} |
| 94 |
{{ match[:3] | join(", ") }} e {{ (match | length - 3) }} máis |
| 95 |
{% else %} |
| 96 |
{%- for name in match -%} |
| 97 |
{% if not loop.first and not loop.last %}, {% elif loop.last and not loop.first %} e {% endif -%} |
| 98 |
{{ name }} |
| 99 |
{%- endfor -%} |
| 100 |
{% endif %} |
| 101 |
{% endif %} |
| 102 |
|
| 103 |
how_many: | |
| 104 |
{{ query.matched | length }} |
| 105 |
|
| 106 |
where: | |
| 107 |
{% if state == "not_home" %} |
| 108 |
{{ slots.name | capitalize }} está fora |
| 109 |
{% else %} |
| 110 |
{{ slots.name | capitalize }} está en {{ state.state }} |
| 111 |
{% endif %} |