1

I am working on a customer relations chatbot. The user can input a greeting, user name, phone number etc.,

I created a few training examples(50+ names) to help the chatbot in nlu.md file. But the problem is the chatbot is not able to recognize an user_name as an entity if it is not specified in the training data (nlu.md) file.

I wrote a regex as well but still if I give a new name the nlu engine is not able to recognise it.

I’m using rasa 1.0.7 and I have pipeline: supervised_embeddings

for example

nlu.md file:

##regex.names
- [a-zA-Z\s]+$


##intent:inform
- John
- Roshan
- Sanvi
–> have few more

If User is giving any new names means, my entity is empty. attaching the rasa interactive message also.

Your input -> John
Is the intent ‘inform’ correct for [John] (name) and are all entities labeled correctly? (Y/n)
Your input -> adrena
Your NLU model classified ‘adrena’ with intent ‘inform’ and there are no entities, is this correct? (Y/n )

What should I do to make the bot understand when a user_name is specified? I saw somewhere that lookup tables can be used. But when I tried using lookup tables, it still did not recognize user_name not part of the training examples.

The below links I referred.
https://forum.rasa.com/t/regex-entity-names/11739/10
How rasa_nlu using lookup_tables for entity extraction?
but no luck for my issue. I am okay with any options also.

Thanks.

Alex Bravo
  • 1,601
  • 2
  • 24
  • 40
Ramya PS
  • 11
  • 2

2 Answers2

1

You could use the SpaCyEntityExtractor with the dimension PERSON instead of CRFEntityExtractor for that specific entity. For personal name recognition this will almost always give you better results since there are so many name possibilities. AFAIK the PERSON SpaCy model is itself case sensitive. You can still extract other custom entities with CRFEntityExtractor. In your pipeline this would look like:

language: "en"

pipeline:
- name: "WhitespaceTokenizer"
- name: "RegexFeaturizer"
- name: "CRFEntityExtractor"
- name: "EntitySynonymMapper"
- name: "CountVectorsFeaturizer"
- name: "EmbeddingIntentClassifier"
- name: "SpacyNLP"
  model: "en_core_web_md"
- name: "SpacyEntityExtractor"
  dimensions: ["PERSON"]

Melinda
  • 747
  • 5
  • 13
0

Late, but maybe useful for other people, using RASA 2:

I'd try to:

  1. configuring custom entity name as a RASA lookup table,
  2. supplying examples in a dedicated intent name containing sentences containing the entity in object:
version: "2.0"

nlu:

  - lookup: name
    examples: |
      - John
      - Roshan
      - Sanvi
      - Anita
      - Anna
      # many others names (hundreds)

  - intent: name
    examples: |
      - [John](name)
      - call me [Roshan](name)
      - [Sanvi](name) is my name
      - my name is [Paola](name)
      - I'm [Annabelle](name)
      # etc etc.

See a similar issue solution: https://stackoverflow.com/a/68793356/1786393

BTW, @Melina solution using Spacy PERSON predefined entity is also a probable good solution (for names that belong to the single selected Spacy language model) that's probably cooperating with the custom entity/intent solution, just naming the custom intent PERSON (to be verified/I'm not sure).

Giorgio Robino
  • 2,148
  • 6
  • 38
  • 59