You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 30, 2019. It is now read-only.
duckling.core=> (pprint (parse :en$core "Today between 8:30 AM and 9 AM" [:time]))
({:dim :time,
:body "Today between 8:30 AM and 9 AM",
:value
{:type "interval",
:from {:value "2017-02-17T08:30:00.000-08:00", :grain :minute},
:to {:value "2017-02-17T10:00:00.000-08:00", :grain :minute},
:values
({:type "interval",
:from {:value "2017-02-17T08:30:00.000-08:00", :grain :minute},
:to {:value "2017-02-17T10:00:00.000-08:00", :grain :minute}})},
:start 0,
:end 30})
Seems like the simplest solution is to have the interval endpoint grains be decoupled. I think this also provides a more natural interpretation.
One might argue the grains should match, in which case the solution is for the :to endpoint to become (in this instance) "2017-02-17T09:01:00.000-08:00". I disagree with this, since the speaker syntax should define the grain, as is already the case with point-in-time parsing (e.g. "9 AM" has hour granularity while "9:00 AM" has minute granularity).
The text was updated successfully, but these errors were encountered:
I've identified why the end interval is being improperly shifted by an hour. In duckling.time.obj/interval-start-end, after having determined the smallest grain of the interval endpoints, the end function is used to derive the "end instant of the time object" and is passed in the to predicate. Thus, the endpoint is computed using the grain of the to predicate, without regard to what the smallest grain is.
I have a fix for this, but it "breaks" an existing example in the corpus:
0 FAIL "by the end of next month"
Expected {:start #object[org.joda.time.DateTime 0x581bac6b "2013-02-12T04:30:00.000-02:00"], :grain :second, :end #object[org.joda.time.DateTime 0x37a91d42 "2013-04-01T00:00:00.000-02:00"]}
Got {:start #object[org.joda.time.DateTime 0x32d2aa39 "2013-02-12T04:30:00.000-02:00"], :grain :second, :end #object[org.joda.time.DateTime 0x2853fc4d "2013-03-01T00:00:00.000-02:00"]}
It's not clear to me whether this is "OK" and the interpretation needs to change ... However this is a perfect example of where different grains make sense. Currently, the "within duration" rules all create from endpoints with :second granularity, discarding the grain semantics of the actual condition ("by 3PM', "by tomorrow", "by next week", "by the end of next month", ...)
Example of issue:
Seems like the simplest solution is to have the interval endpoint grains be decoupled. I think this also provides a more natural interpretation.
One might argue the grains should match, in which case the solution is for the
:to
endpoint to become (in this instance)"2017-02-17T09:01:00.000-08:00"
. I disagree with this, since the speaker syntax should define the grain, as is already the case with point-in-time parsing (e.g. "9 AM" has hour granularity while "9:00 AM" has minute granularity).The text was updated successfully, but these errors were encountered: