Class: SlotManager

SlotManager()

Class for a Slot Manager that takes care of the slot information.

Constructor

new SlotManager()

Constructor of the class.
Source:

Methods

addBatch(intent, entities) → {Array.<Object>}

Add several entities if they don't exists.
Parameters:
Name Type Description
intent String Name of the intent.
entities Array.<String> List of entities.
Source:
Returns:
Array of resulting entities.
Type
Array.<Object>

addSlot(intent, entity, mandatory, questions) → {Object}

Adds a new slot for a given intent and entity.
Parameters:
Name Type Default Description
intent String Name of the intent.
entity String Name of the entity.
mandatory boolean false Flag indicating if is mandatory or optional.
questions Object Question to ask when is mandatory, by locale.
Source:
Returns:
New slot instance.
Type
Object

clear()

Clear the slot manager.
Source:

existsSlot(intent, entity) → {boolean}

Indicates if a given slot exists, given the intent and entity.
Parameters:
Name Type Description
intent String Name of the intent.
entity String Name of the entity.
Source:
Returns:
True if the slot exists, false otherwise.
Type
boolean

getIntentEntityNames(intent) → {Array.<String>}

Given an intent, return the array of entity names of this intent.
Parameters:
Name Type Description
intent String Name of the intent.
Source:
Returns:
Array of entity names of the intent.
Type
Array.<String>

getMandatorySlots(intent) → {Object}

Given an intent return the mandatory slots.
Parameters:
Name Type Description
intent String Name of the intent
Source:
Returns:
Object with the mandatory slots.
Type
Object

getSlot(intent, entity) → {Object}

Returns an slot given the intent and entity.
Parameters:
Name Type Description
intent String Name of the intent.
entity String Name of the entity.
Source:
Returns:
Slot or undefined if not found.
Type
Object

load(src)

Loads the slot manager content.
Parameters:
Name Type Description
src Object Source content.
Source:

removeSlot(intent, entity)

Remove an slot given the intent and the entity.
Parameters:
Name Type Description
intent String Name of the intent.
entity String Name of the entity.
Source:

save() → {Object}

Returns the slot manager content.
Source:
Returns:
Slot manager content.
Type
Object