How to extract data from json to yml of Rasa?

From tutorial I saw this:

- intent: order_food
  examples: |
    - I want to order a food
    - can I get some food, please
    - Let's order some food

- intent: inform_food
  examples: |
    - [steak](food)
    - [pasta](food)
    - [sushi](food)
    - [burger](food)

this is in my nlu.yml, can I extract those food examples from json? how to do that? should I write some kind of script that will extract my json and write those things in here?

You’re using an intent for entity extraction which is not a good idea. You should provide the entity examples within the context of intents like your order_food intent or collect the entity as part of a form.

Regarding converting from json, I would probably just write a convert tool to create the NLU examples in yaml from json. I’ve seen jinja2 used for this.

For something more involved, you could create a custom importer.

can you show example how it is done properly?

- intent: order_food
  examples: |
    - I want to order a [steak](food)
    - can I get some [pasta](food), please
    - Let's order some [sushi](food)
1 Like

so I do not need this part:

- intent: inform_food
  examples: |
    - [steak](food)
    - [pasta](food)
    - [sushi](food)
    - [burger](food)

or maybe this, what you wrote is better to show rasa and at the same time, belowe provide intent with more examples of food?

You should delete that. You should also go through the training class to get a good overview of Rasa. Make sure you become familiar with forms.

1 Like

can you please tell me is this correct way?:

- intent: my_country
  examples: |
    - I am from [Poland](country_name)
    - I live in [Germany](country_name)

-  : country_name
  examples: |
    - Poland
    - Germany
    - France
    - Italy
    - Spain
    - Portugal
    - Greece
    - Norway
    - Sweden

I also found in training class that you suggested:

nlu:
-synonym:credit
examples: |
- credit card account
- credit account?

the first one is from this udemy curs: https://www.udemy.com/course/how-to-build-chatbot-with-python-rasa-open-source/?referralCode=495AF5CC2CDA2A2A2EAF

and second one is from:

are there more ways to provide plenty of examples to one entity? I know that there is a way as you said in “within the context of intents”(I can use synonyms in there) but there can be plenty of examples

and how about lookup table? those are the final list of all entities examples? It means that from others I can make my rasa learn and from those I can not, because it is final list?