Entity

An entity is the specification of an Intention or an Answer. It allows your virtual agent to delve deeper into a conversation.

If you insert an Entity after an answer, you will allow your virtual agent to explore better your user desires. If you put an Entity cell after an Intent, you allow your user to show your virtual agent what he wants more accurately.

For example, in the sentence “I want a soup”, the desire to make an order is the Intent, while “soup” is the Entity, a specification of that order.

To create an Entity first, click “Create Entity”, then name it and select its category.

After you create an Entity, you can assign one or more values to it in a flow. This is useful when you are creating options to branch a flow. Instead of creating a lot of Entities, you create one entity and add it repeatedly in the same validation level, selecting different values for each cell.

If you are a developer, learn more about entity table stores configurations.

There are 2 (two) types of Entities: Custom Entities and System Entities.

Custom Entities

These are the ones you can create, edit and delete. In eva, you can create entities if you are using eva NLP.

Custom Entities from eva NLP can be divided in two categories: Synonyms and Patterns.

Synonym Entities

Recognizes semantically close words in a category. So, for a given category, like “color”, you can specify color types as values, such as “blue”, “green” or “yellow” and, for each one of those, you can add synonyms, like:

  • Blue: aqua, navy.

  • Yellow: jaune, amber, gold.

To build synonym entities, create a value, such as “blue” and add synonyms: blue, aqua, navy, aquamarine, etc. Synonyms are added like tags, by hitting enter.

Remember to insert the value name as one of the synonyms. The blue entity must have “blue” besides “navy” and “aqua” as synonyms.

Pattern Entities

Pattern Entities recognizes a model that you insert, so you do not have to write a different utterance for every time a user insert new information that follows a specific pattern.

A good example is emails. Instead of creating an intent for every possible email, you create a pattern entity that recognizes the structure of an email address ([email protected]).

To create a pattern entity, you need technical knowledge, as you have to create a RegEx, or regular expression. Those are sequences of characters that define a search pattern.

For example, to create an email pattern entity, you would have to build a RegEx for emails. The email [email protected] (and every other email) would be rendered as:

^[A-Z0-9._%+-][email protected][A-Z0-9.-]+\.[A-Z]{2,}$

The first part, ^[A-Z0-9._%+-], looks for characters from A to Z and 0 to 9, followed by a @ and then by [A-Z0-9.-]+\, representing characters from A to Z and 0 to 9.

This is followed by a dot (.) and [A-Z]{2,}$, representing characters from A to Z. This allows eva to look for patterns that are similar to each other.

To avoid entities that overwrite each other, use one RegEx by entity and do not repeat the same pattern in two entities. You can use a pattern entity more than once in a flow. Also, be careful to choose patterns that point to different universes.

Important: eva blocks the same expression in two different entities, but similar expressions can overwrite each other.

Example, check the following Regular Expressions:

.+ - (any character 1 or more times)

\d+ - (any number 1 or more times)

\d{3} - (any number of 3 digits)

The sequence 123456 suits the three different regular expressions, making the three overwrite each other.

To learn more about Regular Expressions, check https://www.regular-expressions.info/tutorial.html

Important:

  • Entities cannot share names

  • Pay attention to value names and their synonyms

  • Pay attention not to overlap patterns or synonym entities. As they are treated equally by eva NLP, they will be chosen randomly.

Different entities with similar values might overwrite each other. The same happens with entities containing similar synonyms for different values. An entity with values too similar to each other (a value to “blue” and another one to “aqua”) will not work properly as the cognitive engine will not know which value to use.

There are some best practices when building Entities:

  • When building a Synonym Entity, pay attention to how a user use synonyms to refer to something. Example: “cold tomato soup”, “gazpacho”, “salmorejo” and “gaspacho”.

  • Instead of creating multiple Entities referring to similar actions, such as order_pizza and order_soda, create a single intent, such as order, and an entity to refer to these objects, such as “soda” or “pizza”.

  • Pay attention to overlapping Entities. Some words can fit in more than one category. “Blue”, for example, can be a color and an emotion.

System Entities

Are those feature lists that come with some NLPs engines. These entities can only be enabled or disabled.

eva NLP offers 5 (five) system entities: Cardinal (recognizes quantity), Date (recognizes a specific date), Address, Product (recognizes products, from a spoon to a car) and Language.

Although eva NLP offers pre-built Entities for numbers, addresses, dates, languages and products, if you make a Pattern or Synonym Entity for any of those categories, eva NLP prioritizes user-created entities over system entities.

This means that if you build yourself any entity that overlaps a system entity (a pattern entity for number or a synonym entity for addresses) and inserts both the system entity and the entity you made in a flow, eva NLP will use the entity you build to interpret a user utterance.

How to use system entities:

  1. First, go to the Entities field and select System Entities.

2. Then, click on the pen of the entity you want to enable

3. Click on the button to enable the entity.

4. In the snack message, type "ENABLE" and save.

5. Go to the desired flow and create an Entity cell.

6. Between New and List, choose List.

7. The system entity will be in the list.

8. Just click on it, and you are done 😉

Using entities from external NLPs

When you integrate a NLP that is not eva NLP, the entity database built there is synchronized with eva. This means that you can keep building your flows with entities that you have made in the NLP.

To use an NLP entity, you have to insert its name exactly as it is written in the NLP. If you are using system entities, you can find their correct names in the NLP documentation.

For example: if the entity is saved as @tomato_soup__151451 in the NLP, to use it in eva you have to write it down in the modal (even the double underline and numbers).

On the value field, you can either enter a specific value from the NLP or you can leave it blank to consider all entity values registered. If you want to use a specific value, you have to insert its name exactly as it is written in the NLP.

Example: as with the entities, if the value is saved as “gaspacho”, you will have to write it down in the modal as “gaspacho”, not “gazpacho”.

You can use those entities in your flow, and edit their values, names, description, and tags.

Important: It is not recommended to change an NLP entity name or values because it can affect the synchronization.

After finishing, you have to go back to the NLP and train your flow.

If you are using Luis, check the appendice “Using system entities in Luis”.

Disambiguation of polysemic words

Polysemy is when a single word has multiple meanings or senses. When used in the same interaction (in an Intent and an Entity), it can affect assertiveness of your virtual agent.

Let’s see an example with the word “make”. This polysemy has many meanings, such as “cause”, “do”, “build, prepare”, “makeup”, etc. Now, imagine you built an agent for ecommerce and inserted “make” in an Entity and that it also appears in an Intent.

In this very specific case, when the NLP recognizes the Intent and the Entity in the same interaction, eva prioritizes the order of construction of the flow, from top to bottom.

The order of the cells matters when it comes to validating what eva delivers first.