mirror of
https://github.com/facebook/duckling.git
synced 2024-11-28 08:34:46 +03:00
Distance: Don't return type in interval bounds
Summary: We were returning `"type":"value"` for each bound. Reviewed By: blandinw Differential Revision: D7011092 fbshipit-source-id: d2b5c4d28505a1f24749ecc3975e04c7ba7a6fe1
This commit is contained in:
parent
43079e7113
commit
55b0d1d437
@ -118,14 +118,18 @@ data AmountOfMoneyData = AmountOfMoneyData
|
||||
|
||||
instance Resolve AmountOfMoneyData where
|
||||
type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue
|
||||
resolve _ AmountOfMoneyData {value = Nothing, minValue = Nothing, maxValue = Nothing} = Nothing
|
||||
resolve _ AmountOfMoneyData {value = Nothing, minValue = Nothing
|
||||
, maxValue = Nothing} = Nothing
|
||||
resolve _ AmountOfMoneyData {value = Just value, currency} =
|
||||
Just $ simple currency value
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Just from, maxValue = Just to} =
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
||||
, minValue = Just from, maxValue = Just to} =
|
||||
Just $ between c (from, to)
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Just v, maxValue = Nothing} =
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
||||
, minValue = Just v, maxValue = Nothing} =
|
||||
Just $ above c v
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c, minValue = Nothing, maxValue = Just v} =
|
||||
resolve _ AmountOfMoneyData {value = Nothing, currency = c
|
||||
, minValue = Nothing, maxValue = Just v} =
|
||||
Just $ under c v
|
||||
|
||||
data IntervalDirection = Above | Under
|
||||
|
@ -75,9 +75,8 @@ data SingleValue = SingleValue
|
||||
|
||||
instance ToJSON SingleValue where
|
||||
toJSON (SingleValue unit value) = object
|
||||
[ "type" .= ("value" :: Text)
|
||||
, "value" .= value
|
||||
, "unit" .= unit
|
||||
[ "value" .= value
|
||||
, "unit" .= unit
|
||||
]
|
||||
|
||||
data DistanceValue
|
||||
|
Loading…
Reference in New Issue
Block a user