我如何提取从用户输入传递的原始日期值 [英] How do i extract the original date value passed from the user input

查看:89
本文介绍了我如何提取从用户输入传递的原始日期值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文: Watson Conversation机器人有一个节点,该节点由用户的三个输入实体触发,效果很好,但我希望机器人的回复为

Context: The Watson Conversation bot has a node that gets triggered by three input entities from the user, this works fine, but i want the reply from the bot to be

正在检查您的演讲明天.请给我一点时间"

"Checking if you have a lecture tomorrow. Give me a moment"

然后在后台进行查询以建立答案,该答案稍后会反馈给用户.

then there's a query in the background building up the answer that gets replied later to the user.

强词"明天"是一个@sys日期的实体,但我希望它回复用户他/她说的而不是日期,因为该漫游器不能检查两个星期的月份ect,所有有效的日期格式,如果我可以使用用户的原始文本,答复看起来会好得多.

the strong word tomorrow is an @sys-date entity, but i want it to reply to the user what he/she said instead of the date, because the bot can check no both weeks months ect, all valid date formats, and the reply would look much better if i could use the original text from the user.

当我开始工作时,这种原产地检索也将用于其他实体.

This kind of origin retrieval will be used for other entities aswell when i get it working.

推荐答案

在这种情况下,您可以使用context变量,如果要获取特定数据,可以使用 regex 提取用户输入:

You can use the context variable in the case, and if you want to get specific data, you can use regex to extract the user input:

所有用户输入示例

"date": "<? input.text?>"

或用户输入的确切信息,例如:本周"

 "date": "<?@sys-date.literal?>"

等等.

将变量与.literal一起使用,请参见我的完整示例:

Use the variable with the .literal, see my complete example:

        {
  "context": {
    "date": "<?@sys-date.literal?>"
  },
  "output": {
    "text": {
      "values": [
        "Checking if you have a lecture $date. Give me a moment."
      ],
      "selection_policy": "sequential"
    }
  }
}

文档示例 :

这篇关于我如何提取从用户输入传递的原始日期值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆