rasa聊天机器人_Rasa-X是持续改进聊天机器人的独特方法

rasa聊天机器人

介绍 (Introduction)

When it comes to chatbot improvement, three elements are paramount:

改善聊天机器人方面 ,三个要素至关重要:

  • Continuous

    连续

  • Incremental

    增加的

  • Contextual

    语境

Most NLU environments have existing tools for conversational improvement. These tools are often characterized by by these traits:

大多数NLU环境都有用于对话改进的现有工具。 这些工具通常具有以下特征:

  • High level

    高水平

  • Statistical Approach

    统计方法

  • Bulk

  • Metrics Focused

    重点指标

  • Hard To Steer

    难以操纵

为何经常失败:用户想要遵循期望的道路 (Why This Often Fails: Users Want To Follow The Desire Path)

We talk about the happy path, and the repair path. The main aim of the repair path, is to bring the user back to the so-called happy path.

我们谈论快乐的道路 ,以及修复的道路 。 修复路径的主要目的是使用户回到所谓的快乐路径。

But, should we not rather look at renaming it? Is the happy path not the designed path…and the repair path the desire path of the user?

但是,我们是否应该宁愿考虑重命名呢? 幸福的道路不是设计的道路吗?修理的道路是否是用户的期望道路?

Image for post
Design versus Desire
设计与欲望

欲望之路 (Desire Path)

The desire path usually represents the shortest or most easily navigated route between an point of departure and a destination. In parks and open areas, the width and severity of erosion are often indicators of the traffic level that a path receives.

期望路径通常表示出发点与目的地之间的最短或最容易导航的路线。 在公园和空旷地区,侵蚀的宽度和严重程度通常是路径接收流量水平的指标。

Desire paths emerge as shortcuts where constructed or designed paths take a circuitous route, have gaps, or are sometimes non-existent.

期望路径作为捷径出现,其中已构造或设计的路径采用circuit回路线,存在间隙或有时不存在。

Back to chatobots, instead of forcing our users onto the conversations we designed for them, why not learn what their desired path is implement their preferences?

回到chatobots,为什么不让我们的用户参加我们为他们设计的对话,而是为什么不了解他们想要实现自己的偏好的途径呢?

Image for post
Left: Desire Path | :欲望之路 Right: Designed Path右:设计路径

住所 (Accommodation)

Landscapers sometimes accommodate desire paths by paving them, thereby integrating them into the official path network rather than blocking them. The image above is of an desire path being blocked and rehabilitated in an attempt to force users on the designed path.

园丁有时会通过铺砌所需路径来容纳所需路径,从而将其整合到官方路径网络中,而不是阻塞它们。 上面的图像是一个期望路径被阻止和修复,试图迫使用户使用设计的路径。

Sometimes, land planners have deliberately left land fully or partially unpathed, waiting to see what desire paths are created, and then paving those.

有时,土地规划师故意让土地完全或部分地处于无路的状态,等着看产生了什么愿望之路,然后铺路。

In Finland, planners are known to visit parks immediately after the first snowfall, when the existing paths are not visible.

在芬兰,众所周知,规划人员会在第一次降雪后立即前往公园,而此时看不到现有路径。

The naturally chosen desire paths, marked by footprints, can then be used to guide the routing of new purpose-built paths.

然后,可以使用以足迹标记的自然选择的需求路径来指导新的专用路径的路由。

对话方法的要素 (Elements OF A Conversational Approach)

从设计之路到住宿 (From Designed Paths To Accommodation)

Rasa took a completely alternative approach compared to other chatbot frameworks. By introducing something they call Conversation-Driven Development (CDD). This approach is encompassed in their Rasa-X environment.

与其他聊天机器人框架相比, Rasa采用了完全替代的方法。 通过介绍他们称为“ 对话驱动开发” ( CDD )的内容。 这种方法包含在其Rasa-X环境中。

Their approach is novel yet effective.

他们的方法新颖而有效。

With Rasa-X, what drives improvement is real conversation. And by studying real user conversations the delta between real conversations (desire) and anticipated (designed) conversations are narrowed.

使用Rasa-X , 真正的对话是推动改进的动力。 通过研究真实用户对话,可以缩小真实对话(期望)和预期(设计)对话之间的差异。

The whole process is very efficient due to a closed loop from review, to annotating to even doing NLU “development”. As you will see later in this story.

由于从审阅到注释甚至是NLU“ 开发 ”的全过程,整个过程非常高效。 正如您将在本故事的后面看到的。

The process is simplified and turned into an administrative task.

该过程被简化并变成了管理任务。

Communication between teams and translation of tasks are negated.

团队之间的沟通和任务翻译被否定。

分享你的机器人 (Sharing Your Bot)

The notion in Rasa-X to create a URL through which you can create a preview for users, reminds very much of feature IBM Watson.

Rasa-X中用于创建URL的概念使您可以通过它为用户创建预览,这使IBM Watson特性大为改观。

Image for post
IBM Watson Assistant Preview Link
IBM Watson Assistant预览链接

What this does, is create an avenue to quickly and efficiently share your bot in a way which can be revoked again just as easily. All the while creating user conversations to analyse.

这样做是为了创建一种途径,以可以轻松地再次撤销的方式快速有效地共享您的机器人。 在创建用户对话进行分析的同时。

NLU收件箱:将NLU培训转变为管理任务 (NLU Inbox: Turn NLU Training Into An Administrative Task)

Utterances from users which are not part of your training data shows up in your NLU Inbox. These utterances can annotated and classified within the web tool.

NLU收件箱中会显示不属于您的训练数据的用户发言。 这些话语可以在网络工具中进行注释和分类。

Rasa X概述:安装和功能 (Rasa X Overview: Installation & Functionality)

安装 (Installation)

Most probably you want to install Rasa X on your Windows 10 machine to play around with. I would suggestion you first install the Rasa chatbot software.

很可能您想在Windows 10计算机上安装Rasa X来玩。 我建议您先安装 Rasa chatbot软件。

Installing Rasa X will be really be an extension of your Rasa chatbot. To install Rasa X, open Anaconda Prompt window. Activate your virtual environment and run the command:

安装Rasa X确实是Rasa chatbot的扩展。 要安装Rasa X,请打开Anaconda Prompt窗口。 激活您的虚拟环境并运行命令:

pip3 install rasa-x --extra-index-url https://pypi.rasa.com/simple

Once you have successfully installed Rasa X, run the command:

成功安装Rasa X后,请运行以下命令:

rasa x

In your Anaconda window you will see the url where Rasa X is running. Simple open it in your browser.

在您的Anaconda窗口中,您将看到Rasa X运行的URL。 只需在浏览器中打开它即可。

Image for post
Rasa X Successfully Started
Rasa X成功启动

The user name and password can be found in the initialization string within the anaconda terminal.

用户名和密码可以在anaconda终端的初始化字符串中找到。

开始与您的机器人对话 (Start Talking To Your Bot)

Before you can start talking with your bot, you will have to train your first model:

在开始与您的机器人对话之前,您必须训练您的第一个模型:

rasa train

And start your bot:

并启动您的机器人:

rasa shell

互动学习 (Interactive Learning)

You have the ability to talk to your bot and make use of interactive learning while in a conversation. This bridges the gap between practical experience and training data.

您可以在对话中与您的机器人对话并利用交互式学习。 这弥合了实际经验和培训数据之间的差距。

Image for post
Interactive Learning Chat Window
互动学习聊天窗口

NLU收件箱 (NLU Inbox)

When users talk to your assistant — via a messaging channel, the Share your bot feature, or through the Talk to your bot screen — their messages are funneled into the NLU inbox. When you have unprocessed messages in the Inbox, you’ll now see an indicator in the sidebar, alerting you that messages are ready to be reviewed.

当用户通过消息通道,“ 共享您的机器人” 功能或通过“ 与您的机器人对话” 屏幕 与您的助手 交谈时, 他们的消息将被集中到NLU收件箱中。 当收件箱中有未处理的邮件时,现在您会在侧栏中看到一个指示符,提醒您已准备好查看邮件。

Image for post
List of Functionality Within Rasa X
Rasa X中的功能列表

The NLU model can be trained from the console, with a list of all models available and an indicator which one is currently in production. Switching between models are easy. This is very convenient should you want to roll back to the last model; or even a few models back.

NLU模型可以从控制台进行训练,其中包含所有可用模型的列表以及一个指示当前正在生产中的指示器。 在模型之间切换很容易。 如果要回滚到上一个模型,这将非常方便; 甚至是一些模型。

Your Pipeline configuration file is available via the console, with stories and responses.

您的管道配置文件可通过控制台获得,包括故事和响应。

创建意图和复合实体 (Creating Intents & Compound Entities)

Lastly I would like to spend some time on this one feature of Rasa X; managing and creating intents and entities. I see this as a sign that Rasa X will most probably evolve into a full-blown Graphic development tool.

最后,我想花一些时间在Rasa X的这一功能上。 管理和创建意图和实体。 我认为这标志着Rasa X很可能会发展成为成熟的Graphic开发工具。

But with a difference…

但是有所不同……

Most other GUI’s have their focus on the dialog flow, call flow, state machine, conversation state management…call it what you like. Products that come to mind here are:

大多数其他GUI都将重点放在对话流,呼叫流,状态机,对话状态管理…随便说什么。 这里想到的产品有:

  • Microsoft Composer

    微软作曲家

  • Watson Assistant

    沃森助手

  • Microsoft Power Virtual Agents

    Microsoft Power虚拟代理

  • etc.

    等等

It is design driven development of the chatbot. Or dialog driven development. The notion of, the more we improve the conversational design the better our chatbot will improve.

它是聊天机器人的设计驱动开发。 还是对话框驱动的开发。 的概念是,我们越改进对话设计,我们的聊天机器人就会越好。

Rasa is unique in the sense that they approach this problem from a conversational perspective. Something they refer to as Conversational-Driven Development.

从他们从对话的角度解决这个问题的意义上说,Rasa是独一无二的。 他们将其称为“ 对话驱动开发”

The focus is on improving the Conversational Experience by focusing on:

重点是通过改善以下方面来改善会话体验:

  • Chatting with your own chatbot and correcting it on the fly (interactive learning).

    与您自己的聊天机器人聊天并即时进行纠正(交互式学习)。

  • Studying how your users interact with the chatbot.

    研究您的用户如何与聊天机器人进行交互。

The reason I say Rasa X is an excellent development tool, is illustrated by their intent and entity management.

我说Rasa X是出色的开发工具的原因可以通过其意图和实体管理来说明。

Let’s look at a practical example; within Rasa X you can create a new intent for your chatbot.

让我们看一个实际的例子。 在Rasa X中,您可以为您的聊天机器人创建新的意图。

Image for post
Create a New Intent
创建一个新的意图

We are naming our new intent:

我们正在命名我们的新意图:

travel_detail

Once defined, we need to give example utterances for this intent. fifteen to twenty examples are good. We start with the example:

定义好之后,我们需要针对此意图给出示例话语。 十五到二十个例子是好的。 我们从示例开始:

I want to travel from Berlin to Stuttgart by train tomorrow.

We can save the example, and add more examples.

我们可以保存示例,并添加更多示例。

Image for post
Example Utterance for Intent: travel_detail
意图的话语示例:travel_detail

The challenge is that within this intent there multiple entities we would like to capture. These entities can be fined graphically within Rasa X, and also contextually.

挑战在于,在此意图下,我们想要捕获多个实体。 这些实体可以在Rasa X中以及在上下文中以图形方式进行细化。

Intents can be seen as verbs and entities as nouns. The phrase slot filling also refers to capturing entities.

意图可以看作动词,实体可以看作名词。 短语插槽填充还指捕获实体。

Contextually means that entities are not recognized by the chatbot by asking the user directly for the input, or found via a finite lookup list. But rather entities are detected based on their context within the utterance or sentence.

上下文意味着聊天机器人无法通过直接向用户询问输入或通过有限的查找列表来发现实体。 而是根据实体在话语或句子中的上下文来检测实体。

This is closer aligned with how we as humans detect entities in a conversation.

这与我们人类如何检测对话中的实体更加一致。

Image for post
The word “Berlin” is selected and tagged as Entity type “from_city”
选择“柏林”一词并将其标记为实体类型“ from_city”

The word Berlin can be highlighted, and very intuitively a popup prompts us to define an Entity type or synonym. For now we are focusing on the Entity type.

柏林一词可以突出显示,并且非常直观地弹出窗口提示我们定义实体类型或同义词。 目前,我们专注于Entity类型。

We have two cities in the sentence, one the point of departure. The other the destination.

我们在句子中有两个城市,一个是出发点。 另一个目的地。

Hence to entity types. In this context, we mark Berlin as an entity type from_city.

因此是实体类型。 在这种情况下,我们将柏林标记为实体类型from_city。

Image for post
Continuing of Entity Annotation
实体注释的继续

The other entities we are interested in, we mark in the sentence.

我们感兴趣的其他实体,我们在句子中标记。

Image for post
Creating Entity Names or Types
创建实体名称或类型

Each of the marked portions in the sentence we assign to an entity name we created. The different entities are conveniently marked in the sentence with different colors.

我们将句子中每个标记的部分分配给我们创建的实体名称。 方便地在句子中用不同的颜色标记不同的实体。

The list of entities are:

实体列表为:

date_time
travel_mode
from_city
to_city

Adding more intent examples are easy an the process of becomes almost an administrative task. Below you can see from the color coding which entities are of the same type.

添加更多意向示例很容易,过程几乎变成了管理任务。 在下面,您可以从颜色编码中看到哪些实体属于同一类型。

Image for post
Adding a Second Intent Example
添加第二个意图示例

结论 (Conclusion)

The challenge that an unstructured input environment like chabots pose is that you cannot anticipate every possible variation of user input.

象机器人这样的非结构化输入环境所带来的挑战是,您无法预期用户输入的所有可能变化。

However, user input is a good indicator of what is on the mind of users. And making use of those conversations, following conversation driven development, leads to quicker iterations and rapid improvements.

但是,用户输入可以很好地表明用户的想法。 在对话驱动的开发之后,利用这些对话,可以加快迭代速度并快速改进。

在这里… (Read More Here…)

翻译自: https://medium.com/@CobusGreyling/rasa-x-has-a-unique-approach-to-continuous-chatbot-improvement-420a367f4146

rasa聊天机器人

Published by

风君子

独自遨游何稽首 揭天掀地慰生平