# RegexEntityExtractor

**URL:** <https://forum.rasa.com/t/regexentityextractor/47799>\
**Category:** Rasa Open Source\
**Created:** [September 17, 2021, 9:14am UTC](https://forum.rasa.com/t/regexentityextractor/47799 "2021-09-17T09:14:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![john.christian](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@john.christian](https://forum.rasa.com/u/john.christian)\
**Post date:** [September 17, 2021, 9:14am UTC](https://forum.rasa.com/t/regexentityextractor/47799/1 "2021-09-17T09:14:27Z")

</div>

I needed to add the RegexEntityExtractor to my pipeline to make use of lookup lists. That part seemed to work fine which is great… but there have been some strange regressions in other areas. For example cellphone numbers +61414487283 are being extracted correctly +61414487283 but then also the entire number is being broken down into its digits

61414

… and so on until the end of the number

Here’s my pipeline:

pipeline:

- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: RegexEntityExtractor case\_sensitive: False use\_lookup\_tables: True use\_regexes: True
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer analyzer: char\_wb min\_ngram: 1 max\_ngram: 4
- name: DIETClassifier epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector epochs: 100 retrieval\_intent: faq
- name: ResponseSelector epochs: 100 retrieval\_intent: chitchat
- name: ResponseSelector epochs: 100 retrieval\_intent: out\_of\_scope
- name: FallbackClassifier threshold: 0.2 ambiguity\_threshold: 0.001

---

<div class="post-metadata">

**Author:** ![john.christian](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@john.christian](https://forum.rasa.com/u/john.christian)\
**Post date:** [September 17, 2021, 9:24am UTC](https://forum.rasa.com/t/regexentityextractor/47799/2 "2021-09-17T09:24:55Z")

</div>

Sorry, the first post didnt really show the markup.

it’s breaking the cell into

```auto
[6](buyer_min_num_bedrooms)
[1](buyer_min_num_bedrooms)
[4](buyer_min_num_bedrooms)
[1](buyer_min_num_bedrooms)
[4](buyer_min_num_bedrooms)

```

etc

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [September 17, 2021, 9:28am UTC](https://forum.rasa.com/t/regexentityextractor/47799/3 "2021-09-17T09:28:12Z")

</div>

@john.christian Please format the above code whilst using ‘’’ ‘’’

@john.christian Means you want the output should come like 61414… as intact not break up? Yes or No?

---

<div class="post-metadata">

**Author:** ![john.christian](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@john.christian](https://forum.rasa.com/u/john.christian)\
**Post date:** [September 17, 2021, 9:33am UTC](https://forum.rasa.com/t/regexentityextractor/47799/4 "2021-09-17T09:33:04Z")

</div>

It’s basically detecting two entities from one string.

It’s detecting “+61414487222” as a cell number slot. that’s correct. But its also detecting each digit as another slot that is called “buyer\_min\_num\_bedrooms” which is generally a 1 digit number. and its doing this for every number in the cell phone number.

---

<div class="post-metadata">

**Author:** ![john.christian](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@john.christian](https://forum.rasa.com/u/john.christian)\
**Post date:** [September 17, 2021, 9:34am UTC](https://forum.rasa.com/t/regexentityextractor/47799/5 "2021-09-17T09:34:11Z")

</div>

I’ve just noticed I have this warning too

UserWarning: Parsing of message: ‘+61414487222 start new openhome session with 413 for the property 52’ lead to overlapping entities: +61414487222 of type user\_mobile\_number extracted by DIETClassifier overlaps with 6 of type buyer\_min\_num\_bedrooms extracted by RegexEntityExtractor. This can lead to unintended filling of slots. Please refer to the documentation section on entity extractors and entities getting extracted multiple times:[Components](https://rasa.com/docs/rasa/components#entity-extractors)

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [September 17, 2021, 9:42am UTC](https://forum.rasa.com/t/regexentityextractor/47799/6 "2021-09-17T09:42:41Z")

</div>

> [@john.christian](#):
>
> RegexEntityExtractor

@john.christian I guess this is because of RegexEntityExtractor and DIET Classifier as both extract the entity.

@john.christian Are you using Regex for lookup table only or did you even give some examples?

Check this:

**Description**

This component extract entities using the [lookup tables](https://rasa.com/docs/rasa/nlu-training-data#lookup-tables) and [regexes](https://rasa.com/docs/rasa/nlu-training-data#regular-expressions-for-entity-extraction) defined in the training data. The component checks if the user message contains an entry of one of the lookup tables or matches one of the regexes. If a match is found, the value is extracted as entity.

This component only uses those regex features that have a name equal to one of the entities defined in the training data. Make sure to annotate at least one example per entity. **Ref:** [Components](https://rasa.com/docs/rasa/components/#regexentityextractor)

OR

may be create custom nlu component that will filter extracted entities

OR

You can use Duckling component to extract the telephone numbers?

OR

Try give more training examples and even delete the older models and train again.

---

<div class="post-metadata">

**Author:** ![john.christian](https://avatars.discourse-cdn.com/v4/letter/j/a4c791/32.png) [@john.christian](https://forum.rasa.com/u/john.christian)\
**Post date:** [September 17, 2021, 9:44am UTC](https://forum.rasa.com/t/regexentityextractor/47799/7 "2021-09-17T09:44:56Z")

</div>

yes… so I am wondering how I can possibly use a lookup list? I only need the lookup list for one slot - but DIETClassifiers can’t look at lookup lists correct? So that’s why I added Regex Entity - how do others handle lists? I can’t remove the DIETClassifier…
