entity#

class besser.bot.core.entity.entity.Entity(name, base_entity=False, entries=None, description=None)[source]#

Bases: object

The Entity core component of a bot.

Entities are used to specify the type of information to extract from user inputs. These entities are embedded in intent parameters.

Parameters:
  • name (str) – the entity’s name

  • base_entity (bool) – whether the entity is base or not (i.e. custom)

  • entries (dict[str, list[str]] or None) – the entity entries. If base_entity, there are no entries (i.e. None)

  • description (str or None) – a description of the entity, optional

name#

The entity’s name

Type:

str

base_entity#

Whether the entity is base or not (i.e. custom)

Type:

bool

entries#

The entity entries. If base_entity, there are no entries (i.e. None)

Type:

list[EntityEntry] or None

description#

a description of the entity, optional

Type:

str or None

process_entity_entries(nlp_engine)[source]#

Process the entity entries.

Parameters:

nlp_engine (NLPEngine) – the NLPEngine that handles the NLP processes of the bot

to_json()[source]#

Returns the entity content in a JSON format.

Returns:

The entity content.

Return type:

dict