# Custom EntityExtractor when implemented , default entity extractor stops working

**URL:** <https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827>\
**Category:** Rasa Open Source\
**Created:** [November 28, 2019, 11:05am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827 "2019-11-28T11:05:17Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [November 28, 2019, 11:05am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/1 "2019-11-28T11:05:17Z")

</div>

I am trying to add a custom entity extractor to extract entities (lookup) with incorrect spellings. However, when I add that custom extractor inside pipelines configuration, right below SpactEntityExtractor and CRFEntityExtractor, only custom extractor is working and default two extractors are not working. However, if I remove custom extractor, I am able to get entities from CRF and Spacy.

Did I miss something or all three extractors are supposed to work?

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [November 28, 2019, 2:23pm UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/2 "2019-11-28T14:23:04Z")

</div>

Do you get any error? Can you paste it here?

How does you pipeline look like? Can you share the code of your custom extractor?

You can have as many extractors as you like. So, it should be possible to add all.

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 6, 2019, 8:03am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/3 "2019-12-06T08:03:25Z")

</div>

It was my mistake I guess. I didn’t know the position of pipelines matter. My custom component was after CRF and spacy’s and once I moved it before them, it started working. I am not sure if that was the case either. Sorry for the late reply though. Thank you!

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 6, 2019, 8:06am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/4 "2019-12-06T08:06:17Z")

</div>

Furthermore, can you confirm the method to pass defaults params through pipeline for custom component.

Suppose my default should be like {'param\_1: [‘a’,‘b’]}

How should I pass these through config file.

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [December 6, 2019, 5:47pm UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/5 "2019-12-06T17:47:14Z")

</div>

If your custom component defines some default values like

```auto
    defaults = {
        "param_1": [‘a’,‘b’]
    }

```

you can overwrite those in your `config.yml` file by

```auto
language: en

pipeline:
  - name: "WhitespaceTokenizer"
  - name: "YourCusomComponent"
    param_1: ['c', 'd']
...

```

Does that answer your question?

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 9, 2019, 10:37am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/6 "2019-12-09T10:37:38Z")

</div>

Yes, I did the exact same thing but somehow it didn’t work.

My custom component is defined as below. It takes lookup name and autocorrect the spelling mistake in the entities. For example I have horoscope lookup, so if someone types arias. I will make a autocorrected noun to be ‘aries’. I am trying to send the name of lookups through the params in config and it is not working.

```auto
class AutocorrectNouns(Component):
    """A pre-trained sentiment component"""

    name = "autocorrect_nouns"
    provides = ["entities"]
    requires = []
    defaults = {"lookup":["horoscopelist"]}
    language_list = ["en"]

```

## In My config

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/4/4c6ccd6a197fa6fe5dd10e1ff1e21c64d51727b5.png)

but is not working.

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [December 9, 2019, 1:06pm UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/7 "2019-12-09T13:06:16Z")

</div>

What exactly is not working? Do you get any error? If yes, please paste it here. Is the path to your custom component in the `config.yml` correct? Are you sure it is called? Would be great if you could paste some log here. It also might help to start your bot in debug mode `--debug` to get more log statements.

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 10, 2019, 4:47am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/8 "2019-12-10T04:47:14Z")

</div>

Below is my config, where I have added my custom component named “autocorrect\_entity.AutocorrectNouns” and params lookup: [‘horoscopelist’] ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/c03b3c7a7347d7f3a0d3df383c54b6b5ca627345.png)

And my custom Component:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/d/d862d3a4a4491d7edfc06aa1d856f5d25350318b.png)

As you can see, near the cursor, I have printed the default params. But on training, the parameters are empty.

Now, on doing

```auto
rasa train -vv

```

I see no error, and prams printed is empty as well.

Here’s the screenshot

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/6827b569e8ac92b451c4caec621827978f6ae299.png)

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [December 10, 2019, 9:11am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/9 "2019-12-10T09:11:51Z")

</div>

You should use

```auto
self.component_config["lookup"]

```

instead of

```auto
self.defaults["lookup"]

```

The defaults you define in your component and the configuration parameters from the `config.yml` file are all written to `self.component_config` in the init of the component. Can you adapt your code and check if it is working?

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 10, 2019, 10:04am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/10 "2019-12-10T10:04:38Z")

</div>

> [@Tanja](#):
>
> self.component\_config[“lookup”]

Yes it worked. I didn’t go through documentation thoroughly, my bad. Thank you for your help.

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 10, 2019, 10:07am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/11 "2019-12-10T10:07:39Z")

</div>

I have been constantly conversing questions. I had next query.

When you update something in your custom component and you head towards training. The “rasa train” command throws “Nothing changed. You can use the old model stored at '/var/www/ek-assistant/models/20191210-154804.tar.gz”

So, I need to force update to reflect the changes, right? Currently, I either delete all models and retrain or do “rasa train --force”. Is there any other way?

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [December 10, 2019, 10:11am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/12 "2019-12-10T10:11:12Z")

</div>

> [@sarmilaupadhyaya](#):
>
> So, I need to force update to reflect the changes, right? Currently, I either delete all models and retrain or do “rasa train --force”. Is there any other way?

No, those are the two possibilities.

---

<div class="post-metadata">

**Author:** ![sarmilaupadhyaya](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sarmilaupadhyaya/32/5801_2.png) [@sarmilaupadhyaya](https://forum.rasa.com/u/sarmilaupadhyaya)\
**Post date:** [December 10, 2019, 10:22am UTC](https://forum.rasa.com/t/custom-entityextractor-when-implemented-default-entity-extractor-stops-working/21827/13 "2019-12-10T10:22:31Z")

</div>

Oh, thank you! It would be wonderful if it can automatically acknowledge the changes. But both approaches seem easy for now.
