intents icon indicating copy to clipboard operation
intents copied to clipboard

To-Do / Shopping list wildcards currently matches partial words, which makes some sentence definitions to work wrongly

Open arpia49 opened this issue 1 year ago • 4 comments

Hello, I'm unable to make the following sentences work:

  • Añadir manzanas a la lista de la compra
  • Añadir manzanas a mi lista de la compra

image

While the following works fine:

  • Añadir manzanas en la lista de la compra
  • Añadir manzanas en mi lista de la compra

image

@davefx I think something may be wrong in the definition, maybe spacing?

sentences/es/shopping_list_HassShoppingListAddItem.yaml

arpia49 avatar Nov 01 '23 22:11 arpia49

Having the same issue, I think the problem is because of this

image

so basically

    data:
      - sentences:
          - <añadir> <item> (en|a)<my_list>
        response: item_added
        expansion_rules:
          my_list: "[ mi| la] lista [de] [la] [compra]"

HA gets manzas a l as <item> then a as (a) then lista de la compra as <my_list>.

To workaround this I extended the intent:

language: "es"
intents:
  HassShoppingListAddItem:
    data:
      - sentences:
          - "apunta {shopping_list_item:item}."
        response: item_added

With this I just have to say apunta manzanas.

To be noticed that the final . avoids having manzanas. on your list.

luca-angemi avatar Nov 14 '23 06:11 luca-angemi

Reopening the issue. The problem is not fixed and still happens in the last version, both with to-do lists and with the shopping list.

The problem is caused because of the wildcard rule, that currently matches partial words. In order to make it work, I've made a change in the to-do list sentence definition so we always require the definite article "la lista" in order to avoid false recognitions (but then ignoring sentences without the definite article).

@synesthesiam Could we make some kind of change so the {shopping_list_item:item} wildcard only matches full words (and never partial words), so Añadir manzanas a la lista de la compra never matches manzanas a l as the item name?

We should be able to support all these sentences: Añadir manzanas a lista de la compra Añadir manzanas a la lista de la compra

But now, if we define a rule like <añadir> <item> (en|a) [la] lista de la compra, it will always identify manzanas a l as the item list.

davefx avatar Nov 14 '23 10:11 davefx

Related to https://github.com/home-assistant/hassil/issues/92

tetele avatar Mar 07 '24 07:03 tetele

I could try to find another sentence that works and add it with a higher precedence over the wildcar, but what puzzles me the most is: Why does this not fail when running the tests? That worries me because the tests should catch this kind of situations.

cibernox avatar Mar 07 '24 08:03 cibernox