![](/img/trans.png)
[英]IBM Watson Assistant: What should be done if one entity value exist in multiple entities
[英]Watson Assistant Extract multiple pattern entities
我有一个实体定义为
@code
- @code:type_1 = pattern 'Y(\d{3})'
- @code:type_2 = pattern 'order number(\d{3})'
- @code:type_3 = pattern 'CZ(\d{3})'
我正在尝试像这样捕获以下上下文值
{
"context": {
"type_3s": "<? @code.filter(\"c\", \"c['value'] == 'type_3'\").joinToArray('%e.groups[1]%') ?>"
}
}
所以对于输入
Please delete codes CZ123, CZ456, and CZ789
,我的最终上下文如下所示: $type_3s =[123,456,789]
目前收到错误
SpEL evaluation error: Expression [ entities['code'].filter("c", "c['value'] == 'type_3'").joinToArray('%e.groups[1]%') ] at position 63: EL1004E: Method call: Method joinToArray(String) cannot be found on ArrayList type
在上面的示例中,code.values 的计算结果为:
@code.values =["type_3", "type_3", "type_3"]
非常感谢您在实现所需上下文方面的任何帮助,非常感谢!
我的建议是查看Watson Assistant 实体语法。 .value
返回标识的实体type_3 。 您需要使用.literal
来访问真正输入的内容。
在有关构建数据库驱动的 Slackbot的教程中,使用类似的方法来访问为位置实体输入的内容。 代码在 GitHub 上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.