简体   繁体   中英

Microsoft bot LUIS- How to verify the presence of entity and give appropriate response

I have fetched the required string ie(Entity) from the utterance, Now the problem is - my utterance contains two or more entities, and I want to validate that if first entity is present and second is not then bot should ask for that second entity to be specified. Also if first entity is not present vice or versa.

Behaviour-

intent name-"Service"
entity 1 name-"Product":keyboard
entity 2 name-"Machine":Computer
Utterance- "Do you have Keyboard for my computer"

I am getting the entity count and value from LUIS result parameter.

Expectation- Here I want to check if user says- "do you have keyboard for my ddydyj(random words)" As from my code I am getting count=1 , entity value="keyboard" but as user have given invalid entry I want my bot to ask for second valid entity.

Please help me with some code example.

The LuisResult object is the one that will be sent to your intent method with the results of the call to LUIS . It has a property named Entities which contains the list of entities detected based on the input provided.

You can check that list and perform your custom logic. Alternatively, you could take a look to the Luis Action Binding library, which will help you to implement the logic to ask for missing entities. The repository has a good set of documentation and code examples. Also, you can check the blog posts around it:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM