Logical Problem with sentences (Optional and null words)

i use rhasspy now for a bit - and again i can only say: its awesome :slight_smile: .
Today i played a little bit with the sentences and i constructed the following:

room = ( office | bedroom | living room | unknown){room}
source = (Spotify | Airplay ){what}
play{state:on} <source> [(in | at the)] <room> (:){explicit=on}
play{state:on} <source> (:){room:unknown} (:){explicit=off}

(Sorry, if the sentences above are not so good english or may be senseless (in english) - i translated them from german)

Training and everything else works.
Now - by giving rhasspy the folllowing sentences:
“play airplay at the office” results in

   state: "on"
    what: "airplay"
    room: "office"
explicit: "on"

“play airplay” results in

   state: "on"
    what: "airplay"
    room: "unknown"
explicit: "off"

until now everything is fine. Finally the following sentence:
“play airplay at the kitchen” (kitchen is an non existing room!!!) results in:

   state: "on"
    what: "airplay"
    room: "unknown"
explicit: "off"

it says explicit is off but it should be on. Why does it say off - i am confused :confused:.

Reason behind all this: I’d like to bring rhasspy to understand a “miss understood” room so that he can say “Sorry I didn’t understand your target room”. This depends on the parameter explicit - if explicit is off rhasspy (or better node red and home assistant) target the next available WiFi speaker.
Can you help me?

Regards, Chewy

Hi @chewyf5, this is a good question. Without the word “kitchen” in your sentences, Rhasspy is not going to know that it’s even a word. Internally, it will probably be interpreted as “spoken noise” and discarded.

Are you using Kaldi or Pocketsphinx? For Kaldi, I’ve done a little bit of work with a special “word” called <unk> that represents “unknown”. I haven’t tested this yet in a set of sentences, but this might be a good case for it.

The idea would be to put <unk> in like this:

play{state:on} <source> (in | at the) (<room> | <unk>:unknown) (:){explicit=on}

Now if someone says “play airplay in the kitchen”, it would get transcribed as “play airplay in the unknown” and you could handle it.

This won’t work right now because <unk> conflicts with the syntax for rules. I’ll either need to come up with some new syntax or reserve <unk> for this special case.

Hello synesthesiam,

at the moment I am using pocketsphinx indeed. As soon as you bring the “unknown word” - I change, because this is quiet a game changer for me. But - no stress - I think you have enough to do with the dialog manager at the moment. And that is (even for me) much more important -I can’t wait to have a conversation with my “home” via mqtt and node red (with home assistant as my “do the switching and sensoring stuff”-tool).

I will not mark this thread as solved - but I will keep an eye on it, as soon your “unknown word” comes into play.

Kind Regards and Stay Healthy