# Extracting Names

**URL:** <https://forum.rasa.com/t/extracting-names/42729>\
**Category:** Rasa Open Source\
**Created:** [April 21, 2021, 7:35pm UTC](https://forum.rasa.com/t/extracting-names/42729 "2021-04-21T19:35:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 21, 2021, 7:35pm UTC](https://forum.rasa.com/t/extracting-names/42729/1 "2021-04-21T19:35:56Z")

</div>

Hello,

I understand there are multiple ways to retrieve a name that has been inputted by the user by using slots, entities, etc. But that takes a lot of training since there are so many names in the world. So, I was wondering if there is a simpler way to extract any name that is given.

I am wanting the bot to respond using the name the user inputs.

For example:

User: Hello, my name is **Jack**.

Bot: Nice to meet you **Jack**. How can I assist you?

I was thinking there is probably a way to do this with a custom action but I am unable to figure out how to do it. Any help is greatly appreciated.

Thank you.

---

<div class="post-metadata">

**Author:** ![kearnsw](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/kearnsw/32/4838_2.png) [@kearnsw](https://forum.rasa.com/u/kearnsw)\
**Post date:** [April 21, 2021, 8:58pm UTC](https://forum.rasa.com/t/extracting-names/42729/2 "2021-04-21T20:58:49Z")

</div>

There is a great resource on this topic from @koaning.

> **[Proper Name Detection](https://blog.rasa.com/named-name-recognition/)**
>
> Detecting names in a user message is a common challenge when designing a virtual assistant. It's a task many Rasa users face, which is why you can find many questions on the topic in the Rasa forum. It’s also an issue that is more complicated than...

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 22, 2021, 1:44am UTC](https://forum.rasa.com/t/extracting-names/42729/3 "2021-04-22T01:44:27Z")

</div>

Thank you so much! It worked. I ended up going with the lookup table option. What I didn’t realize before is that when you write an intent like “Hello. My name is **Daniel** ”, that you are able to replace other names for it. I thought you were restricted to just **Daniel.** After realizing you don’t have to train every single name, it is finally working. Thank you thank you!

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 22, 2021, 2:05am UTC](https://forum.rasa.com/t/extracting-names/42729/4 "2021-04-22T02:05:07Z")

</div>

However, after doing more tests on it, I realize some of the responses from the bot return as **None** instead of the inputted name. Is that because I haven’t trained it enough? Or why is that?

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [April 22, 2021, 7:04am UTC](https://forum.rasa.com/t/extracting-names/42729/5 "2021-04-22T07:04:48Z")

</div>

One extra thing to point out → there’s a collection of international name lists over at the [rasa-nlu-examples](https://rasahq.github.io/rasa-nlu-examples/) project. In particular, for English names, you can look [here for USA names](https://github.com/RasaHQ/rasa-nlu-examples/tree/main/data/namelists/usa).

If you’re using namelists though, you might notice a slowdown (regexes can be slow when there’s 10000s of them). If that’s the case, you might want to check out the experimental [FlashTextEntityExtractor](https://rasahq.github.io/rasa-nlu-examples/docs/extractors/flashtext/).

To answer your final question: are you 100% sure that you name list is exhaustive? Can you also share your `config.yml`?

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 22, 2021, 5:48pm UTC](https://forum.rasa.com/t/extracting-names/42729/6 "2021-04-22T17:48:31Z")

</div>

![config file](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/f/f5e7563c866da1e09f2e55a51195dd2580fe8b51.png)

Posted the config.yml file up above. I am trying the FlashTextEntityExtractor as you suggested. And the name list is filled with 18239 names. It is just a text file full of names I found online. Is that what you are asking when you say exhaustive?

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 22, 2021, 6:05pm UTC](https://forum.rasa.com/t/extracting-names/42729/7 "2021-04-22T18:05:03Z")

</div>

Update:

the config.yml image that was posted above would not train since it contained two Tokenizers. I took out the SpacyTokenizer and it trained. Just as a heads up if you are going to refer to it.

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [April 23, 2021, 7:26am UTC](https://forum.rasa.com/t/extracting-names/42729/8 "2021-04-23T07:26:50Z")

</div>

My concern is that no list of names is technically exhaustive. Perhaps, I should rephrase; when the bot responds `None`, does the name that you’re giving it appear in your list?

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [April 23, 2021, 4:11pm UTC](https://forum.rasa.com/t/extracting-names/42729/9 "2021-04-23T16:11:47Z")

</div>

Yes, it does. It appears in the list but still responds as `None`. I just assumed it was because I didn’t have enough examples trained. @koaning

.

.

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [April 26, 2021, 8:43am UTC](https://forum.rasa.com/t/extracting-names/42729/10 "2021-04-26T08:43:54Z")

</div>

Could you share the output from a `rasa interactive` session that demonstrates the issue?

Also, just to confirm, you’ve read the documentation [at the bottom here](https://rasahq.github.io/rasa-nlu-examples/docs/extractors/flashtext/)? The NLU file needs to have the lookup table **and** needs three examples of the entities in the NLU data as well.

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [May 21, 2021, 5:59pm UTC](https://forum.rasa.com/t/extracting-names/42729/11 "2021-05-21T17:59:10Z")

</div>

Sorry it has been a minute. I never found the time to respond. But yes, I can provide the rasa interactive. And I did follow the rasa documentation for the lookup table but I went ahead and watched some other videos on the lookup tables and it says I can instead use a file directory directing to all the names such as the names.txt file instead of providing them all in the nlu.yml file. That should work relatively similarly right? I have also provided much more than three examples. Around 100 examples I have trained. @koaning

---

<div class="post-metadata">

**Author:** ![koaning](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/koaning/32/6626_2.png) [@koaning](https://forum.rasa.com/u/koaning)\
**Post date:** [May 25, 2021, 7:28am UTC](https://forum.rasa.com/t/extracting-names/42729/12 "2021-05-25T07:28:55Z")

</div>

Even if you have a lookup table, I think you still need to have a few examples in your NLU file used with intents. Like so;

```auto
- intent: inform_home_country
  examples: |
    - I am from [Afghanistan](country)
    - My family is from [Albania](country)
    - I was born in [Turkey](country)

```

Without (I think) at least three such examples in the NLU data, the training loop might ignore it.

---

<div class="post-metadata">

**Author:** ![prospect](https://avatars.discourse-cdn.com/v4/letter/p/7ab992/32.png) [@prospect](https://forum.rasa.com/u/prospect)\
**Post date:** [May 28, 2021, 3:07am UTC](https://forum.rasa.com/t/extracting-names/42729/13 "2021-05-28T03:07:22Z")

</div>

Thank you for responding so quickly. The example you gave above of the NLU file, my examples are trained identically to that. And I have over 100 examples trained similarly to that with the lookup table having more than 15,000 names. So, I don’t know exactly why it was still outputting **None** for some of the names but what I am just going to do is just keep training it and giving it more examples like the one you gave above and see if that ends up solving the problem. If it keeps continuing and I am still unable to figure it out, I’ll make a new thread for it and hopefully solve the problem then. Otherwise, thank you so much for all the help you have given and it has helped out greatly!

Thank you.
