mirror of
https://github.com/facebook/duckling.git
synced 2024-11-24 15:43:20 +03:00
23ec021b07
Summary: This commit fixes #111, which was an open issue that any non-integer multiple of any unit of time was being converted to seconds. My solution is to write a recursive function `Duration.Helpers.inCoarsestGrain` which, given a grain `g` and double value `v` finds the coarses grain `g'` such that `v * g` - rounded to the nearest seconds - has integral units. We call this function only in the case of non-integer multiples, and we start our search from the given grain because nothing coarser would make sense. The code could actually be slightly more efficient if we started at the next-smallest grain, but in the interest of clarity I think this is probably better. Reviewed By: chessai Differential Revision: D27891439 fbshipit-source-id: b048310963eb71337fd91ab4ef3c840134a76e73 |
||
---|---|---|
.. | ||
AR | ||
BG | ||
DA | ||
DE | ||
EL | ||
EN | ||
ES | ||
FR | ||
GA | ||
HE | ||
HI | ||
HR | ||
HU | ||
IT | ||
JA | ||
KA | ||
KO | ||
MN | ||
NB | ||
NL | ||
PL | ||
PT | ||
RO | ||
RU | ||
SV | ||
TR | ||
UK | ||
ZH | ||
Helpers.hs | ||
Rules.hs | ||
Types.hs |