week to date / wtd as
date1 = starting date of this week
date2 = today’s date
month to date / mtd as
date1 = starting date of the this month
date2 = today’s date
year to date / ytd as
date1 = starting date of this year
date2 = today’s date
I have tried to extract using duckling but duckling is not able to extract the dates. I am trying to handle the dates in the custom action, so if I know the duckling output and the granularity as week, month or year I am calculating the date 2 accordingly.
Since on parsing these statements duckling is not able to give me any information. Kindly help to figure out this!
My end goal is:
If user is asking the bot :
User : What is my sales wtd ( week to date)
Bot : Calculate the sales between the date1 as starting date of this week and date 2 as today’s date
Note - It would be really great if more queries like last week same day/ last month same day/ last year same day could be also handled!
Duckling manages date dimensions which are generally used in proper english. What you are describing here is very genre specific , a custom dimension. you can add these rules in duckling as a custom dimension
for the life of me, i still haven’t figured why they wrote duckling in Haskell, so it is hard for me to understand it.
however you can also try lookup table and add these wtd,mtd,ytd as entities and just do calculations in your code itself.