如何在Watson对话中提取当前日期 [英] How to extract current date in watson conversation

查看:115
本文介绍了如何在Watson对话中提取当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Watson对话对话框模型中创建一个条件,如下所示:

I need to create a condition, in Watson Conversation dialog model, like this:

如果今天是日期"< 2017年4月15日做某事. 别的事.

if "today's date" < 04-15-2017 do something. else do something else.

我宁愿不询问用户当前日期并保存它.

I prefer not asking the user for current date and save it.

我尝试了很多方法,但是它们不起作用,我还尝试输出日期(不起作用):

I tried many ways but they don't work, I also tried to output the date (doesn't work):

{
  "context": {
    "currdate": "@sys-date:today"
  },
  "output": {
    "text": {
      "values": [
        "here it is $currdate"
      ],
      "selection_policy": "sequential"
    }
  }
} 

推荐答案

我不确定,但是在尝试过的所有测试中,如果用户今天不输入内容或其他内容,Watson不会识别,但是,我相信使用代码,我们可以做一些事情.可能与IBM Watson合作的人会正确回答您.

I'm not sure about that, but with all tests I've tried, if user dont type today or something, Watson dont recognize, but, I believe with code we can do something. Probably someone work with IBM Watson will answer you correctly.

但是,据我的基本知识:

But, in my basic knowledge:

尝试在条件中使用now()并将日期保存在上下文变量中.

Try use now() in condition and save the date inside context variable.

返回值为:

yyyy-MM-dd HH:mm:ss

使用您的代码获取上下文变量并仅获取日期...在可以设置条件之后...

Use your code to get the context variable and get just the date... after you can make conditions...

JSON示例:

{
  "context": {
    "dateHour": "<? now() ?>"
  },
  "output": {
    "text": {
      "values": [
        "Now is $dateHour."
      ],
      "selection_policy": "sequential"
    }
  }
}

我正在研究有关Watson中有关System实体的所有文档,并且如果用户不请求,我看不到任何有关提取数据的信息,但是,我怎么说,可能是IBM的工作人员会回答,我只是在尝试帮助您我的基本知识.

I'm study all documentation about System entities within Watson and I dont see anything about extract the data if user dont request, but, how I say, probably someone work at IBM will answer, I'm just trying help you with my basic knowledge.

有关此实体的文档,请参见@sys-date now() 此处.

Check the Documentation about this entitie @sys-date now() here.

这篇关于如何在Watson对话中提取当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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