Problems with Number Ranges & Converters

Hi everyone,

I’m trying to use Number Ranges for the first time, and I’m running into some problems.

Number ranges are defined in the documentation like this:

So I made a sentence with a Number Range

Set a timer for (0..60){Amount!int} (seconds | minutes){TimeUnit} [from now]

Then I use the web interface to input the sentence & Get the Intent with:

set a timer for 20 seconds from now

However, when it’s evaluated, I get the following output:

{"text": "Set a timer for 0..60 seconds from now", "intent": {"name": "SetTimer", "confidence": 0.88}, "entities": [{"entity": "Amount!int", "value": "0..60", "raw_value": "0..60", "start": 16, "raw_start": 16, "end": 21, "raw_end": 21}, {"entity": "TimeUnit", "value": "seconds", "raw_value": "seconds", "start": 22, "raw_start": 22, "end": 29, "raw_end": 29}], "raw_text": "Set a timer for 0..60 seconds from now", "tokens": ["Set", "a", "timer", "for", "0..60", "seconds", "from", "now"], "raw_tokens": ["Set", "a", "timer", "for", "0..60", "seconds", "from", "now"], "speech_confidence": 1, "slots": {"Amount!int": "0..60", "TimeUnit": "seconds"}

So the 20 is not recognized as a number and instead, the slot value is “0…60”

Another issue I have with this case is that the Slot name in the json is called “Amount!int”. I would have thought that the “!int” part would be stripped.

Any ideas on either of these things? Am I doing somethings wrong here?


I’ve had a look at the code and found the regex pattern:

NUMBER_RANGE_PATTERN = re.compile(r"^(-?[0-9]+)\.\.(-?[0-9]+)(,[0-9]+)?$")

From that I could deduce that the correct syntax would be:

Set a timer for 0..60{Amount!int} (seconds | minutes){TimeUnit} [from now]

But I’m still getting the same intent json when I run my sentence. Any advice here?

Correct syntax: (1..120){duration_mins} minutes


I went back to that

Set a timer for (0..60){Amount} (seconds | minutes){TimeUnit} [from now] 

But still, the outcome is exactly the same.

{“text”: “Set a timer for 0…60 seconds from now”, “intent”: {“name”: “SetTimer”, “confidence”: 0.88}, “entities”: [{“entity”: “Amount”, “value”: “0…60”, “raw_value”: “0…60”, “start”: 16, “raw_start”: 16, “end”: 21, “raw_end”: 21}, {“entity”: “TimeUnit”, “value”: “seconds”, “raw_value”: “seconds”, “start”: 22, “raw_start”: 22, “end”: 29, “raw_end”: 29}], “raw_text”: “Set a timer for 0…60 seconds from now”, “tokens”: [“Set”, “a”, “timer”, “for”, “0…60”, “seconds”, “from”, “now”], “raw_tokens”: [“Set”, “a”, “timer”, “for”, “0…60”, “seconds”, “from”, “now”], “speech_confidence”: 1, “slots”: {“Amount”: “0…60”, “TimeUnit”: “seconds”}, “time_sec”: 0.060211896896362305}

Seems there is some problems yes, can’t get it recognized

Also when testing with allume pendant dix minutesit no longer works

[ERROR:2020-04-10 09:58:45,576] rhasspyserver_hermes: object of type 'int' has no len()
Traceback (most recent call last):
  File "/usr/lib/rhasspy-voltron/.venv/lib/python3.7/site-packages/quart/", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy-voltron/.venv/lib/python3.7/site-packages/quart/", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy-voltron/rhasspy-server-hermes/rhasspyserver_hermes/", line 1329, in api_text_to_intent
  File "/usr/lib/rhasspy-voltron/rhasspy-server-hermes/rhasspyserver_hermes/", line 2425, in text_to_intent_dict
    result = await core.recognize_intent(text, intent_filter=intent_filter)
  File "/usr/lib/rhasspy-voltron/rhasspy-server-hermes/rhasspyserver_hermes/", line 432, in recognize_intent
    raise NluException(result.error)
rhasspyserver_hermes.NluException: object of type 'int' has no len()

Got a fix in the pipeline for this. Having some issues getting the Docker image pushed…

1 Like

Any progress on this? I get a similar exception when trying to use a custom converter in a container built from the latest Docker image. In addition, the built in bool converter seems broken. It always returns true regardless of the input. E.g. the raw input “false” produces the JSON value true as does the number 0 and everything else I’ve tried. Best guess is that it is doing something analogous to JavaScript “casting” rather than parsing which is always problematic where booleans are concerned.

For now, I am not using any converters in sentences.ini and doing all my JSON processing at the receiving end of intent processing (e.g. JSONata expressions in Node-RED flows that consume Rhasspy output). But that is a bit fragile. I would far prefer to send “proper” JSON to start with…

This is working for me in master, at least. I am still trying to push an updated Docker image with my changes (DockerHub timeout issues).

I can confirm this. It doesn’t even work with a chain of conversions like 0!int!bool for some reason. Can you open a GitHub issue for that specifically? I think I’ll write a custom bool function instead that just matches “false”, “FALSE”, etc.

Done. Please see

1 Like