watson机器人_使您的聊天机器人看起来更加智能! Watson Assistant的隐藏功能。

watson机器人

IBM Watson Assistant and its tooling support have been continuously improved for more than four years based on comments and feedback from users and customers alike.

根据来自用户和客户的评论和反馈,IBM Watson Assistant及其工具支持已经连续改进了四年多。

The portfolio of various supported use-cases and features is therefore constantly growing and it is increasingly difficult to cover all of them in the documentation. This article will discuss some of these features that you may have been unaware of.

因此,各种受支持的用例和功能的组合不断增长,越来越难以在文档中涵盖所有这些用例和功能。 本文将讨论您可能尚未意识到的某些功能。

Let me ask you the following three questions about Watson Assistant:

让我问您有关Watson Assistant的以下三个问题:

  • Did you know that British customers can enter dates in their native date time format and that one can change the locale during the very same conversation?

    您是否知道英国客户可以以其原始日期时间格式输入日期,并且在同一次通话中可以更改语言环境?
  • Did you know that date (@sys-date) and time (@sys-time) entities can have alternative values, such as “at five hours” meaning 5 am or 5 pm?

    您是否知道日期( @sys-date )和时间( @sys-time )实体可以具有其他值,例如“ 5小时”表示上午5点下午5点

  • Do you know how to collect multiple e-mails or phone numbers in dialog skill?

    您是否知道如何使用对话技巧来收集多封电子邮件或电话号码?

If you have answered “no” to at least one of these questions then reading this article can bring some benefits to your chatbots.

如果你回答“不”,对这些问题的至少一个,然后阅读这篇文章可以带来一些好处到你的聊天机器人。

使用新系统实体! (Use New System Entities!)

Here are some examples and tips on how to benefit from using new system entities in Watson Assistant, which were introduced for all 13 languages supported by Watson Assistant in January and May 2020.

以下是一些有关如何从Watson Assistant中使用新系统实体中受益的示例和提示,Watson Assistant在2020年1月和2020年5月为所有13种语言引入了这些示例和提示。

Currently, all newly created dialog skills will have new system entities turned on by default. For older or imported skills one needs to enable new system entities manually.

当前,所有新创建的对话技能将默认启用新的系统实体。 对于较老的或导入的技能,需要手动启用新的系统实体。

Here’s how to make sure the dialog skill uses new system entities:

这是确保对话技巧使用新系统实体的方法:

Image for post
New system entities selected in Options -> System Entities
在选项->系统实体中选择的新系统实体

Now, let’s make sure system entities are enabled in the Entities tab:

现在,确保在“实体”选项卡中启用了系统实体:

Image for post
All system entities types enabled for being recognized from the user input.
启用的所有系统实体类型都可以从用户输入中识别出来。

日期的区域设置特定格式 (Locale Specific Formatting of Dates)

If the Assistant is to be used mainly in the United Kingdom (or in Europe in general), the users might be confused by the system recognizing the dates in the U.S. format which is the default for English language (English (US)).

如果“助手”主要在英国(或通常在欧洲)使用,则系统可能会混淆用户,因为系统会识别美国格式的日期,而美国格式是英语( English (US) )的默认格式。

The first possible solution to this problem is to set system.locale to en-gb directly in the Welcome node.

解决此问题的第一个可能的方法是直接在Welcome节点中将system.locale设置为en-gb

Image for post
Setting British English locale (system.locale= en-gb) in the Welcome node
在“ 欢迎”节点中设置英式英语语言环境(system.locale = en-gb)

For a simple “What day it was?” game one may create the following dialog node, which would output day of the week for a recognized @sys-date entity:

简单的说“今天是几号?” 游戏一可以创建以下对话框节点,该对话框节点将为认可的@sys-date实体输出星期几:

Image for post
Dialog node returning day of week for a recognized @sys-date entity
返回的@ sys-date实体的对话框节点返回星期几

With locale being set to en-gb the user input “5/6/2020” would be recognized in the British English date format as June, 5, 2020.

将语言环境设置为en-gb ,用户输入“ 5/6/2020”将以英式英语日期格式识别为2020年6月5日。

Image for post
Conversation with date in British English format
以英式英语进行日期交谈

It is possible to set the locale during the course of the conversation. The dialog node below asks the user to specify a locale when their timezone is Europe/London. The user is given an option to choose from three different locales using the user-defined entity @locale.

在对话过程中可以设置语言环境。 下面的对话框节点要求用户在其时区为Europe/London时指定语言环境 。 用户可以使用用户定义的实体@locale从三个不同的语言环境中进行选择。

Image for post
Child node of the Welcome node to let the user select from multiple locale options
Welcome节点的子节点,允许用户从多个区域设置选项中进行选择

In the example below, the user has selected Canadian English locale possibly to be able to find out what was the date of the last Canadian Thanksgiving:

在下面的示例中,用户选择了加拿大英语语言环境,以便能够找出上次加拿大感恩节的日期:

Image for post
Selecting different locale during the course of dialog.
在对话过程中选择不同的语言环境。

Note that the supported locales are listed in the Watson Assistant API reference for v2 API.

请注意,v2 API的Watson Assistant API参考中列出了支持的语言环境。

日期和时间实体值替代 (Date and Time Entities Value Alternatives)

Let’s look at a restaurant booking scenario. In this scenario, the customer wants to book a table in a restaurant for a specific time. The customer might say “We will appear at 6”. Now, “at 6” is a bit ambiguous. The customer might have meant 6 am or 6 pm — 6 pm is the more probable one in this case.

让我们看一看餐厅预订场景。 在这种情况下,客户要在餐厅预订特定时间的桌子。 客户可能会说“我们将出现在6点”。 现在,“ 6点”有点含糊。 客户可能是指早上6点或下午6点-在这种情况下,下午6点才是更可能的。

The example below will show how to elegantly solve this kind of scenario with Watson Assistant and the slot filling capability with new system entities alternatives.

下面的示例将展示如何使用Watson Assistant优雅地解决这种情况,以及使用新的系统实体替代方案来填充插槽。

The first dialog node with slots presented below collects the day of the reservation, the time of reservation, and how many guests are to come:

下面显示的第一个带有插槽的对话框节点收集预订的日期,预订的时间以及要来的客人人数:

Image for post
Dialog node with slots to collect information for making a reservation.
带有用于收集预订信息的插槽的对话框节点。

Using the dialog node above, the user utterance “I want to book a table for 5 people today at 6” would be captured by this node as follows: “OK, reservation made for 2020–06–15 at 06:00:00 for 5 people”. The reservation time at 6 am is probably wrong.

使用上面的对话框节点,该节点将捕获用户话语“我今天要在6点为5个人预订桌子” ,如下所示: “确定,预订时间为2020–06–15,预订时间为06:00:00, 5人” 。 早上6点的预约时间可能是错误的。

Below, a solution to this problem is presented using a time entity alternative in found handler of the $time slot:

下面,在$ time slot的找到的处理程序中使用时间实体替代方案来解决此问题:

Image for post
Found handler for $time slot with an update to adjust reservation time to a meaningful value.
找到$ time slot的处理程序,并进行了更新以将保留时间调整为有意义的值。

This works as follows. First, the system checks if the @sys-time has alternatives (@sys-time.alternatives) and then makes additional checks on the time frame. Let's say that the probable reservation time is from 11 am (inclusive) to 23 pm (exclusive). If the alternative is within this range, the system will use the alternative (6 pm) instead of the default value (6 am in our example). As a side effect, the chatbot may also state something like “I suppose you meant 18:00:00”. Then the conversation would look like this:

其工作原理如下。 首先,系统检查@sys-time是否具有替代项( @sys-time.alternatives ),然后在时间范围内进行其他检查。 假设可能的保留时间是从上午11点 (含)到下午23点 (不含)。 如果替代值在此范围内,则系统将使用替代值( 6 pm )代替默认值(在我们的示例中为6 am )。 作为副作用,聊天机器人可能还会声明类似“我想你是说18:00:00”之类的内容 。 然后对话看起来像这样:

Image for post
Conversation when “at 6” is translated to “at 6 pm”.
将“在6点”转换为“在6点”时的会话。

In practice, the formatting of the response would not be so technical and the .reformatDateTime(String format) method could be used to make the output more appealing — such as “OK, reservation made for Monday at 6 pm for 5 people”. Please note that this approach still allows us to enforce the default values. For example, if the customer really wants to appear at 10 am:

在实践中,响应的格式设置不是那么技术性,可以使用.reformatDateTime(String format)方法使输出更具吸引力-例如“确定,在5点的星期一下午6点预订” 。 请注意,这种方法仍然允许我们强制使用默认值。 例如,如果客户真的想在上午10点出现:

Image for post
Conversation when the customer enforces “10 am”.
客户强制执行“上午10点”时的对话。

Let’s look at another example of alternatives helping to disambiguate user input when the user enters “next Tuesday” (and today is Monday). The question is if the user means tomorrow or Tuesday next week. The following dialog node options would help to disambiguate this situation:

让我们看另一个替代示例,当用户输入“下一个星期二” (今天是星期一)时,有助于消除用户输入的歧义。 问题是用户是指明天还是下周二。 以下对话框节点选项将有助于消除这种情况的歧义:

Image for post
Dialog node prepared to disambiguate “next Tuesday” by using Options response type.
对话框节点准备使用“选项”响应类型来消除“下周二”的歧义。

The conversation would then look like this (providing clickable options to choose from):

对话如下所示(提供可点击的选项供您选择):

Image for post
Conversation with clickable options to disambiguate date.
与可点击选项进行会话以消除日期歧义。

最后/这个/下一个星期三的替代方案 (Alternatives of Last/This/Next Wednesday)

The way how Watson Assistant’s @sys-date entity works with alternatives for days of weeks is as follows:

Watson Assistant的@sys-date实体与替代项在几周内的工作方式如下:

When today is 2020-06-15 (Monday)

今天是2020-06-15 (星期一)

  • last Wednesday - 2020-06-10, no alternative

    last Wednesday 2020-06-10 ,别无选择

  • Wednesday - 2020-06-17, alternative 2020-06-10

    Wednesday 2020-06-17 ,替代2020-06-10

  • this Wednesday - 2020-06-17, no alternative

    this Wednesday 2020-06-17 ,别无选择

  • next Wednesday - 2020-06-17, alternative 2020-06-24

    next Wednesday 2020-06-17 ,替代2020-06-24

When today is 2020-06-17 (Wednesday)

今天是2020-06-17 (星期三)

  • last Wednesday - 2020-06–10, no alternative

    last Wednesday 2020-06–10 ,别无选择

  • Wednesday - 2020-06-24, alternative 2020-06-17

    Wednesday 2020-06-24 ,替代2020-06-17

  • this Wednesday - 2020-06-24 alternative 2020-06-17

    this Wednesday 2020-06-24替代2020-06-17

  • next Wednesday - 2020-06-24, no alternative

    next Wednesday 2020-06-24

When today is 2020-06-18 (Thursday)

今天是2020-06-18 (星期四)

  • last Wednesday - 2020-06-17, alternative 2020-06-10

    last Wednesday 2020-06-17 ,替代2020-06-10

  • Wednesday - 2020-06-24, alternative 2020-06-17

    Wednesday 2020-06-24 ,替代2020-06-17

  • this Wednesday - 2020-06-24, alternative 2020-06-17

    this Wednesday 2020-06-24 ,替代2020-06-17

  • next Wednesday - 2020-06-24, no alternative

    next Wednesday 2020-06-24

Alternatives are used also in other situations. Let’s say that it is June 2020. For example “in May” would be then by default recognized as the future May 2021 with an alternative of May 2020, but “in August” (given the fact that it is June 2020) will be only August 2020 with no alternatives.

在其他情况下也可以使用替代方法。 假设是2020年6月。例如,默认情况下, “ 5月”将被识别为2021年5月的未来,而2020年 5月为替代,但“ 8月” (因为它是2020年6月)将仅仅是2020年8月 ,别无选择。

收集实体的多个值 (Collect Multiple Values of an Entity)

In some use cases, it is useful to be able to collect multiple values of the same entity. Here are a few examples of how to do that easily.

在某些用例中,能够收集同一实体的多个值很有用。 这里有一些简单的例子。

To collect an array of numbers using an optional slot, use the following specification of a dialog node:

要使用可选插槽收集数字数组,请使用以下对话框节点规范:

Image for post
Dialog node with one optional slot to collect multiple @sys-number values
带有一个可选插槽的对话框节点,用于收集多个@ sys-number值

The conversation would then look like this:

对话将如下所示:

Image for post
Multiple numbers collected into an array
将多个数字收集到数组中

But what if the user wants to collect literals (the exact text matched by an entity) of the recognized entities? A good example of this might be a task to collect multiple e-mail addresses. Pattern entity type might be used to find an e-mail address in the user input.

但是,如果用户想要收集已识别实体的文字(与实体匹配的确切文本)怎么办? 一个很好的例子是收集多个电子邮件地址的任务。 模式实体类型可用于在用户输入中查找电子邮件地址。

This is how the user-defined pattern entity looks like in our case (the pattern is \b([a-zA-Z0–9._-]+@([a-zA-Z0–9_-]+\.)+[a-zA-Z0–9_-]+)\b):

这就是我们定义的用户定义模式实体的样子(模式为\b([a-zA-Z0–9._-]+@([a-zA-Z0–9_-]+\.)+[a-zA-Z0–9_-]+)\b ):

Image for post
Pattern entity to recognize emails.
模式实体以识别电子邮件。

The dialog node with an optional slot looks like the previous example collecting multiple numbers:

带有可选插槽的对话框节点类似于前面的示例,该节点收集多个数字:

Image for post
Dialog node with one optional slot to collect multiple @email pattern values
具有一个可选插槽的对话框节点,用于收集多个@email模式值

However, in this case, @email.value cannot be used. When using the pattern entity one needs to collect the value using literals (@email.literal). The trick here is to open $emails slot details, open advanced JSON editor for that slot and use a special syntax to access attribute literal of the entities['email'] array using the following assignment: "emails": "<? entities['email'].![literal] ?>"

但是,在这种情况下,不能使用@email.value 。 使用模式实体时,需要使用文字( @email.literal )来收集值。 这里的窍门是打开$ emails插槽详细信息,打开该插槽的高级JSON编辑器,并使用特殊的语法通过以下分配访问literal entities['email']数组的属性literal"emails": "<? entities['email'].![literal] ?>"

Image for post
Detail of the assignment of multiple literal values in JSON editor for the $emails slot
$ emails插槽中JSON编辑器中多个文字值的分配详细信息

This is how it looks like in the Try it out panel:

这是在“ 试用”面板中的外观:

Image for post
Conversation were multiple email addresses were collected from one user input
对话是从一个用户输入中收集了多个电子邮件地址

Moreover, one can use the same ![literal] trick to collect one or multiple pattern-based phone numbers, room numbers, or user-defined entities where the intention is to collect the exact wording provided by the user.

此外,一个可以使用相同![literal]特技收集一个或多个基于模式的电话号码,房间号码,或用户定义的实体,其中目的是收集由用户提供的确切措辞。

If you’re interested in learning more, please check out the IBM Watson Assistant page at https://www.ibm.com/cloud/watson-assistant/.

如果您想了解更多信息,请访问https://www.ibm.com/cloud/watson-assistant/上的IBM Watson Assistant页面。

翻译自: https://medium.com/ibm-watson/make-your-chatbot-look-even-smarter-some-well-hidden-features-of-watson-assistant-ac38d24f6283

watson机器人

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
目前,有许多主流的AI聊天机器人平台可供选择。以下是一些较为知名的平台: 1. OpenAI:OpenAI是一个AI研究实验室,它开发了许多优秀的AI模型,包括GPT-3(Generative Pre-trained Transformer 3)。GPT-3是一个强大的语言模型,可以用于生成自然语言文本,包括用于聊天机器人的对话。 2. Dialogflow:Dialogflow是Google开发的自然语言处理平台,它提供了构建智能聊天机器人的工具和API。Dialogflow可以处理自然语言理解和生成,让开发者能够创建自然对话流程。 3. Watson AssistantWatson Assistant是IBM的聊天机器人平台,它利用自然语言处理和机器学习技术,帮助开发者构建智能助理和虚拟客服系统。它提供了丰富的开发工具和API,支持多种渠道和语言。 4. Microsoft Bot Framework:Microsoft Bot Framework是微软提供的聊天机器人开发框架,它支持多种语言和渠道,包括微软的团队通信工具Microsoft Teams。开发者可以使用Bot Framework构建自定义的聊天机器人,并利用微软的认知服务进行自然语言处理和语义理解。 5. Rasa:Rasa是一个开源的聊天机器人开发框架,它提供了强大的自然语言理解和对话管理功能。开发者可以使用Rasa构建自己的聊天机器人,并根据需求进行扩展和定制。 这只是一些主流的AI聊天机器人平台,还有许多其他平台可供选择。选择适合自己需求的平台时,可以考虑开发工具、API支持、语言处理能力、扩展性和开发者社区等方面的因素。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值