Bixby 中是否有 DateTime 的原始类型?
Is there a primitive type for DateTime in Bixby?
我的模型将有选择地在许多话语中花费时间。
所以例子...
加湿尿布。 <-------- 假定当前时间
在 4:00 下午添加湿尿布
中午加瓶
建模 4 的最佳方法是什么 PM/AM 以便我可以在我的行动中收集时间?
没有原始类型 DateTime,但有一个 viv.time 库可以使用,实际上有 viv.time.DateTimeExpression 概念可以使用。
viv.time.DateTimeExpression 不仅处理“4 AM”而且"tomorrow 4 AM",你可以阅读更多here。我会说这是最常用的库概念之一。
您需要定义一个接受可选输入的操作,并确保类型为 'DateTimeExpression'。在您的 NL 训练中,您可以说 'do this thing at 4PM' 或 'do this thing' 之类的话。两者都有效,因为您将日期设为可选。在您的 javascript 中,检查用户是否说了日期。如果他们这样做了,请使用它。如果没有,您可以默认为现在。从javascript抢时间参考这个link。默认情况下,日期 api 会将日期解析为设备的本地时间(可以覆盖)。
在你的行动中
input (searchDate) {
type (time.DateTimeExpression)
min(Optional) max (One)
}
在你的javascript
var currentTime = dates.ZonedDateTime.now().getDateTime();
if (searchDate)
currentTime = //Grab the date from searchDate.
参考this。
我的模型将有选择地在许多话语中花费时间。
所以例子...
加湿尿布。 <-------- 假定当前时间 在 4:00 下午添加湿尿布 中午加瓶
建模 4 的最佳方法是什么 PM/AM 以便我可以在我的行动中收集时间?
没有原始类型 DateTime,但有一个 viv.time 库可以使用,实际上有 viv.time.DateTimeExpression 概念可以使用。
viv.time.DateTimeExpression 不仅处理“4 AM”而且"tomorrow 4 AM",你可以阅读更多here。我会说这是最常用的库概念之一。
您需要定义一个接受可选输入的操作,并确保类型为 'DateTimeExpression'。在您的 NL 训练中,您可以说 'do this thing at 4PM' 或 'do this thing' 之类的话。两者都有效,因为您将日期设为可选。在您的 javascript 中,检查用户是否说了日期。如果他们这样做了,请使用它。如果没有,您可以默认为现在。从javascript抢时间参考这个link。默认情况下,日期 api 会将日期解析为设备的本地时间(可以覆盖)。
在你的行动中
input (searchDate) {
type (time.DateTimeExpression)
min(Optional) max (One)
}
在你的javascript
var currentTime = dates.ZonedDateTime.now().getDateTime();
if (searchDate)
currentTime = //Grab the date from searchDate.
参考this。