Extracting Names


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.

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

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!

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?

One extra thing to point out → there’s a collection of international name lists over at the rasa-nlu-examples project. In particular, for English names, you can look here for USA names.

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.

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

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?


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.

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?

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



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? The NLU file needs to have the lookup table and needs three examples of the entities in the NLU data as well.

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

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;

- 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.

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.

1 Like