[英]Dialogflow - Dealing with user discrepancy when coding fulfilment
When coding fulfilment for Dialogflow (API.AI) is there a way to deal with discrepancies in user responses without having to do a full if statement for all the possible ways a user could say the same thing? 在对Dialogflow(API.AI)进行编码实现时,是否有一种方法可以处理用户响应中的差异,而不必对用户可能说同一话的所有可能方式进行完整的if语句? AKA the manual way. 又称手动方式。
For example, if I'm asking where the user located and they say they're from the West Midlands, which is one of my locations - do I have to do an IF statement that looks something like this: 例如,如果我问用户位于哪里,他们说他们来自西米德兰兹郡,那是我的位置之一-我是否必须做一个类似以下内容的IF语句:
if (location === 'West Midlands' || 'west Midlands' || 'w midlands' || 'w mid') {}
Or can I pass it back to Dialogflow where it can handle the users input using the AI or whatever. 或者我可以将其传递回Dialogflow,在此它可以使用AI或其他方式处理用户输入。
You can create an Entity that represents the locations you support. 您可以创建一个代表您支持的位置的实体 。
Each of the possibly values in your Entity can have a canonical value and then the aliases that the user can enter that will map to this canonical value. 实体中的每个可能值可以具有一个规范值,然后用户可以输入的别名将映射到该规范值。 When the parameter is sent to your fulfillment, the canonical value will be sent. 将参数发送给您的实现时,将发送规范值。 (If you needed exactly what they entered, it is available as well, but you should use the canonical value for your tests.) (如果您确实需要他们输入的内容,也可以使用它,但是您应该在测试中使用规范值。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.