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

Wildcard capitalization issues during recognition #84

Open
tetele opened this issue Nov 14, 2023 · 2 comments
Open

Wildcard capitalization issues during recognition #84

tetele opened this issue Nov 14, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@tetele
Copy link
Contributor

tetele commented Nov 14, 2023

Fixtures:

entities:
  - name: "Joseph"
    id: "person.jospeh"
    state: "home"
  - name: "Ada"
    id: "person.ada"
    state: "Work"
  - name: "John"
    id: "person.john"
    state: "not_home"

Sentences and tests:

lists:
  zone:
    wildcard: true
intents:
  HassGetState:
    data:
      - sentences:
          - "is anyone [<in>] [the] {zone:state}"
        response: any
        slots:
          domain: person
tests:
  - sentences:
      - "is anyone at Work"
    intent:
      name: HassGetState
      slots:
        domain: person
        state: Work
    response: "Yes, Ada"

produces

E                           AssertionError: Expected work, got Work for slot state for: is anyone at Work
E                           assert 'Work' == 'work'
E                             - work
E                             ? ^
E                             + Work
E                             ? ^

tests/test_language_sentences.py:143: AssertionError
@synesthesiam synesthesiam added the bug Something isn't working label Jan 4, 2024
@synesthesiam synesthesiam self-assigned this Jan 4, 2024
@super-qua
Copy link

I think this issue here might also be the reason why the shopping_list_item slot in the intents is always transformed to lowercase when matched.

I am sure there are use cases where ignoring upper-/lowercase make sense, but for some it produces problems (especially in other languages).

maybe this can be achieved with an optional config like preserve_case, defaulting to False?

@super-qua
Copy link

although having a quick look at the code it doesn't seem straight forward, as casefold can change the length of the text and therefore the index of the wildcard match in the original text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants