Slot definition with embedded spaces in slot values

Words like ‘kitchen’, ‘sunroom’, and ‘bedroom’ are no problem. ‘living room’ and ‘dining room’ require parentheses to be recognized properly (or so it appears). Where I’ve run into an issue is composing sentences using syntax that returns more than one word.

I just ran into this early this morning, trying to rewrite my definitions more generically. I apologize in advance for not having explicit examples prepared just yet. When I return home tonight, I’ll copy in my slots and sentences and maybe someone can advise me where I’m going wrong.

Thanks for reading!

Maybe I just didn’t get the problem, but I use these values in my slot, and it works
"motion service","kodi service","sleep timer",etc...

I had trouble using the slots files and totally broke Rhasspy trying so instead I put them in my sentences.ini under an intent called Rules, for now.

Example:
room_name = ((kitchen | (back porch) | (front porch) | (back yard) | (front room) | (back entry) | mudroom) {name})

I doubt you need the start (after room_name = ) and ending (after {name}) parentheses but they don’t seem to hurt.

Here’s my slot definition:

    "lights": [
        "(outside lights):group.lights_outdoor",
        "(inside lights):group.lights_indoor",
        "(downstairs lights):group.lights_downstairs",
        "(indoor lights):group.lights_indoor",
        "(bedroom lamp):switch.bedroom_lamp",
        "(dog lamp):switch.living_room_3",
        "(upstairs lights):group.lights_upstairs",
        "(brass lamp):switch.living_room_2",
        "(outdoor lights):group.lights_outdoor",
        "(rabbit lamp):switch.sunroom_rabbit_lamp",
        "(all lights):group.all_lights"
    ],
    "state_on_off": [
        "off",
        "on"
    ],

and these are the offending sentences:

[ChangeLightState]
light = {lights}
status = {state_on_off}
( turn | switch ) <status> [the] <light>
( turn | switch ) [the] <light> <status>
<light> <status>

and the error reported is:

Training failed: <Task: language_model:intent_counts>: TaskError Command error: 'ngramcount /profiles/en/intent.fst /profiles/en/intent.fst.counts' returned 139 

@FredTheFrog, I’m going to take a stab at this, I think you need to change a couple of things, I think it should look like this:

[ChangeLightState]
(turn | switch) ($state_on_off) [the] ($lights)
(turn | switch) [the] ($lights) ($state_on_off)
($lights) ($state_on_off)

And if you want to reference the slots then it would look like this:

[ChangeLightState]
(turn | switch) ($state_on_off){state}  [the] ($lights){lights}
(turn | switch) [the] ($lights){lights} ($state_on_off){state}
($lights){lights} ($state_on_off){state}

I think that should work for you.

2 Likes

MUCH appreciated, @TinyDoT :slightly_smiling_face:
That definitely alleviated the error 139.
Now to update the HA automations!!

@FredTheFrog, I’m glad that helped.

It’s solved, but just FYI
To use rules try it this way

[ChangeLightState]
light = ($lights) {lights}
status = ($state_on_off) {state}

( turn | switch ) <status> [the] <light>
( turn | switch ) [the] <light> <status>
<light> <status>
3 Likes