Adding expansion_rules:

Hi. Is it possible to extend global expansion_rules for Sentences, with my own? Searched for it in documentation but found nothing.

Yes, create _common.yaml and override the value, keeping the old options intact (if they are needed).

language: en
expansion_rules:
  exp: "(var1|var2|var3|new_one)"
1 Like

@mchk thanks for your reply, but where file should be located?

config/custom_sentences/en/_common.yaml

Substitute your language code for “en”.

1 Like

@jackjourneyman thanks, but when I copied the content of _common.yaml from intents repository to config/custom_sentences/uk/_common.yaml, VSCode intergration warns me with such error

image

also

image

Finally after reboot rules I’ve added are not working

I get the same error messages, but _common.yaml still works - I think this is VSCode lagging behind developments in HA.

I think your language code needs to be in quotes.

language: "uk"
1 Like

@jackjourneyman thanks a lot it works correct. One more qestion. What is the best way to explain to assist different name endings of areas in my house? expansion_rules or make aliases?

I’ve never done it for areas, but I would think that aliases would be better - that’s certainly what I would do for entities.

1 Like

Now i have very strange situation with areas. Assist tries to recognize areas as floors with just one area exception, it is recognized correcly. Can i override, for example light_HassTurnOn.yaml, excluding floor section(I think I do not really need it). Tried to put modified light_HassTurnOn.yaml into config/custom_sentences/uk/, but it does not effect the result. Assist still tries to recognize area as floor

Have you checked your floor and area definitions? Sounds as if there’s some duplication - area and floor using the same alias, perhaps?

I’ve double-checked no name duplication. But whi it does not recognize overriden light_HassTurnOn.yaml?

Trying to solve a similar problem and stumbled across this thread. I want assist to support the sentence “add chocolate to our shopping list”. This currently works for “my shopping list” but my partner and I often say “our” instead of “my”.

I’ve created the file in \config\custom_sentences\en_common.yaml with the following content:

language: "en"
expansion_rules:
  my_list: "[my|the|our] {name} [list]"

Saved and did a quick restart to load the config but it won’t recognise the sentence. I must be missing something but not sure what I need to do. Does anyone have any ideas?

There are some wrong steps you have done. Undo the changes and then create this file and make the required change.

1 Like

Amazing! Thank you very much. I did try adding that code in the responses.yaml file but now I see where I was going wrong. To make these changes, I need to recreate the corresponding original file in my custom_sentences directory then make the changes I want.

Thanks a lot for your help.

You’re welcome! I offered you a simpler instruction to avoid any mistakes (this intent uses local expansion rules), and now I can add some details. The file name can be anything; the key is to ensure the correct file structure with sections inside. All files inside the folder are merged when the dialog module is loaded.

language: "en"
responses:
intents:
lists:
expansion_rules:
skip_words:

After that, you specify the existing intent name (in this case, HassShoppingListAddItem), which needs to be modified. You can write everything in a single file, including your own custom sentences/responses. Оr, alternatively, split them into separate files in a way that suits your convenience.

Got it, thanks. I already have a file in the “en” folder called custom.yaml so I’d rather merge it all into there.

Just copied across the shopping list code, reloaded conversation config and it’s still working.

Thanks again!