# Extracting Entities End-to-End Rasa training

**URL:** <https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746>\
**Category:** Rasa Open Source\
**Created:** [October 12, 2022, 11:45pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746 "2022-10-12T23:45:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![parisapouya](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@parisapouya](https://forum.rasa.com/u/parisapouya)\
**Post date:** [October 12, 2022, 11:45pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/1 "2022-10-12T23:45:07Z")

</div>

Hi,

I am doing some experiments with e-2-e on rasa opensource and I am interested in extracting entities from end-to-end stories. I am facing the following yml syntax issue when training:

```auto
> story:
> steps:
> - bot: Can I have your phone number?
> - user: [123-456-7890](phone_number)

Error:
YamlSyntaxException: Failed to read 'data/stories.yml'. while parsing a block mapping
      - user: [123-456-7890](phone_number) 
        ^ (line: 53)
expected <block end>, but found '<scalar>'

```

How can I solve this error?

Also, I would highly appreciate it if you can give me recommendations regarding the config.yml file for e-2-e with entity extraction. Thanks!

---

<div class="post-metadata">

**Author:** ![edu\_vives](https://avatars.discourse-cdn.com/v4/letter/e/7993a0/32.png) [@edu\_vives](https://forum.rasa.com/u/edu_vives)\
**Post date:** [October 13, 2022, 7:48am UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/2 "2022-10-13T07:48:07Z")

</div>

> [@parisapouya](#):
>
> `expected <block end>, but found '<scalar>'`

I’m not at all familiar with the End-to-end training data format, but I think the error may be due to the missing hyphen ( - ) in front of the keyword **story**.

Hyphens, spaces, tabs, new lines… are essential for the file to be read correctly without any error.

In this case the keyword **story** should start with a hyphen and be at the same level as step, see this example:

![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/1/b/1bcf57cf5f8c6a8f122909f98e56db3d8c2eee92.png)

I hope it helps 😉

---

<div class="post-metadata">

**Author:** ![rasa\_learner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/rasa_learner/32/21721_2.png) [@rasa\_learner](https://forum.rasa.com/u/rasa_learner)\
**Post date:** [October 13, 2022, 8:38am UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/3 "2022-10-13T08:38:58Z")

</div>

Hi, you can use [YAML Checker](https://yamlchecker.com/) to check your YAML files.

**Also, start your story with a user message (intent)**.

Your line 53 is not valid (here line 5)

 ![2022-10-13 (3)q](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/d/1/d127f4a5d8cf070dc9aae0c7873c5b03dcc84c62.png)

The following YAML is valid

![2022-10-13 (4)q](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/3X/6/d/6d6b855c949aa32d08d67ac9e0446c6618132a41.png)

If this doesn’t work, then please provide your complete stories so we can check for \<_block end_\>

---

<div class="post-metadata">

**Author:** ![parisapouya](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@parisapouya](https://forum.rasa.com/u/parisapouya)\
**Post date:** [October 19, 2022, 5:09pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/4 "2022-10-19T17:09:35Z")

</div>

Hi and thank you for your response. I have tried testing my yml file using online tools and it is correct. My problem is with “tagging entities” within end-to-end stories.

---

<div class="post-metadata">

**Author:** ![parisapouya](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@parisapouya](https://forum.rasa.com/u/parisapouya)\
**Post date:** [October 19, 2022, 5:12pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/5 "2022-10-19T17:12:06Z")

</div>

I know that if I add words (i.e., string) in front of those numbers and symbols, the yml file will be correct. But I cannot modify the text. I need to keep the format as is…

---

<div class="post-metadata">

**Author:** ![parisapouya](https://avatars.discourse-cdn.com/v4/letter/p/73ab20/32.png) [@parisapouya](https://forum.rasa.com/u/parisapouya)\
**Post date:** [October 19, 2022, 6:08pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/6 "2022-10-19T18:08:27Z")

</div>

I think it might be better to re-phrase my issue. I am trying to extract numbers (e.g., money, phone-number, doorplate, etc. that are not accompanied by any strings) as entities. For instance, imagine the following part of my story:

```auto
- story: story_with_numbers_as_entities
  steps:
  - user: Hi! I want to know how much downpayment is there for leasing a BMW i8?
  - bot: Can you please tell me your annual income?
  - user: 150,000$

```

Now, I want to extract the user’s income (i.e., 150,000$) as an entity ({entity: money, role: annual\_income}), so my story would look like below:

```auto
- story: story_with_numbers_as_entities
  steps:
  - user: Hi! I want to know how much downpayment is there for leasing a BMW i8?
  - bot: Can you please tell me your annual income?
  - user: [150,000$]{"entity": "money", "role": "annual_income"}

```

This annotation leads to a yml error, but it is the format that rasa requires (atleast within the nlu file). Adding quotations such as “[150,000$]{“entity”: “money”, “role”: “annual\_income”}” or “[150,000$]{entity: money, role: annual\_income}” also leads to yml and rasa errors.

I have tried looking for an example where stand-alone numbers are extracted as entities, but there is no one single example.

---

<div class="post-metadata">

**Author:** ![stephens](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/stephens/32/1632_2.png) [@stephens](https://forum.rasa.com/u/stephens)\
**Post date:** [November 4, 2022, 8:59pm UTC](https://forum.rasa.com/t/extracting-entities-end-to-end-rasa-training/55746/7 "2022-11-04T20:59:36Z")

</div>

Hi Parisa,

As you’ve probably seen, e2e is experimental. I’m not aware of any production bots using this feature. You should switch to standard intents.

For entity extraction, there’s a good blog post on this topic [here](https://rasa.com/blog/rasa-nlu-in-depth-part-2-entity-recognition/). Duckling is best for numbers and dates.

You would then use forms or separate intents to extracting different numeric values depending on your use case.

Greg
