[英]IBM Watson - Conversation Response Condition
I'm pretty new to Watson Conversation and Watson in generel, and I've come across a situation that I would like to handle in the Watson Conversation app, but I can't figure out. 我一般来说对Watson Conversation和Watson还是陌生的,遇到了我想在Watson Conversation应用程序中处理的情况,但我不知道。
Basically I want to add an "advanced" condition to a response so it will be possible to do eg: 基本上,我想在响应中添加“高级”条件,以便可以执行例如:
Condition: if @sys-number==Integer 条件:如果@ sys-number ==整数
Response: @sys-number is an integer. 响应:@ sys-number是整数。
Condition if @sys-number==Double @ sys-number == Double时的条件
Response: @sys-number is a double. 响应:@ sys-number是双精度型。
Currently I'm stuck, since I can get the @sys-number class by doing @sys-number.numeric_value.class, which evaluates to eg "class java.lang.Integer", but I cannot do the comparison in the condition field. 目前,我很困,因为我可以通过执行@ sys-number.numeric_value.class来获取@ sys-number类,该类的值例如为“ class java.lang.Integer”,但是我无法在条件字段中进行比较。
I've tried to do several different things, where the most obvious would be 我尝试做几件不同的事情,最明显的是
if (@sys-number instanceof java.lang.Integer) 如果(@ sys-number instanceof java.lang.Integer)
I know that this can be handled on the application side, but would like a solution Conversation side, if possible. 我知道可以在应用程序端处理此问题,但如果可能的话,希望在对话方面提供解决方案。
By essence the '@sys-number' entity is a string, because it belongs to the user's input. 本质上,“ @ sys-number”实体是字符串,因为它属于用户输入。 So if you want to test wether the user's input recognized @sys-number entity can be converted onto integer or a float you must try :
因此,如果要测试是否可以将用户输入的@ sys-number实体转换为整数或浮点数,则必须尝试:
IF @sys-number AND input.text.find('\d+')
IF @sys-number AND input.text.find('\d+[,\.]\d+')
If and only if none of the condition is triggered, the @sys-number comes from Alphabetic input 当且仅当未触发任何条件时,@ sys-number来自字母输入
例如,使用正则表达式将查找整数。
/^[0-9]*$/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.