botframeworkazure-bot-serviceazure-language-understanding

How to define two different entity roles for the same prebuilt Entity (number) in LUIS


I am looking to build a bot that typically requires two numbers with a different meaning (role) in the same utterance. Let's take the example of a StockMarket order assistent (fictional, as example)

Some example utterances:

In LUIS portal, I have defined two entities

When specifying the utterances shown as example, it shows that the entities get recognized. But I cannot find a way to specify the roles for the different number entities in my sample utterances. (in the examples, the first number instance of number is the Amount, and if a second it there, that is typically the Limit role.

Anyone an idea on how to define this and set this up?

Best regards


Solution

  • There are 2 different ways to do this, First is to use roles for a prebuilt entity, go into the number prebuilt, click on Roles, add 2 different roles.

    one for Amount another for Limit then you have to go in the utterances and label for the roles, you do that by going to the utterance, clicking on the @ symbol on the right, selecting the number prebuilt, selecting the role, then highlighting the numbers with that role.

    Second approach is to use ML entities, create 2 ML entities, one for Amount one for Limit. Add the number as a feature and make it a required feature, and then go ahead and label the Amounts with the Amount entity and the limits with the Limit entity directly.