mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 13:25:40 +03:00
fix hanging ci (#626)
Summary: resolves https://github.com/facebook/duckling/issues/622 Pull Request resolved: https://github.com/facebook/duckling/pull/626 Reviewed By: stroxler Differential Revision: D28842781 Pulled By: chessai fbshipit-source-id: 3210bbf9eb76f21c90af86f6abdeac566fc86415
This commit is contained in:
parent
5d8d99bbf4
commit
878beb7aa1
@ -70,7 +70,6 @@ import Duckling.Types
|
|||||||
, Rule
|
, Rule
|
||||||
)
|
)
|
||||||
import qualified Duckling.Types as Types
|
import qualified Duckling.Types as Types
|
||||||
|
|
||||||
import qualified Duckling.Duration.Types as TDuration
|
import qualified Duckling.Duration.Types as TDuration
|
||||||
import qualified Duckling.Numeral.Types as TNumeral
|
import qualified Duckling.Numeral.Types as TNumeral
|
||||||
import qualified Duckling.Ordinal.Types as TOrdinal
|
import qualified Duckling.Ordinal.Types as TOrdinal
|
||||||
@ -209,13 +208,15 @@ takeNthClosest n cyclicPred basePred =
|
|||||||
f t ctx = mth (n `max` 0) past future Nothing
|
f t ctx = mth (n `max` 0) past future Nothing
|
||||||
where
|
where
|
||||||
(past, future) = runPredicate cyclicPred t ctx
|
(past, future) = runPredicate cyclicPred t ctx
|
||||||
against = fmap (negate . TTime.diffStartTime t)
|
|
||||||
mth m pa fu res
|
mth m pa fu res
|
||||||
| n < 0 = res
|
| m < 0 = res
|
||||||
| otherwise = case comparing against x y of
|
| otherwise = case comparing against x y of
|
||||||
GT -> mth (m-1) (tailSafe pa) fu x
|
GT -> mth (m-1) (tailSafe pa) fu x
|
||||||
_ -> mth (m-1) pa (tailSafe fu) y
|
_ -> mth (m-1) pa (tailSafe fu) y
|
||||||
where (x,y) = both listToMaybe (pa,fu)
|
where (x,y) = both listToMaybe (pa,fu)
|
||||||
|
against :: Maybe TTime.TimeObject -> Maybe Time.NominalDiffTime
|
||||||
|
against = fmap (negate . TTime.diffStartTime t)
|
||||||
|
tailSafe :: [a] -> [a]
|
||||||
tailSafe (_:xs) = xs
|
tailSafe (_:xs) = xs
|
||||||
tailSafe [] = []
|
tailSafe [] = []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user