IBM Watson Assistant 中的数字比较

number comparison in IBM Watson Assistant

我正在尝试在 Watson 中构建一个 BMI 计算器,但当您使用“多重条件响应”时,Watson 似乎不支持数字比较。

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

此代码将引发错误:

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

你的例子对我有用。我还可以确认 IBM Watson Assistant can compare numbers and has other support for math expressions and number processing.

这是我的回复文字:

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

我在“试一试”中的 Manage Context 中设置了 weightheight 的值”。根据值,它 returns 或者

This is: true

This is: false

您在测试期间是否设置了任何值?