Getting Relative Time in Alexa

I’m trying to develop Alexa skill and I need to get a relative time, for example: β€œ 5 minutes ago ”.

I defined a time interval for my skill, which takes time as 5 minutes , 6.30 am or 4 in the morning . But I can’t take a time like 5 minutes ago . I'm new to Alexa and can someone help me with this

 { "slots": [ { "name": "time", "type": "AMAZON.TIME" } ], "intent": "ReportTime" } 
+5
source share
1 answer

You can add a slot {modifier} , which can take several keywords, such as "back" and "now." Then the intention could have something like the following statements:

 { "name": "TimeTest", "samples": [ "what happened {time} {modifier}", "what will happen {time} {modifier}" ], "slots": [ { "name": "time", "type": "AMAZON.TIME", "samples": [] }, { "name": "modifier", "type": "custom_time_modifier", "samples": [] } ] } 

with the following type of modifier:

 "types": [ { "name": "custom_time_modifier", "values": [ { "id": null, "name": { "value": "ago", "synonyms": [ "in the past" ] } }, { "id": null, "name": { "value": "from now", "synonyms": [ "in the future" ] } } ] } 
+3
source

Source: https://habr.com/ru/post/1269918/


All Articles