【问题标题】:number comparison in IBM Watson AssistantIBM Watson Assistant 中的数字比较
【发布时间】:2021-06-21 16:16:53
【问题描述】:

我正在尝试在 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

编辑:解决了。这是我自己的错。如果您在“多个条件响应”中设置条件,请不要包含。

在这种情况下,您只需输入($weight / ($height * $height) ) &lt; 18.5 在“如果助手识别”部分中

【问题讨论】:

    标签: ibm-cloud ibm-watson watson-assistant


    【解决方案1】:

    你的例子对我有用。我也可以确认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 的值。根据值,它返回任一

    这是:真的

    这是:错误

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

    【讨论】:

    • 对不起,我在“多重条件响应”下遇到了这个问题。我试图以此为条件,但失败了
    • 能否先将结果赋给一个变量,然后将该变量用作条件?
    • 我已经找到原因了:你不需要 ?> 在“多重条件反应”中。谢谢你帮助我!
    猜你喜欢
    • 2019-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-01
    • 2021-03-05
    • 2020-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多