Number range not working

I am trying to use a number range, but I can’t seem to get it to work.

My goal is to recognize an intent to set the volume on a media player.

This is the intent (German text, translation beneath)

[SetVolume]
lautstärke auf (0..100){volume} prozent
set volume to (0..100){volume} percent

Maybe try setting

[SetVolume]
volume_level = (0…100){volume}
lautstärke auf <volume_level> prozent

but no idea why your current isn’t working

I have tried that.
The documentation is verystraightforward, I don’t see what I could be doing wrong.

Maybe there is a bug with the German translation? Is there a was I could debug this?

This is the json return when try to enter the sentence in the frontend

If I try to to speak the sentence, the number does not get recognized. Therefore I suppose there must be something going wrong at the training stage.

Only had that problem with 0 -> null not getting recognized as state - dont know what could be wrong in your case.

example of my sentences:

[Wecker]
(Stell | Stelle) [den] Wecker auf (ein:1 | Null:0 | (1…23)){stunden} Uhr [(1…59){minuten}]

EDIT: Just remembered - Try using the intent recognition with OpenFST instead of fuzzywuzzy :slight_smile:

Well, that was it!

When I remove the 0 from the range, the intent works as intended.

Thank you @Sikk

Hi Sikk,
I am also having an issue with number ranges that I intend to use to dim lights and to set blinds. For static lights, dimmable lights and blinds I am using commands in my sentences.ini that are nearly identical. Since I am not using HA but ioBroker instead device ids and states/values are sent to my mqtt server.

While everything is fine with static lights, the levels used for dimmers and blinds are not assigned correctly to the devices’ states.

These are my sentences:

[ChangeDeviceState]
($device_change_command_synonyms) [(die | das)] ($device_switch_name){device} ($device_state){value} (:){state:.STATE}

[ChangeDimmerLevel]
dimmer_level = (ein:1 | (1…100)){value}
($device_change_command_synonyms) [(die | das | den)] ($device_dimmer_name){device} [auf] <dimmer_level>{value} (:){state:.LEVEL} [Prozent]

[ChangeBlindLevel]
blind_level = (ein:1 | (1…100)){value}
($device_change_command_synonyms) [(die | das | den)] [Rollladen] [im] ($device_blind_name){device} [auf] <blind_level>{value} (:){state:.State} [Prozent]

and this is an extract of my slots:

"device_blind_name": [
    "(schlafzimmerlinks):javascript.0.Rollladen.SchlafzimmerLinks",
    "(umkleidezimmer):javascript.0.Rollladen.Umkleidezimmer",
    "(schlafzimmerrechts):javascript.0.Rollladen.SchlafzimmerRechts"
],
"device_change_command_synonyms": [
    "stell",
    "stelle",
    "schalt",
    "setz",
    "schalte",
    "setze"
],
"device_dimmer_name": [
    "(haengelampe):hm-rpc.0.OEQ5555555.1",
    "(schreibtischlampe | bürolampe):hm-rpc.0.MEQ8888888.1",
    "(sideboardlampe):hm-rpc.0.LEQ0987654.1",
    "(stehlampe | wohnzimmerlampe):hm-rpc.0.LEQ2222222.1"
],
"device_state": [
    "aus:false",
    "ein:true",
    "an:true"
],
"device_switch_name": [
    "(allekuechenlampen):",
    "(rechtekuechenlampe):hm-rpc.0.OEQ1234567.1",
    "(medienschrank):rflink.0.channels.milightv1_1.all_01",
    "(beidekuechenlampen):",
    "(allelampen):",
    "(schlafzimmerlampe | tannenbaum | mobilesteckdose):hm-rpc.0.LEQ2323232.1",
    "(mobilesteckdose):hm-rpc.0.LEQ0470470.1",
    "(linkekuechenlampe):hm-rpc.0.OEQ2872872.1",
    "(esszimmerlampe):hm-rpc.0.OEQ2435460.1"
],

The Rhasspy speech tab shows for static lights:

Sentence: schalte die hm-rpc.0.OEQ1234567.1 false .STATE

ChangeDeviceState

hm-rpc.0.OEQ1234567.1 device
.STATE state
false value

Raw Intent JSON
“intent”:
“entities”:
0:
“end”: 33
“entity”: “device”
“raw_end”: 30
“raw_start”: 12
“raw_tokens”:
0: “rechtekuechenlampe”
“raw_value”: “rechtekuechenlampe”
“start”: 12
“tokens”:
0: “hm-rpc.0.OEQ1234567.1”
“value”: “hm-rpc.0.OEQ1234567.1”
1:
“end”: 39
“entity”: “value”
“raw_end”: 34
“raw_start”: 31
“raw_tokens”:
0: “aus”
“raw_value”: “aus”
“start”: 34
“tokens”:
0: “false”
“value”: “false”
2:
“end”: 46
“entity”: “state”
“raw_end”: 34
“raw_start”: 35
“raw_tokens”:
“raw_value”: “”
“start”: 40
“tokens”:
0: “.STATE”
“value”: “.STATE”
“intent”:
“confidence”: 1
“name”: “ChangeDeviceState”
“raw_text”: “schalte die rechtekuechenlampe aus”
“raw_tokens”:
0: “schalte”
1: “die”
2: “rechtekuechenlampe”
3: “aus”
“recognize_seconds”: 0.00936987399472855
“siteId”: “default”
“slots”:
“device”: “hm-rpc.0.OEQ1234567.1”
“state”: “.STATE”
“value”: “false”
“speech_confidence”: 0.36087698508522514
“text”: “schalte die hm-rpc.0.OEQ1234567.1 false .STATE”
“tokens”:
0: “schalte”
1: “die”
2: “hm-rpc.0.OEQ1234567.1”
3: “false”
4: “.STATE”
“wakeId”: “”

and for dimmers and blinds:

Sentence: setze die hm-rpc.0.LEQ0987654.1 auf 80 .LEVEL prozent

ChangeDimmerLevel

hm-rpc.0.LEQ0987654.1 device
.LEVEL state
value

Raw Intent JSON
“intent”:
“entities”:
0:
“end”: 31
“entity”: “device”
“raw_end”: 24
“raw_start”: 10
“raw_tokens”:
0: “sideboardlampe”
“raw_value”: “sideboardlampe”
“start”: 10
“tokens”:
0: “hm-rpc.0.LEQ0987654.1”
“value”: “hm-rpc.0.LEQ0987654.1”
1:
“end”: 38
“entity”: “value”
“raw_end”: 36
“raw_start”: 29
“raw_tokens”:
0: “achtzig”
“raw_value”: “achtzig”
“start”: 36
“tokens”:
0: 80
“value”: 80
2:
“end”: 38
“entity”: “value”
“raw_end”: 36
“raw_start”: 29
“raw_tokens”:
“raw_value”: “”
“start”: 36
“tokens”:
“value”: “”
3:
“end”: 45
“entity”: “state”
“raw_end”: 36
“raw_start”: 37
“raw_tokens”:
“raw_value”: “”
“start”: 39
“tokens”:
0: “.LEVEL”
“value”: “.LEVEL”
“intent”:
“confidence”: 1
“name”: “ChangeDimmerLevel”
“raw_text”: “setze die sideboardlampe auf achtzig prozent”
“raw_tokens”:
0: “setze”
1: “die”
2: “sideboardlampe”
3: “auf”
4: “achtzig”
5: “prozent”
“recognize_seconds”: 0.058644142001867294
“siteId”: “default”
“slots”:
“device”: “hm-rpc.0.LEQ0987654.1”
“state”: “.LEVEL”
“value”: “”
“speech_confidence”: 0.2548045540182028
“text”: “setze die hm-rpc.0.LEQ0987654.1 auf 80 .LEVEL prozent”
“tokens”:
0: “setze”
1: “die”
2: “hm-rpc.0.LEQ0987654.1”
3: “auf”
4: 80
5: “.LEVEL”
6: “prozent”
“wakeId”: “”

The intents in mqtt look like this:

[ChangeDeviceState]
{“device”: “hm-rpc.0.OEQQ0987654.1”, “value”: “false”, “state”: “.STATE”}

[ChangeDimmerLevel]
{“device”: “hm-rpc.0.OEQ1234567.1”, “value”: “”, “state”: “.LEVEL”}

So the question is, why the values of the levels are not being assigned correctly although the are identified correctly.

Can anybody help please? Thank you in advance.

Thomas (tobetobe)

Ich schreibe das mal in deutsch,weill das meiner Meinung nach ein “deutsches Problem” ist.
Der Fehler ist bei mir auch aufgetreten und zwar nur bei der Benutzung von pocketsphinx als speech recognition. Und nur bei DEUTSCH.
Ändert man die auf Kaldi, klappt das Ganze. Diesen Tip habe ich aus diesem Forum.

This error comes, if you use pocketsphinx as speech recognition with GERMAN language. Change it to Kaldi und everything ist eine.

Hallo, vielen Dank für deine Antwort, thanks for your reply. I am going to respond in English again. I tested Kaldi and got this failure message after training restart and after ech training:

KaldiDecoder Missing HCLG.fst Graph not found at /profiles/de/kaldi/model/graph/HCLG.fst. Did you train your profile?

Do you have any idea how this problem can be resolved? Does anybody else know?

Press “TRAIN” :smiley:

Trank you. I know of course and did That several times. However Training always Results in the error Message I posted.

So again my question: What can I do / what needs to be done to resolve this Problem?

Sorry. But thats’s the way I did. I got the same message, pressed train and it works.
Did it on Linux docker . Not Raspi.

No problem at all. I very much appreciate your help.

Obviously something seems to be wrong wigh Kaldi download or Kaldi configuration.

Who is familiar wirh this in depth and can help me out?


kaldi._2
This is screenshot of my profile folder. check, if it lokks like that. Maybee kaldi folder doesnt exist. Try to switch back to other service, remove folder-content and retry.
good luck

Thank you for your proposal. I also had the idea to delete all Kaldi folders and related files and to reinstall Kaldi then. Unfortunately I will not be able to test before next weekend. I will keep you updated.

Hi again,
I now had a chance to look after Kaldi. After deleting the Kaldi folder and all Kaldi* files I reinstalled Kaldi successfully. The Kaldi intent recognition works now. However the result regarding the handling of number ranges remains the same as with pocketsphinx.

While all sentence parameters are identified correctly the value, which is also correctly derived from the number range, is not transmitted to the device. Thus my mqtt intent looks like this:

{“device”: “hm-rpc.0.MEQ0123456.1”, “value”: “”, “state”: “.LEVEL”}

It should look like this instead.

{“device”: “hm-rpc.0.MEQ0123456.1”, “value”: “80”, “state”: “.LEVEL”}

The Raw Intent JSON shows these values:

“slots”:
“device”: “hm-rpc.0.MEQ0123456.1”
“state”: “.LEVEL”
“value”: “”
“speech_confidence”: 1
“text”: “schalte die hm-rpc.0.MEQ0123456.1 auf 30 .LEVEL prozent”
“time_sec”: 0.10810065269470215
“tokens”:
0: “schalte”
1: “die”
2: “hm-rpc.0.MEQ0123456.1”
3: “auf”
4: 30
5: “.LEVEL”
6: “prozent”
“transcribe_seconds”: 0
“wakeId”: “”
“wav_seconds”: 0

It is obvious that in the slots section no value or an empty value respectively ("") is assigned, and that token #4 contains the right number (40 in this case) indeed, but it is not written in apostrophes. This must be the failure.

Please compare with a light that is only switchable and can’t be dimmed:

“slots”:
“device”: “hm-rpc.0.LEQ9876543.1”
“state”: “.STATE”
“value”: “false”
“speech_confidence”: 1
“text”: “schalte die hm-rpc.0.LEQ9876543.1 false .STATE”
“time_sec”: 0.024109840393066406
“tokens”:
0: “schalte”
1: “die”
2: “hm-rpc.0.LEQ9876543.1”
3: “false”
4: “.STATE”
“transcribe_seconds”: 0
“wakeId”: “”
“wav_seconds”: 0

The slot value is “false” and token #3 is also “false”.

To summarize: the failure is independent from the intent recognition system (Kaldi or Pocketsphinx) and it occurs in Rhasspy 2.4.17 as well as in 2.4.18. From my perspective something seems to be wrong in the code.

My platform: Pi3 with Buster and Docker

Is there anything I can do? Can anyone help me please?

Dear Rhasspy team,

I now can announce that I have found a solution regarding the assumed failure with number ranges. The failure was caused by slightly wrong syntax in my sentence:

As you can see, I am using internal and external definitions in my sentence. Since external definitions like ($device_dimmer_name), which is located in “slots”, always require their subsequent identifier ({device} in this case), internal definitions MUST NOT be followed by their identifier ({value} in this case). So the correct sentence looks like this:

[ChangeDimmerLevel]
dimmer_level = (ein:1 | (1…100)){value}
($device_change_command_synonyms) [(die | das | den)] ($device_dimmer_name){device} [auf] <dimmer_level> (:){state:.LEVEL} [Prozent]

Many thanks to all people who tried to help