Drop optional word

Hello,

like the topic say, I want to drop a optional word.
I try:
foo [bar]:
But doesn´t work.
What I do wrong?

Thanks in front :slight_smile:
Mili

Did you try [bar:]? Works for me

1 Like

Ah okay! facepalm!
Thanks a lot! :slight_smile:

That works, but so I have to do it for every word at its own.
[foo: | bar: | foo: bar:]
Is there a way to make it for all words within [ ]?

@Miliano What are you trying to accomplish? Why remove words? Can you tell us more about your use case?

I want to remove the filler words between the needed keywords.
For example:
Turn on the (socket | device):socket [on | on the | at | in | the | in the ] (hall | room | place):hall
I want only to give out: socket hall and not socket on hall or socket in hall, …
In english the example is not so easy for me. My motherlanguage is german and in german there are a lot of words can be used, to say the same :wink:

And if I get only socket hall, it is much easyer to work with in continue … For example to switch it in node red

This should have worked, but didn’t: [foo | bar | baz]:

I’ve created a bug report :slight_smile:

1 Like

May I ask why you do not use slots for this?

I use this in slots, I only want to make it easyer

I have a list: devices
and in the list
(socket | device):socket [on | on the | at | in | the | in the ] (hall | room | place):hall
(socket | device):socket [on | on the | at | in | the | in the ] (bath | bathroom):bath
mediacenter
printer
(media | USB | movie):media (HDD | harddisk):HDD

Or what do you mean?
Put the filler words in a extra list?
I have make no good experince with to short words in a list

:smiley: :hall … get to :marshall_islands :smiley:

From the way you described why you want to do that, it sounds like you take the sentence that rhasspy detects and work on that. rhasspy does have slot functionallity, where you specify in the sentences that you want a specific part of it in a slot that you can access later.

For example:

[Timer]
stelle einen timer (für | auf) (0..300) {time_delay} (minuten | minute)

By adding {time_delay} after the numbers, rhasspy will add a slot called time_delay that contains the value rhasspy understands for me to later use in the json it outputs.

This it what rhasspy gives out when I ask it to set me a timer:

{
    "entities": [
        {
            "end": 24,
            "entity": "time_delay",
            "raw_end": 27,
            "raw_start": 23,
            "raw_value": "fünf",
            "start": 23,
            "value": 5,
            "value_details": {
                "kind": "Number",
                "value": 5
            }
        }
    ],
    "intent": {
        "confidence": 1,
        "name": "Timer"
    },
    "raw_text": "stelle einen timer auf 5 minuten",
    "raw_tokens": [
        "stelle",
        "einen",
        "timer",
        "auf",
        "5",
        "minuten"
    ],
    "recognize_seconds": 0.24004597397288308,
    "slots": {
        "time_delay": 5
    },
    "speech_confidence": 1,
    "text": "stelle einen timer auf 5 minuten",
    "tokens": [
        "stelle",
        "einen",
        "timer",
        "auf",
        "5",
        "minuten"
    ],
    "wakeword_id": null
}

As you can see there is a part containing the slot with its value:

"slots": {
        "time_delay": 5
 }

So if you put anything you care about in a slot you don’t need to drop words to make it easier because you don’t have to work with the sentence directly.

1 Like

You mean something like this:

(socket | device) [on | on the | at | in | the | in the ] (hall | room | place) {socket hall}
?

Because then i can´t work only with socket or hall alone
Example
all socket can be put on/off directly - normal use
An later I need only if hall is in it, ask for are you sure?
My red node flows switch by word after word and there for it is easyer for me.

To describe it in english and not showing the complete thinks behind, is not so easy :smiley:

And this way, I also have more to write and can´t copy and paste so easy too :wink:

If you have devices and rooms it can be easier to have 2 slots : one for devices (or device types) and one for rooms. The filler words will then be outside the slots.

You’ll get:

{
  "slots": {
    "device": "socket",
    "room": "hall"
  }
}

This is much easier to work with than parsing words and kind of the point of the natural language processing (NLU) service provided by Rhasspy.

1 Like

I have a list rooms also …
But socket can be in more rooms and a room must be given, but for example printer I only have one, and no room is needed.
so the socket room is part of the socket name
Hope this make sence!? :smiley:

Thanks for all the participation
But, it´s a bug, will be fixed in future and then I´m (more) happy again. :wink:
Because in the background all works so great, I not realy want to change it.
As can be seen from the way I defend my style! :smiley:

Thanks all, stay healthy
Mili