# How to provide the lookup entities in .txt format

**URL:** <https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518>\
**Category:** Rasa Open Source\
**Created:** [January 21, 2019, 11:41am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518 "2019-01-21T11:41:34Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rakesh](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rakesh](https://forum.rasa.com/u/rakesh)\
**Post date:** [January 21, 2019, 11:41am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/1 "2019-01-21T11:41:35Z")

</div>

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’]
2. 

- Rakesh
- Micheal
- Stan
- Rita

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

---

<div class="post-metadata">

**Author:** ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)\
**Post date:** [January 21, 2019, 1:07pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/2 "2019-01-21T13:07:34Z")

</div>

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

 ![cusines](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/2/240a4090789a0615243af04fb48fc9bdf83b38d8.png)

---

<div class="post-metadata">

**Author:** ![rakesh](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rakesh](https://forum.rasa.com/u/rakesh)\
**Post date:** [January 21, 2019, 2:03pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/3 "2019-01-21T14:03:40Z")

</div>

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

## intent: greet

- Hi, I am [Rakesh] (name)

## lookup: name

./names.txt

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.

---

<div class="post-metadata">

**Author:** ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)\
**Post date:** [January 21, 2019, 2:17pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/4 "2019-01-21T14:17:03Z")

</div>

did you include the 2-3 examples in your utterances which are in your lookup tables? [https://rasa.com/docs/nlu/0.13.8/dataformat/#lookup-tables](https://rasa.com/docs/nlu/0.13.8/dataformat/#lookup-tables)

---

<div class="post-metadata">

**Author:** ![rakesh](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rakesh](https://forum.rasa.com/u/rakesh)\
**Post date:** [January 21, 2019, 2:59pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/5 "2019-01-21T14:59:05Z")

</div>

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

 ![Screenshot%20from%202019-01-21%2020-25-01](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/c573d25e89826ac62c0b0e7ea4913710da694545.png)

---

<div class="post-metadata">

**Author:** ![JiteshGaikwad](https://avatars.discourse-cdn.com/v4/letter/j/77aa72/32.png) [@JiteshGaikwad](https://forum.rasa.com/u/JiteshGaikwad)\
**Post date:** [January 21, 2019, 4:16pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/6 "2019-01-21T16:16:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rakesh](https://avatars.discourse-cdn.com/v4/letter/r/258eb7/32.png) [@rakesh](https://forum.rasa.com/u/rakesh)\
**Post date:** [January 22, 2019, 11:26am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/7 "2019-01-22T11:26:50Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hossa95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hossa95/32/1766_2.png) [@hossa95](https://forum.rasa.com/u/hossa95)\
**Post date:** [February 5, 2019, 9:59am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/8 "2019-02-05T09:59:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mirzahash](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mirzahash](https://forum.rasa.com/u/mirzahash)\
**Post date:** [May 2, 2019, 6:56pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/9 "2019-05-02T18:56:30Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Akshit](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akshit/32/1431_2.png) [@Akshit](https://forum.rasa.com/u/Akshit)\
**Post date:** [May 3, 2019, 4:32am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/10 "2019-05-03T04:32:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mirzahash](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mirzahash](https://forum.rasa.com/u/mirzahash)\
**Post date:** [May 4, 2019, 7:58pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/11 "2019-05-04T19:58:15Z")

</div>

@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?

---

<div class="post-metadata">

**Author:** ![Akshit](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akshit/32/1431_2.png) [@Akshit](https://forum.rasa.com/u/Akshit)\
**Post date:** [May 7, 2019, 4:15am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/12 "2019-05-07T04:15:26Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mirzahash](https://avatars.discourse-cdn.com/v4/letter/m/67e7ee/32.png) [@mirzahash](https://forum.rasa.com/u/mirzahash)\
**Post date:** [May 9, 2019, 10:21am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/13 "2019-05-09T10:21:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Hamza-Nadeem](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/hamza-nadeem/32/12375_2.png) [@Hamza-Nadeem](https://forum.rasa.com/u/Hamza-Nadeem)\
**Post date:** [December 12, 2020, 3:17pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/14 "2020-12-12T15:17:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChikkaUdayaSai](https://avatars.discourse-cdn.com/v4/letter/c/85e7bf/32.png) [@ChikkaUdayaSai](https://forum.rasa.com/u/ChikkaUdayaSai)\
**Post date:** [December 13, 2020, 6:06am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/15 "2020-12-13T06:06:05Z")

</div>

We can represent lookup tables like this in Rasa 2.0.

```
 - lookup: location
   files: |
     - location.txt
```

---

<div class="post-metadata">

**Author:** ![Jason73](https://avatars.discourse-cdn.com/v4/letter/j/e36b37/32.png) [@Jason73](https://forum.rasa.com/u/Jason73)\
**Post date:** [December 22, 2020, 6:00am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/16 "2020-12-22T06:00:21Z")

</div>

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.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/6f4ce747d14d7aaeda0150c73b6a4fd734cff826.png)

Any help will be greatly appreciated.

Thanks!

---

<div class="post-metadata">

**Author:** ![susajsnair](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/susajsnair/32/11786_2.png) [@susajsnair](https://forum.rasa.com/u/susajsnair)\
**Post date:** [December 22, 2020, 12:32pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/17 "2020-12-22T12:32:35Z")

</div>

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'
```

---

<div class="post-metadata">

**Author:** ![fkoerner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fkoerner/32/11784_2.png) [@fkoerner](https://forum.rasa.com/u/fkoerner)\
**Post date:** [January 10, 2021, 6:22pm UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/18 "2021-01-10T18:22:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![susajsnair](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/susajsnair/32/11786_2.png) [@susajsnair](https://forum.rasa.com/u/susajsnair)\
**Post date:** [January 15, 2021, 6:02am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/19 "2021-01-15T06:02:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![fkoerner](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/fkoerner/32/11784_2.png) [@fkoerner](https://forum.rasa.com/u/fkoerner)\
**Post date:** [January 15, 2021, 10:20am UTC](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518/20 "2021-01-15T10:20:42Z")

</div>

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

`fruits.yml`:

```auto
version: "2.0"
nlu:
  - 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.

`nlu.yml`:

```auto
version: "2.0"
nlu:
- 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:

```auto
data/nlu.yml
data/fruits.yml

```

Does that clear things up @susajsnair?

[Next page](https://forum.rasa.com/t/how-to-provide-the-lookup-entities-in-txt-format/4518.md?page=2)
