An entity is the variable part of the utterance, it can be detected and stored in a context variable and used later in the flow. Some entities are predefined (like numbers, dates, etc) while other can be defined, for example a chatbot that is able to understand a sentence like I want to buy 3 apples should have an intent with the utterance I want to by %number% %fruit%. In this example the entity number is built-it, while the entity fruit should be defined with the NLP.js Entity and should include all kind of fruits with optional aliases (apple, orange, grape, etc).

Entity

Entity

Built-in entities are: email, ip, hashtag, phonenumber, url, number, ordinal, percentage, age, currency, date, duration.

The entity can also be defined in a upstream node:

{  
	payload: {    
		name: 'fruits',    
		language: 'en',    
		entities: [      
			{ name: 'orange' },      
			{ name: 'apple', aliases: ['golden apple', 'granny smith apple'] }    
		]  
	}
}

Available parameters for the msg.payload

Name Type Description
entities array of [entity] The list of entities
name string The entity name
language string The ISO code for language (en, it, …)

The [entity] object

Name Type Description
name string The entity item name (required)
aliases array of string Possible aliases of the same item