简体   繁体   English

如何在Rasa中设置默认操作

[英]How to set default action in Rasa

Using vanilla Rasa NLU will cause Rasa core to make use of the outputs of the highest probability of an intent or entity value. 使用香草Rasa NLU将使Rasa核心使用意图或实体值的最高可能性的输出。 In other words, even if the probability of an intent is low, and yet it is the highest of all the options, it is still taken by Rasa core as the intent the user is conveying. 换句话说,即使意图的可能性很小,但是它是所有选项中最高的,但Rasa core仍将其视为用户传达的意图。 How do I make it so that Rasa core performs a default action if the probability of the maximum probability intent provided by the NLU is below a certain threshold, say 5%? 如果NLU提供的最大概率意图的概率低于某个阈值(例如5%),如何使Rasa核心执行默认操作?

We can achieve this by adding FallbackPolicy in policies file. 我们可以通过在策略文件中添加FallbackPolicy来实现。 For eg: 例如:

policies:
  - name: "FallbackPolicy"
    nlu_threshold: 0.1
    core_threshold: 0.1
    fallback_action_name: "fallback_action"

This feature was added recently and is called Fallback Policy . 此功能是最近添加的,称为“ 回退策略”

See documentation here: https://core.rasa.com/patterns.html?highlight=fallback%20policy#fallback-default-actions 请参阅此处的文档: https : //core.rasa.com/patterns.html?highlight=fallback%20policy#fallback-default-actions

Simply you can do it in two steps 只需两步即可完成

Step 1 In domain.yml file 步骤1domain.yml文件中

actions:
  - action_default_fallback

Step 2 In action.py file 步骤2action.py文件中

class ActionDefaultFallback(Action):

   def name(self):
      return "action_default_fallback"

   def run(self, dispatcher, tracker, domain):
      dispatcher.utter_message("Sorry, I couldn't understand.")

Now, whenever intent classification confidence will be below a certain threshold, this default action will execute. 现在,只要意图分类置信度低于某个阈值,就会执行此默认操作。

Resource: 资源:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果用户在我的应用中将我的操作设置为默认操作,我该如何取消默认操作? - how can i cancel the default action if user set my action as default in my app? MVC(新手问题):如何在创建操作期间为视图设置默认值? - MVC (newbie question): How do you set the default value for a View during a Create action? 在 Android Studio 中执行某个操作后,如何设置我的复选框默认选中? - How do I set my checkbox checked by default after a certain action is performed in Android Studio? angular 1.5 $ resource,如何为所有请求设置默认动作(例如transformResponse)? - angular 1.5 $resource, how to set default action, (e.g. transformResponse) for all requests? 如何在struts-config.xml中为操作设置默认参数值? - How can I set default parameter value for an action in struts-config.xml? 如何将“python”设置为默认值 - How to set "python" as default 如何设置默认图像 - How to set a default image 如何将自己的应用设置为默认 - How to set own app as default Mathematica - 如何设置默认样式表 - Mathematica - How to set default stylesheet 如何在GRAPHQL中设置默认值 - How to set a default value in GRAPHQL
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM