简体   繁体   English

IBM Watson Assistant 中的数字比较

[英]number comparison in IBM Watson Assistant

I am trying to build a BMI calculator inside Watson but it seems like Watson is not supporting number comparison when you use the "Multiple conditioned responses".我正在尝试在 Watson 中构建一个 BMI 计算器,但是当您使用“多个条件响应”时,Watson 似乎不支持数字比较。

<? ($weight /  ($height * $height) ) < 18.5  ?>

This code will throw an error:此代码将引发错误:

SpelParseException when evaluating dialog node ID [response_8_1624288200413]. Condition [<? ($weight / ($height * $height) ) < 18.5 ?>] could not be parsed. Check the syntax of the expression. SpEL syntax error: Expression [<? ($weight / ($height * $height) ) < 18.5 ?>] converted to [<? (context['weight'] / (context['height'] * context['height']) ) < 18.5 ?>] at position 0: EL1070E: Problem parsing left operand

Your example works for me.你的例子对我有用。 I can also confirm that IBM Watson Assistant can compare numbers and has other support for math expressions and number processing .我还可以确认IBM Watson Assistant 可以比较数字,并且还支持数学表达式和数字处理

This is my response text:这是我的回复文字:

This is: <? ($weight / ($height*$height)) < 18.5 ?>

I set values for weight and height in Manage Context in the "Try it".我在“试试看”的“管理上下文”中设置了体重身高的值。 Depending on the values, it returns either根据值,它返回

This is: true这是真实的

or或者

This is: false这是:假的

Have you set any values during your tests?您在测试期间是否设置了任何值?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM