# Spacy and regex for entity extraction

**URL:** <https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318>\
**Category:** Rasa Open Source\
**Created:** [March 19, 2020, 11:41am UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318 "2020-03-19T11:41:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![amvas](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@amvas](https://forum.rasa.com/u/amvas)\
**Post date:** [March 19, 2020, 11:41am UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/1 "2020-03-19T11:41:44Z")

</div>

Hi all and @akelad

Can I use SpacyEntityExtractor with regex patterns at the same time. My plan is to extract the names using SpacyEntityExtractor while postal codes are extracted by regex patterns?

Thanks, AV

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [March 19, 2020, 12:55pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/2 "2020-03-19T12:55:07Z")

</div>

Yeah, you can use both!

---

<div class="post-metadata">

**Author:** ![amvas](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@amvas](https://forum.rasa.com/u/amvas)\
**Post date:** [March 19, 2020, 1:46pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/3 "2020-03-19T13:46:42Z")

</div>

Thanks for the fast reply. Could you please tell me how? Any example?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [March 20, 2020, 7:29am UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/4 "2020-03-20T07:29:23Z")

</div>

Just the way it’s described here for regex: [Training Data Format](https://rasa.com/docs/rasa/nlu/training-data-format/)

The `SpacyEntityExtractor` doesn’t need any training data

---

<div class="post-metadata">

**Author:** ![amvas](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@amvas](https://forum.rasa.com/u/amvas)\
**Post date:** [March 20, 2020, 4:30pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/5 "2020-03-20T16:30:49Z")

</div>

@akelad, thanks for the info provided, quite helpful. If I understood your point well, we can add “SpacyEntityExtractor” in the pipeline and have “regex:” in nlu data (with no example), right?

In this case, do I still need to have “ **RegexFeaturizer** ” in the pipeline?

AV

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [March 23, 2020, 2:52pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/6 "2020-03-23T14:52:49Z")

</div>

`regex:` doesn’t affect `SpacyEntityExtractor`. If you want to use just the `SpacyEntityExtractor`, you don’t need any regex examples, or `RegexFeaturizer` in the pipeline. But if you want to use some regex features for intent classification or other entity extraction, you would need it.

---

<div class="post-metadata">

**Author:** ![Anjalipatel](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Anjalipatel](https://forum.rasa.com/u/Anjalipatel)\
**Post date:** [February 18, 2021, 12:47pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/7 "2021-02-18T12:47:09Z")

</div>

Hello @akelad , I want to use `SpacyEntityExtractor` for dimensions: [“PERSON”]. could you please tell me what all changes i need to do in my project files.

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![Anjalipatel](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@Anjalipatel](https://forum.rasa.com/u/Anjalipatel)\
**Post date:** [February 18, 2021, 12:49pm UTC](https://forum.rasa.com/t/spacy-and-regex-for-entity-extraction/26318/8 "2021-02-18T12:49:26Z")

</div>

Hii @amvas were you able to extract name entity using SpacyEntityExtractor ? I want to extract the name from user input. Please let me know if there is any way. Thanks!
