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

Having a wildcard at the end of sentence creates weird results #98

Open
salleq opened this issue Jan 4, 2024 · 0 comments
Open

Having a wildcard at the end of sentence creates weird results #98

salleq opened this issue Jan 4, 2024 · 0 comments
Assignees

Comments

@salleq
Copy link

salleq commented Jan 4, 2024

#tests #1
language: fi
tests:
  - sentences:
      - laita omena minun ostoslistalleni
      - laita omena listalle
      - lisää omena ostoslistalle
# Below sentences create an error
      - lisää mun ostoslistalle omena
      - laita miun ostoslistalle omena

    intent:
      name: HassShoppingListAddItem
      slots:
        item: "omena "
    response: "omena lisätty"
#sentence
language: "fi"
intents:
  HassShoppingListAddItem:
    data:
      - sentences:
          - (lisää|laita) <item> <my_list>
          - (lisää|laita) <my_list> <item>
        response: item_added
        expansion_rules:
          my_list: "[minun|mun|miun] [ostos]lista[lle|lleni|llemme] "
          item: "{shopping_list_item:item}"

This is the error I get when running tests with:

pytest tests --language fi -k HassShoppingListAdd
E                           AssertionError: Expected omena, got omena  for slot item for: lisää mun ostoslistalle omena
E                           assert 'omena ' == 'omena'
E                             - omena
E                             + omena 
E                             ?      +

I would expect all test go through, but the sentences where the word "omena" ("apple") is last, it needs to be added without the whitespace at end. The below works:

#tests #2
language: fi
tests:
  - sentences:
      - laita omena minun ostoslistalleni
      - laita omena listalle
      - lisää omena ostoslistalle

    intent:
      name: HassShoppingListAddItem
      slots:
        item: "omena "
    response: "omena lisätty"

  # Below sentences only work when the item is given without the whitespace in the end.
  - sentences:
      - lisää mun ostoslistalle omena
      - laita miun ostoslistalle omena

    intent:
      name: HassShoppingListAddItem
      slots:
        item: "omena"
    response: "omena lisätty"
@synesthesiam synesthesiam self-assigned this Jan 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants