问题描述
在某些情况下,我使用插槽,对于其中一种情况,我需要检查插槽是否识别出实体或上下文变量.
I'm using slots for some situations, and for one of this I need to check if slot recognized a entity or a context variable.
为此,我将@myEntity || $MyVar
写入检查"列,并将$MyVar
放入另存为"列.
To do it I wrote @myEntity || $MyVar
into the "Check" column, and put $MyVar
into "Save it as" column.
问题是,当WCS转到该插槽时,我的变量$MyVar
会以||
作为前缀填充,从而导致|| ValueFromMyVar
.
The problem is, when the WCS goes to this slot, my variable$MyVar
is being populated with ||
as a prefix, resulting in || ValueFromMyVar
.
我没有发现在插槽上使用变量的任何限制,也没有发现有关操作员使用'||的限制. &'.
I did not find any restrictions to use variables on slots and also did not find restrictions about operators usage '|| &&'.
我可以将这些运算符用作锁定检查条件吗?
Can I use these operators as a slock check condition?
如果没有限制,为什么我会得到错误的值?
If there is no restriction, Why am I getting the wrong value?
推荐答案
简短的答案是您上面的内容不起作用.插槽不尝试处理条件,因为它试图匹配一个值.
The short answer is what you have above won't work. Slots does not process conditions, as it is trying to match a value.
您还要检查一个变量,如果它具有一个值,则只会将该值放回自身.
Also you are checking for a variable, that if it has a value will just put the value back into itself.
如果这是您要执行的操作,则可以在多个插槽中重载该变量.例如.
If that is your intended action, then you can overload the variable with multiple slots. For example.
这将采用当前值(如果存在)并将其保留在变量中.否则,它将查看是否键入了实体,然后将其分配给变量.
This will take the current value if it exists and leave it in the variable. Otherwise it will see if the entity was typed in and then assign it to the variable.
这同样适用于意图,但不适用于条件.
This will work with intents as well, but not conditions.
免责声明:这是被观察到的行为,但是我没有找到任何文档.根据开发的内容而定,这可能是副作用,也可能是功能.
Disclaimer: This is observed behaviour, but I found no documentation on it. Depending on what development come back to me on it, this may either be a side effect, or a feature.
这篇关于Watson对话服务,与操作员一起使用插槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!