Slots programs don't works

Hi,

I’m currently programming voice assistant in python that uses rhasspy-nlu for the intent recognition.

It works great ! Until now, all my intents were well recognized.

I want to use the number slot program for example to set the volume :

set volume{action:set_volume} (1..100){value}

The issue is that this sentence is not recognised at all. My tests fails only on this sentence.

It’s the first time I have to use slot programs, but slots works well for all my sentences.

I’ve replaced the paths to slots and slot_programs with the rhasspynlu.get_slots_replacements functions and I’ve put the number slot_program behin slot_programs/rhasspy/number following the Rhasspy documentation.

Can someone help me please ?

Numbers do not required a file in slot_programs. The are supported without it:

https://rhasspy.readthedocs.io/en/latest/training/#number-ranges

Thanks for your answer but it doesn’t solve my issue.
Even if I delete the number slot_programs (that is exactly the same that the built-in slot program number), it doesn’t work anymore.

According to the docu @romkabouter pointed to, Rhasspy internally uses a piece of code named num2words. Did you also include that in your own code?

Within Rhasspy, all these forms work to my personal experience:

[de.fhem:SetNumeric]
...
etwasProzent=( <etwas> | [um] [(0..100){Value}] [prozent{Unit:percent}] ) 
etwasLauter=( <etwas> | [um] [(0..10){Value!int}] [dezibel{Unit:decibel}] )
...
<cmdmulti> [<den>]  <setHundred> [<rooms>] auf (0..100){Value!float}
...

Addition: What may not work, are real float numbers as mentionned here: Using real numbers in sentences (0.5, 22 point 5, etc)

Yes, I’ve already import num2words in my code.

For the moment, I just need that works with integers but thanks for the link, should be quickly useful :wink:


Following the documentation above, "number ranges are actually references to the rhasspy/number slot program. Where is it located ? I can’t find it.
It is generated by the numbers.py script in the rassphynlu package isn’t it ?

I haven’t signify something maybe important : I work on Windows without Linux WSL

So what is the actual error you are getting?

I don’t have an explicit error providing by rhasspy.
In fact, my program just use the rhasspynlu python package and not all the Linux architecture of Rhasspy.
For that, following the documentation, I’ve specify my own slots and slot_programs directories :

self.slots = os.path.join(self.profile_dir, "slots")
self.slot_programs = os.path.join(self.profile_dir, "slot_programs")
        
intents = rhasspynlu.parse_ini(open(os.path.join(self.profile_dir, "sentences.ini"), "r").read())
replacements = rhasspynlu.get_slot_replacements(intents, slots_dirs=[Path(self.slots)],
                                                        slot_programs_dirs=[Path(self.slot_programs)])
self._graph = rhasspynlu.intents_to_graph(intents, replacements=replacements)

With that, the slots works well.
In the slot programs directory, I’ve tried to put the number slot program, directly under “slot_programs/” and under “slot_programs/rhasspy”, but both doesn’t work : the sentence with number range is not recognised.

Ah ok, sorry but I can’t help you with that custom code.

No worry, thanks for your time !