How to manage a users 'name only' response

I am struggling to get consistent results in my testing when I provide a ‘name only’ response; for example: user: Hello bot: Hi there I am the BakerStreetBot - what mystery may I investigate for you? user: I appear to have mislaid my spectacles bot: oh dear! Please tell me your name and I can see what I can do to help user: Sherlock Holmes bot: Hi there I am the BaerStreetBot - what mystery may I investigate for you? ** this is wrong - it should have had a different response **


If I trained the bot in interactive or manually added ‘Sherlock Holmes’ as a response in my NLU.yml file it works fine - as does providing a more complete as as the user (for example: My name is Sherlock Holmes) - but whenever I introduce a new name I get the same behaviour as that exhibited above. Is this purely down to a lack of training examples?

…I’m using SPACY…

Thanks for any tips or advice.

loving being part of this community :slight_smile:

I don’t know if that’s the best solution, but consider using a lookup table: person_name.yml (2.6 MB)


You can also make it into a form that will take the whole text as a response and save it in a slot.

In your domain.yml file:

forms:
  form_name:
    mystery:
    - intent_name: None
      not_intent: stop
      type: from_text
    username:
    - intent_name: None
      not_intent: stop
      type: from_text
1 Like

Thanks @ChrisRahme I’ll give this a go!

1 Like

Thanks again @ChrisRahme - I’m a newby here :-). Just searching for how I would use such a yaml file… is there a link to where I will find this documented?

1 Like

No worries!

You just place the file anywhere in the data folder (I create a lookups folder inside of it).

Just replace person_name with the name of the entity (and slot), and that’s it. This is like if you gave the bot NLU examples with all the following names.

version: "2.0"
nlu:
  - lookup: person_name
    examples: |
      - ...

You can read more about lookup tables here and here.

Hi there!

@ChrisRahme your solution also works for me, thanks a lot.

However, is there a way to use a lookup table from (for example) a txt file where each line represents a possible value of the entity?

Thanks again!

1 Like

I don’t think so… But if you want, I quickly wrote a script that does just transforms a text file into the appropriate YAML file. Just place it in the same folder as the text file.

txt_to_yml.py (546 Bytes)

Ohh, thanks a lot! I already did it yesterday haha.

I guess it should be nice to have an option to “attach” a txt file for a lookup.

Thanks a lot :slight_smile:

1 Like