Developer
Developer

Reputation: 129

Handling incorrect responses to chatbot questions

I am using Microsoft Bot Framework to develop chatbot and my questions is that how can I handle incorrect responses from a user. Suppose bot asks for name of user and he or she replies "don't know". I have seen in boiler plate code of bot framework that it handles minimum length validation, but how can I handle this logical checking. Thanks in advance.

Upvotes: 0

Views: 157

Answers (2)

Sand T
Sand T

Reputation: 168

An expected answer normally has a known format. If bot is asking a name then the name would not have numbers and special characters.. You can do a quick check if the words returned by user are part of standard english words (there are plenty libraries having this list of words). You can even pass the returned sentence to LUIS and see if you get a known intent, and then you can disqualify the answer.

Upvotes: 1

D4RKCIDE
D4RKCIDE

Reputation: 3426

I am assuming you are using the v4 C# SDK, let me know if this is not correct and I can update my answer for node or v3 for you.

This Sample Does exactly what you are trying to do It has a validator that checks the length of the user's input and reprompts if the length is too short. You can see this in this method

In general name validation is fairly difficult because names can be very diverse and contain special characters like "-", "'", and others. Using a prompt with a custom validator should give you the opportunity to at least add some validation like length and numerical character checking.

Upvotes: 1

Related Questions