Slot within word

Hi everybody,

I’m using version 2.4.20 and cannot currently upgrade because of technical problems with that version, but that is another issue.

I have understood the better part of the syntax for slots and sentences.

Now I have the following situation when I want to give a command to turn devices on or off. In German the most direct sentence would be: deviceName EINschalten
So the desired state EIN (=on) is included in the verb schalten (=switch), not a seperate word.

I’d think that is also what I have configured:

From sentences:

[SwitchDevice]
($deviceName){deviceName} ($onOffState){onOffState}schalten
schalte ($deviceName){deviceName} ($onOffState){onOffState}

From slots:

"onOffState": [
        "aus",
        "ein"
    ]

Now when speaking the command or just entering the text on the front page and using the “get intent” button the text needs to contain a space character for Rhasspy to provide me the full json block with slots.

In other words:
This works: EIN schalten
This doesn’t work: EINschalten

I’d think the first line would not work and second line would because the above config does not contain a space character.

Now when speaking the command I would not normally include a short pause, the the recognized result would normally be 1 word, which is why the intent is not recognized.

Does anybody have an idea how I could resolve that?

just do it like this:

($deviceName){deviceName} (einschalten:ein | ausschalten:aus){onOffState}

this will replace einschalten with ein und ausschalten with aus after recognition.

Maybe this can also help you:

[ChangeLightState]
light_name = $lampe {name}
light_state = ((ein|an):ein | (aus|ab):aus | heller | dunkler) {state}
[(schalte | schalt)] [(die | das | den)] <light_name> [wieder] <light_state>
(((deaktiviere):aus)|((aktiviere):ein)) {state} [(die | das | den)] <light_name>
<light_name> [wieder] ((ausschalten|deaktiviere|abschalten):aus | (einschalten|anschalten|aktiviere):ein) {state}

That did the trick. Thank you very much!!!

1 Like

you can also do things like (einschalten:ein | (ausschalten | abschalten):aus){onOffState} This substiution feature is really usefull as you can see from my sentences that i posted.

For all the things you can do in your sentences take a look at this:

You can even do things like ((default|):default | something){thing} which will give you a value for nothing. This can be usefull if you want certain variations of a sentece to have different values for not saying a slot value.

That sounds reasonable. I’ll optimize my sentences with that.

I’m not sure I understand that. Could you give me a usage example?

Ok

(stell | stelle) [mir](den|einen|meinen) wecker [für] (heute|((morgen|):morgen)|übermorgen| $rhasspy/days){tag} auf (((viertel vor):-15)|((viertel nach):15)|(halb:-30)|:0){minute} (1..23) {stunde} [uhr]

If i speak: stell den wecker auf 9 uhr i will get the following slots:
tag: “morgen”
minute: “0”
stunde: 9
and as a text i will get "stell den wecker morgen auf 0 9 uhr"

I also got this sentences for the same intent:
(stell | stelle) [mir] (den | meinen |einen) wecker (für | auf) ((heute |):heute | morgen | übermorgen | $rhasspy/days){tag} [auf] (0..23){stunde} uhr (0..59){minute}

because of that "stell einen wecker auf 15 uhr 20" would result in the following slots:
tag: “heute”
stunde: 15
minute: 20

Hope this explanation helps a bit .

I also posted a few more of my intents if you want to take a look at them. German Intent example sentences

Sorry for the delay in response. I appreciate the collection of sentences. I’ve helped myself a bit from there already!