duckling_old icon indicating copy to clipboard operation
duckling_old copied to clipboard

[EN] Grain of `<duration> ago`

Open almostimplemented opened this issue 8 years ago • 0 comments

When people say "in two days" or "three days ago", they typically are referring to the whole day. Currently, duckling.time.prod/duration-ago and /in-duration (typically) change the grain to be one below (finer than) the grain of the duration. I think the semantics are slightly trickier than this.

I would contend most of the time, these two utterances should have equivalent meaning:

duckling.core=> (parse :en$core "the day before yesterday" [:time])
({:dim :time, :body "the day before yesterday", :value {:type "value", :value "2017-02-20T00:00:00.000-08:00", :grain :day, :values ()}, :start 0, :end 24})
duckling.core=> (parse :en$core "two days ago" [:time])
({:dim :time, :body "two days ago", :value {:type "value", :value "2017-02-20T16:00:00.000-08:00", :grain :hour, :values ()}, :start 0, :end 12})

When the duration grain is :hour, I think refining the grain to :minute makes good sense ... Saying "in two hours" at 1:30 usually means 3:30. However, if the duration is :minute, I'm not sure it makes sense to change the grain. If I say "in an hour and a half", I'm not making a to-the-second specification.

Another instance where refining the grain makes sense is "a week ago" and "a month ago", refining to :day (as is currently the case).

Thoughts? I guess my only real qualms are going from :day to :hour and from :minute to :second, and the former is the only one I feel strongly about.

almostimplemented avatar Feb 23 '17 00:02 almostimplemented