Spacy and name entity in intent

Hi all I am new to Rasa and trying to create an intent that picks up a person’s name. I have installed Spacy and added to my config.yml

pipeline:
  - name: SpacyNLP
    model: "en_core_web_md"
    case_sensitive: False
  - name: SpacyTokenizer
  - name: SpacyFeaturizer
    pooling: mean
  - name: SpacyEntityExtractor
    dimensions: ["PERSON"]

I would like to have it in an intent, where I do not have to have an example for each name, but rather have Spacy recognise it. Something like this

 - intent: say_name
   examples: |
     - I am called [Rafael](name)   # example based
     - my name is [PERSON](name). # entity extractor

I could not find an example for this.

thanks

@rafa21 please ref this repo for your use-case [its based on Rasa 2.x ]: GitHub - RasaHQ/spaCy-integration-demo

I hope this will help you, and good luck!

Thanks @nik202 But the example does not make much sense.

It says:

We can train this pipeline and talk to it to see what the effect is. Let's say Hi I am Vincent from Amsterdam to this assistant.
Next message: 
  Hi I am Vincent from Amsterdam.

and then

When you run this, you’ll notice in the output that both Vincent and Amsterdam have been detected as entities.

But the domain file does not even define those entities.

actions:
- action_proglang
- utter_goodbye
- utter_greet
entities:
- proglang
intents:
- talk_code
- greet
- goodbye
responses:
  utter_goodbye:
  - text: Bye
  utter_greet:
  - text: Hey! How are you?
session_config:
  carry_over_slots_to_new_session: true
  session_expiration_time: 60

I assume you first need to define the entity in the domain file, then the NLU file would have an intent that recognises the entity.

If I have

then peter is extracted as PERSON.

But using spacY I should be able to detect names without having to list an example for every possible name.

I have tried all these

- my name is ["PERSON"]{"entity":"PERSON"}
  - I am ["PERSON"]{"entity":"PERSON"}
  - You can call me [PERSON](PERSON)

but they don’t work.

Maybe I am thinking something wrong, because this should be a very common use case.

ok, I figured it out. I needed to give 5-10 examples of the intent and it started recognising names I did not train on. Still have to understand better what happened, but can close the issue

1 Like

@rafa21 Thanks for the feedback and glad you were able to solve the issue, good luck with your project!

Hi @rafa21,

could you explain better how did you solve your issue? What kind of training data format you used into the nlu.yml file? Does RASA exploit the entity identified by Spacy without forcing it? In my case, it’s not working as you suggest…

Thanks

Hi @rafa21, I am facing the same issue you have had. What format did you use for your nlu training data in the end?

Update: This format works for me:

- intent: user_name_intent
  examples: |
    - "My name is [PERSON](user_name_entity)"

Important for me was to not mix this with examples with actual names.

I still have the problem though that foreign names (e.g. Priyanka) are not recognized.