synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
950 stars 101 forks source link

number ranges not working #145

Closed basnijholt closed 4 years ago

basnijholt commented 4 years ago

I am trying to use the following sentence with number ranges:

[SetVolume]
set [the] volume to (0..100){volume} [percent]

However, when I say "set the volume to 20%", it gives me this as intent: image

Do I need to activate something to make it work or is this a bug?

synesthesiam commented 4 years ago

If you're using a virtual environment, make sure to do a pip3 install --upgrade -r requirements.txt to upgrade the dependencies. Forgot to add this to the docs.

basnijholt commented 4 years ago

I have installed Rhasspy via Hass.io.

basnijholt commented 4 years ago

Oh, I didn't realize I am using a brand new feature :)

synesthesiam commented 4 years ago

Ok, thanks. Something seems to be wrong with one of the pypi packages. Will get fixed soon.

KiboOst commented 4 years ago

Got problems also with docker container just updated:

While training:

[ERROR:603628] train: number_range_transform Traceback (most recent call last): File "/usr/share/rhasspy/rhasspy/train/init.py", line 233, in number_range_transform step = int(match.group(3)[1:]) TypeError: 'NoneType' object is not subscriptable [ERROR:603627] train: number_range_transform Traceback (most recent call last): File "/usr/share/rhasspy/rhasspy/train/init.py", line 233, in number_range_transform step = int(match.group(3)[1:]) TypeError: 'NoneType' object is not subscriptable

Here is the sentence for example: allume [dans] [le | la] ($house_room){house_room} [pendant | durant] (0..120){tempsminutes} minutes

tried this, does the same:

allume [dans] [le | la] ($house_room){house_room} [pendant | durant] (0..120){duration!int} minutes

Also, got 0..120 as unknown word.

synesthesiam commented 4 years ago

Just pushed a fix. This is why I shouldn't try to code right before bed :man_facepalming:

KiboOst commented 4 years ago

Ahah !

Seems you can go to bed now ! In which country are you ? Often asked myself about your timezone lol

Updated, and my rhasspy batcher show now:

[ MATCHED] TimeTurnOnJeedom | query: allume dans la cuisine pendant douze minutes | confidence:1.0 | Slots: | duration_mins : 12 | house_room : cuisine [ MATCHED] TimeTurnOnJeedom | query: allume la cuisine pendant trente minutes | confidence:1.0 | Slots: | duration_mins : 30 | house_room : cuisine [ MATCHED] TimeTurnOnJeedom | query: allume le champi d'axel pendant dix minutes | confidence:1.0 | Slots: | device_name : champi_Axel | duration_mins : 10 [ MATCHED] TimeTurnOffJeedom | query: éteins dans la cuisine pendant douze minutes | confidence:1.0 | Slots: | duration_mins : 12 | house_room : cuisine [ MATCHED] TimeTurnOffJeedom | query: laisse le globe d'axel éteint pendant vingt minutes | confidence:1.0 | Slots: | device_name : globe_Axel | duration_mins : 20 [ MATCHED] TimeTurnOffJeedom | query: laisse la cuisine éteinte pendant 25 minutes | confidence:1.0 | Slots: | duration_mins : 25 | house_room : cuisine

matched: 6 | unmatched: 0 | total: 6

Good night dude!

synesthesiam commented 4 years ago

I'm in the U.S., but I finished coding that last (broken) piece last night and forgot to fix it before pushing the new version this morning :/

timaschew commented 4 years ago

I'm using docker and get this output

Screen Shot 2020-01-08 at 00 15 13

For this setence: setze Lautstärke auf 5 prozent with this ini file:

[SetVolume]
setze [die] Lautstärke auf (0..100){volume} [Prozent]

Even the token values are __convert__int.

docker image version:

$ docker inspect b87dac217a9d | grep Image
        "Image": "sha256:6932f518345479dde443b605a499af89347e3a6493f2a0acc0ed6fcacf4140df",
            "Image": "synesthesiam/rhasspy-server:latest",

$ docker images | grep rhasspy
synesthesiam/rhasspy-server   latest              6932f5183454        2 days ago          1.3GB
synesthesiam commented 4 years ago

Weird. I just tried this on the de profile and I get the expected output. Can you pull the latest image (baf9707bd412), re-train with the "no-cache" option, and try again? Thanks.

timaschew commented 4 years ago

I've updated but didn't help: Here is the full output:

{
  "entities": [
    {
      "end": 93,
      "entity": "volume",
      "raw_end": 93,
      "raw_start": 25,
      "raw_value": "__convert__int __convert__int null __converted__int __converted__int",
      "start": 25,
      "value": "__convert__int __convert__int null __converted__int __converted__int"
    }
  ],
  "intent": {
    "confidence": 0.86,
    "name": "SetVolume"
  },
  "raw_text": "setze die lautstärke auf __convert__int __convert__int null __converted__int __converted__int prozent",
  "raw_tokens": [
    "setze",
    "die",
    "lautstärke",
    "auf",
    "__convert__int",
    "__convert__int",
    "null",
    "__converted__int",
    "__converted__int",
    "prozent"
  ],
  "siteId": "default",
  "slots": {
    "volume": "__convert__int __convert__int null __converted__int __converted__int"
  },
  "speech_confidence": 1,
  "text": "setze die lautstärke auf __convert__int __convert__int null __converted__int __converted__int prozent",
  "time_sec": 0.2532923221588135,
  "tokens": [
    "setze",
    "die",
    "lautstärke",
    "auf",
    "__convert__int",
    "__convert__int",
    "null",
    "__converted__int",
    "__converted__int",
    "prozent"
  ],
  "wakeId": ""
}

I've triggered this via the webinterface, put it into the textfield next to sentence.

What's also strange is that this sentence: setze die Lautstärke auf fünf Prozent is recognized as

"intent":
"entities":
"intent":
"confidence": 0.86
"name": "GetTemperature"
"raw_text": "wie ist die temperatur"

This seems to me like another bug, no? I mean I've put text as input not a sound file.
And also with a confidence of 86%?

Here is my full ini file.

[SetVolume]
setze [die] Lautstärke auf (0..100){volume} [Prozent]
stelle [die] Lautstärke auf (0..100){volume} [Prozent]

[GetTime]
wie spät ist es
sag mir die Uhrzeit

[GetTemperature]
wie ist die Temperatur
wie (heiß | kalt) ist es

[GetGarageState]
ist das Garagentor (offen | geschlossen)

[ChangeLightState]
light_name = (Wohnzimmerlampe | Garagenlicht) {name}
light_state = (ein | aus) {state}
schalte (die | das) <light_name> <light_state>
timaschew commented 4 years ago

Oh, I've changed the recognition from fuzzywuzzy to fsticuffs and not it works!

timaschew commented 4 years ago

But is this expected that it only works with fsticuffs? I didn't find this in the docs.

NullEnt1ty commented 4 years ago

@timaschew

But is this expected that it only works with fsticuffs? I didn't find this in the docs.

I don't think that this is expected behavior. This might be related to https://github.com/synesthesiam/rhasspy/issues/147#issuecomment-570987225.