Setting intent if spacy entity is recognized

I am training my bot right now for getting name of the PERSON and reply “welcome, PERSON!”. There are other intents as well.

I want to know if there is a way for the NLU to understand that the intent is my_name_is if the entity (i am using spacy here) is recognized as PERSON!

Why I am asking for this is that there are times when the user just enters the entity, like their name. If the NLU is able to understand what entity it is (which it does very well) how do you make it understand the intent?

http://localhost:5000/parse?q=Jeena&model=current
{
	"intent": {
		"name": "bye",
		"confidence": 0.6502023935317993
	},
	"entities": [
		{
			"entity": "PERSON",
			"value": "Jeena",
			"start": 0,
			"confidence": null,
			"end": 5,
			"extractor": "ner_spacy"
		}
	],
	"intent_ranking": [
		{
			"name": "bye",
			"confidence": 0.6502023935317993
		},
		{
			"name": "hello",
			"confidence": 0.4507773518562317
		},
		{
			"name": "my_name_is",
			"confidence": 0.43783286213874817
		},
		{
			"name": "how_are_you",
			"confidence": 0.18936817348003387
		},
		{
			"name": "get_daily_list",
			"confidence": 0.043304238468408585
		},
		{
			"name": "whats_the_weather",
			"confidence": 0.04235358163714409
		}
	],
	"text": "Jeena",
	"project": "default",
	"model": "current"
}

As you can see here! the entity is recognized correctly as PERSON thanks to spacy! But the intent is not recognized as my_name_is??? I have no idea how bye has the highest confidence as in bye training data there is only bye, goodbye and see you??? Is there a way to improve the intent recognition or a way to set the intent if a particular entity is recognized???

PERSON and my_name_is is just an example here. I am asking about entities and intents in general!

try using tensorflow embedding pipeline , that’s the new thing right now and another thing is if user enters simply his name say “rick” then a simple intent classification will do , no need of entity extraction. You will be able to get the user text using the “tracker” object from custom actions.the following will easily give you the name entered by a user.

name = tracker.latest_message[‘text’]

but if the user enters something like say “My name is rick” and you intent to get “rick” out of it then yes , you would need entity extraction.

One thing to be noted is intent classification needs less data whereas entity extraction requires relatively more data to perform properly , so if there’s something that can be achieved with simple intent classification then don’t sweat on doing entity extraction.

hope i was able to convey my point :slight_smile:

Thanks @Abir

I am already using tensorflow embedding. What I am saying is that eventhough I am using unique entities which are used only by a particular intent while training; the entities get extracted correctly but the intent is not necessarily detected!

lay down your nlu_config and data file , i will be able to explain the cause properly . Another thing is entity extraction and intent classification is done by two totally different component . Since you mentioned , you have used tf_embedding pipeline , means you have featurized using count vector followed by tf intent classifier . this is totally unrelated to entity extraction as it’s done totally by ner_crf . So entity extraction and intent classification are totally unrelated . What i feel is there’s a need for you to increase the number of examples or tune some hyperparameter of count vector component or may be add a new intent with OOV tokens . But i would prefer if you could share you data and nlu_config file first.

thank you