duckling icon indicating copy to clipboard operation
duckling copied to clipboard

[EN/BG/TR] "from Monday to Sunday" /= "all week"

Open emlautarom1 opened this issue 4 years ago • 0 comments

When we say "all week" I assume that it's the same as if we said "from Monday to Sunday", yet in Duckling this represents a different time interval:

  • All week returns an interval from "Start of Monday until the start of Sunday" (2013-02-11 00:00:00 - 2013-02-18 00:00:00)
  • From Monday to Sunday returns an interval from "Start of Monday until the start of the next Monday" (2013-2-11 00:00:00 - 2013-02-18 00:00:00)

This looks like a bug, but maybe it's intentional? All 3 languages use a very similar rule:

https://github.com/facebook/duckling/blob/84175d61d6f44d0db2abb42d67c6c4213762b64f/Duckling/Time/EN/Rules.hs#L1121-L1139

If we change -2 to -1 then both inputs return the same interval - "Start of Monday until the start of the next Monday" - which I think is the correct output.

https://github.com/facebook/duckling/blob/84175d61d6f44d0db2abb42d67c6c4213762b64f/Duckling/Time/EN/Rules.hs#L1129

What's the meaning of that line? there are several magic numbers and the intention is not very clear, IMHO

emlautarom1 avatar Sep 10 '21 18:09 emlautarom1