How to provide the lookup entities in .txt format

Hi, I am little confused with providing the entities in .txt in lookup file. What should be the format of the .txt file

  1. [‘Rakesh’, ‘Micheal’,‘Stan’,‘Rita’]
  • Rakesh
  • Micheal
  • Stan
  • Rita

I have tried three approches none of them are succesfull in extracting entities rather than example entity provided in file. If I ma doing anything wrong please specify.

you need to write each entities separated by a new line : for example :

@JiteshGaikwad Thank you. I have tried that, But still it is not getting recognised. How to provide in file like:

intent: greet

  • Hi, I am [Rakesh] (name)

lookup: name


so when I type Hi, I am santhosh. santhosh should be entity right. but not recognising santhosh as entity even if it is in names.txt file I have also tried names.txt instead of ./names.txt which basically I shouldnot But tried.

did you include the 2-3 examples in your utterances which are in your lookup tables?

@JiteshGaikwad Yes I did. like see the input file.

hey rakesh can you add some more examples i mean 2-3 matching entites related to names

@JiteshGaikwad Thanks Buddy, Its working for the list provided, but not from every name in .txt. I think I need to provide more examples entities to do that. Thanks a lot for the help.

I have the same issue … did you solve it and how?

Hey I am getting the same issue. Its not recognizing any entities from the lookup txt file. Is there any solution or any other way of doing this?

try adding more examples from your .txt file to your nlu data. Sometimes it needs more examples to pick that table. I used ner_spacy for this purpose, it tends to serve me well.

@Akshit Any idea the least number of examples I should add? And also, How do I use ner_spacy? I mean where and how do I have to use it?

Sorry for late reply. I don’t know an exact amount as it depends on how much examples you have in table. I had a table of 50-60 names and I added 8-9 examples in my nlu data and it worked fine. For ner_spacy, you add it in your pipeline and It works very well with certain entities but I personally like duckling because of it’s date filter.

Thanks @Akshit. One more question, can we use both regex and lookup for the same entity ?

Do any one know how to attach .txt file with lookup in rasa 2.0

We can represent lookup tables like this in Rasa 2.0.

 - lookup: location
   files: |
     - location.txt

Hi sorry to interrupt the thread. I am having issues with providing lookup tables in .txt format. I tried the code as advised by @ChikkaUdayaSai but I get this error.

Any help will be greatly appreciated.


this leads to exception

in data/nlu.yml:3:
      Key 'lookup' was not defined. Path: '/nlu/0'
  in data/nlu.yml:3:
      Key 'files' was not defined. Path: '/nlu/0'

Hi @Jason73, and @susajsnair.

You no longer need to point to the file in nlu.yml, instead you can include the files in the same folder that your nlu.yml file is in (default is data), and rasa will search the subdirectories in data recursively.

@fkoerner can you provide a small example! if so it will be helpful. Thanks

Sure! For example, your lookup table could be a file like:


version: "2.0"
  - lookup: fruits
    examples: |
      - apples
      - bananas
      - pears

Your nlu.yml should contain some examples that include the lookup table items. You don’t have to include every single lookup table item, just a few of them. You also do not have to mention fruits.yml or the lookup table in the nlu.yml file. Including it in the data directory is enough.


version: "2.0"
- intent: ask_for_fruit
  examples: |
     - I'd like to buy some [apples](fruits)
     - Can I purchase some [pears](fruits)?

Finally, your directory structure should look like this:


Does that clear things up @susajsnair?