在api.ai中处理范围的最佳方法? [英] Best way to handle ranges in api.ai?

查看:27
本文介绍了在api.ai中处理范围的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个房地产机器人,需要处理以下情况。
-我正在寻找1200平方英尺的房子
-我正在寻找1200-1500平方英尺的房子
-我正在寻找1200平方英尺至1500平方英尺之间的房子

I have a real estate bot where I need to handle the following cases. - I am looking for a house with 1200 sqft - I am looking for a house with 1200 - 1500 sqft - I am looking for a house between 1200 sqft to 1500 sqft

另一种情况是我的机器人问
您正在寻找多少平方英尺?
用户说1500

Another case is my bot asking How many square feet are you looking for? User says 1500

几个问题


  1. 操作方法我处理带或不带单位的范围和正常值

  2. 例如,如何限制值在一定范围内(小于10000)
    。我也有一个案例,我要求一个价格范围,而我
    需要区分平方英尺和价格吗?用api.ai做到这一点的
    最佳方法是什么?


推荐答案

这里有几个问题,因此我将快速回答每个问题,然后根据我认为您实际尝试实现的目标,使用更长的解决方案进行回答。

There's a few questions here so I'm going to answer each quickly, and then answer with a longer solution given what I think you are actually trying to achieve.


如何处理带或不带单位的范围和正常值?

How do I handle ranges and normal values with or without units?

处理多个可能条目的最佳方法是为相同的意图创建许多示例并训练您的机器人。因此,在平方英尺的情况下,您可能想要创建如下所示的各种示例,向您的机器人指示如何识别最小和最大尺寸参数。有了足够的示例,即使没有明确给出任何单位(例如, sqft),您的机器人也应轻松学会识别这些参数

The best way to handle multiple possible entries is to create lots of examples for the same intent and train your bot. So in the case of square feet, you might want to create varying example like the below, indicating to your bot how to recognize minimum and maximum size parameters. With enough examples, your bot should easily learn to recognize these parameters even when no units are explicitly given (ie 'sqft')


例如,如何限制值在一定范围内(小于10000)。

How do I restrict the values to be in a certain range (under 10000) for example.

总之,如果不是在API.ai和可进行某些数据验证的消息传递平台之间安装了定制的服务器端解决方案,您就不会这么做。

In short, you don't, not without a custom built server side solution that sits between API.ai and the messaging platform that can do some data validation.


我也有一个案例,要求价格范围,我需要区分平方英尺和价格?

I also have a case where I ask for a price range and I need to differentiate between square feet and price? What is the best way to do this with api.ai?

用一个单一的意图来识别两者之间的区别是很困难的。没有提供单位的情况下的价格和平方英尺数,即使有很多示例API.ai也不总是很准确,总是会认识到当用户说我的目标是1200时,它们并不意味着$ 1,200-如果您有一个收集用户价格和用户规模需求的意图。

It would be tough to train a single intent to recognize the difference between price and square feet when no units are being provided, even with a bunch of examples API.ai is likely to not be very accurate at always recognizing that when a user says 'My target is 1200' they don't mean $1,200- again that is IF you have a single intent for gathering user price and user size desires.

对于您似乎想要实现的目标,我的建议是有两个单独的意图,一个用于尺寸,一个用于价格,并明确提示用户输入每个答案。这使您的应用程序更具刚性,但在对话流中允许的灵活性越高,引入的歧义性就越大,从而降低了机器人的实用性和准确性。

My advice for what you seem to be trying to achieve would be to have two separate intents, one for size and one for price, and explicitly prompt the user for each answer. This makes your application a bit more 'rigid', but the more flexibility you allow for in conversational flows the more ambiguity which is introduced, which in turn reduces the usefulness and accuracy of your bot.

因此,从某种意义上说,这与黑白电话是一个折衷方案,但我个人的建议是上述更为结构化的方法。

So in some senses it's a trade off vs a black-and-white call, but my personal suggestion is the more structured approach described above.

如果您需要帮助,以建立一个自定义服务器端解决方案以位于API.ai和您的用户之间,让我知道。其实并不是那么困难

If you need help building a custom server side solution to sit between API.ai and your user, let me know. It actually isn't all that difficult

这篇关于在api.ai中处理范围的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆