How to use ml luis entity and list entity together in bot framework - botframework

When i try to use both list entity and ml entity together in bot composer i get the following error:
"Check STATUS with {#idtype} {#id=132354}" has mix of entites with labelled values and ones without. Please update utterance to either include labelled values for all entities or remove labelled values from all entities."
Check STATUS with {#idtype} {#id=132354} .Here idtype is list entity and id is ml entity.

What that means is that, for a specific utterance you have to either add labels (the "=132354" part) to all entities in the utterance or remove them from all entities.
For your specific sample, since you should have the "132354" value included in the list definition, you could remove it from the utterance.
However, ml entities require (at least some) utterances with labeled entities, after all that's the only way the machine can learn what that entity looks like 😉. So, wherever you label an ml entity, you should also label the list entity or any other entity in the utterance.
You can read more about this topic in the Best practices for building a language understanding (LUIS) app documentation page.
BTW an utterance with unlabeled entities is considered a pattern, you can read more about this in the Patterns improve prediction accuracy page.

Related

When creating a slot in Rasa, is it also important to declare the slot as an entity?

Lets say I create a slot in Rasa called "yearlybill".
I will have to write:
slots:
yearlybill:
type: float
min_value: 0
So my question is, when I want to use these slot in my intents, will I have to explicitly mention it as an entity as well? Or is that option?
Let's start with a bit of background.
A slot should be seen as a long-term memory slot. You can store information in there manually, via a custom action, without having an entity around.
An entity is a substring of the user message that you'd like to extract for later use. Common entities are names, dates, and product-ids. It's very common to store the entity in a slot, but you don't have to. You can also detect an entity and have a custom action retrieve that information from the tracker.
You could define a slot without defining an entity. If you're planning to use a custom action to fetch the slot value from a users' text, you technically don't need an entity. This isn't a common pattern though. Typically you'd like a specific entity detection model to fetch the entity so that it can be stored in the slot after. That's why it's common to see domain.yml files that contain both a slot and an entity definition.

Microsoft Bot Framework: LUIS hierarchical vs list entity

I have created a sandwich order bot following instructions from the Microsoft tutorial. My goal is now for this bot app to interact, so I will be using the Language Understanding (LUIS) service API to achieve this.
In the sandwich chat the user can select what they want to add, eg. salad, sauce etc.
I am unsure if I should be using LUIS hierarchical or list entities for this.
Here is what I have with LUIS entities:
Composite entity
Sandwich
Hierarchical entities
Salad: Lettuce, Olives
Sauce: Mayo, Ketchup
Cheese: Blue, Cheddar
Here is what I have with list entities:
List Entities
Salad: lettuce, Tomato, olives
Sauce: Mayo, Ketchup
Cheese: Cheddar, blue
I am not sure how to create the relationship between the sandwich and the sandwich fillings. Also, if it should be list or hierarchical.
Thank you for your time, appreciate it!
List entity is an exact match of text. You can add many items but they all have to be known before hand to add to the list entity.
Hierarchical entities are simple entities with context between the child/simple entities. This allows LUIS to learn more sandwich fillings without you having to add them to the list entity.
The true answer is if you have a hard set list of fillings, use the list entity. If you want your customer to be able to add anything, use a simple, hierarchical, and/or composite entity with a phrase list of fillings to boost the signal that those are sandwich filling words.

Difference between Phrase lists and list entities?

I have started working with Microsoft bot framework and LUIS.
I have problem understanding difference between Phrase lists and list entities?
Can you help me? Examples would be great.
Thanks
What is a list entities?
Definition in documentation here, I highlighted the main points
List entities represent a fixed set of related words in your system.
Each list entity may have one or more forms. They aren't machine
learned, and are best used for a known set of variations on ways to
represent the same concept. List entities are not labeled in
utterances or trained by the system.
A list entity is an explicitly specified list of values. Unlike other
entity types, LUIS does not discover additional values for list
entities during training. Therefore, each list entity forms a closed
set.
If there is more than one list entity with the same value, each entity
is returned in the endpoint query.
What is a phrase list feature?
Definition in documentation here:
A phrase list includes a group of values (words or phrases) that
belong to the same class and must be treated similarly (for example,
names of cities or products). What LUIS learns about one of them is
automatically applied to the others as well. This is not a white list
of matched words.
When to use phrase lists instead of list entities
I think the best answer is (still in the documentation, here):
When you use a phrase list, LUIS can still take context into account and generalize to identify items that are similar to, but not an exact match as items in a list. If you need your LUIS app to be able to generalize and identify new items in a category, it's better to use a phrase list.
In contrast, a list entity explicitly defines every value an entity can take, and only identifies values that match exactly. A list entity may be appropriate for an app in which all instances of an entity are known and don't change often, like the food items on a restaurant menu that changes infrequently. In a system in which you want to be able to recognize new instances of an entity, like a meeting scheduler that should recognize the names of new contacts, or an inventory app that should recognize new products, it's better to use another type of entity and then use phrase list features to help guide LUIS to recognize examples of the entity.

Training LUIS to predict entities without Phrase List

I am trying to train LUIS to recognize entity through few utterances. I initially tried to train with few utterances with different entity values. The entity values are made up of two words or more. For example, 'customer engagement', 'empower your teams' etc.
I am not able to get LUIS to identify the entity correctly because of the variation in the number of words.
I cannot use Phrase List as the values as the values are dynamic.
How can I get train LUIS to recognize the multiple words in the utterance and identify the entity effectively?
This still requires you to provide some training data in the form of canonical values and synonyms, but another way to approach this would be to use a list entity inside of a composite entity. Other than this, you'll currently have to provide a larger amounts of training data/phrase list data as LUIS doesn't look at the definition of a word.

Do I have to make my own LUIS entity to recognize the word "latest"

I am currently using the prebuilt entity ORDINAL and it serves very well in recognizing the words FIRST and LAST. However, from tests, I see that my users use the word "latest" and it doesn't recognize it as an ORDINAL.
Should I just make my own entity then? Any help to point me to the right direction would be appreciated.
For this instance you have three options ahead of you, two of which are in LUIS itself.
LUIS: Option 1 - Simple Entity
Create a simple entity in your application and add latest and its synonyms to your LUIS application.
Benefits include less code debt, being able to label tokens manually, and using machine learning to recognize latest and its synonyms (note: you still have to provide the synonyms for LUIS to recognize)
Cons include one less entity to use in your application (current limit for any combination of simple, hierarchical and composite entities is 30 per application).
LUIS: Option 2 - List Entity
Create a list entity in your application and add latest as the canonical form of a sublist with its synonyms as values in the list for matching.
Benefits include RegEx matching, abstracted away from your application. LUIS will recognize any token that already exists in the list entity.
Cons include losing one list entity for one word with a finite set of synonyms (current limit for list entities is 50 per application). You will have to add each token manually to the sublist for it to be recognized. Users are unable to label tokens with a list entity. Not used in the machine learning aspect of LUIS, does not help improve intent prediction scores.
Application level: RegExp/sub-string parsing
Create a token extractor (using RegExp or some other technique) to recognize the word latest and its synonyms
Benefits for this include fewer expenditure of LUIS resources (entities and list entities), and less importantly, perhaps a minuscule reduction in the time it takes to receive results from LUIS.
Cons for this include increased code debt due to the matching you have to perform in your application.

Resources