{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Distance.RO.Rules
( rules ) where
import Data.String
import Prelude
import Duckling.Dimensions.Types
import Duckling.Distance.Helpers
import qualified Duckling.Distance.Types as TDistance
import Duckling.Types
ruleLatentDistKm :: Rule
ruleLatentDistKm = Rule
{ name = "<latent dist> km"
, pattern =
[ dimension Distance
, regex "(kilometr[iu]|km)"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Kilometre dd
_ -> Nothing
}
ruleLatentDistPicioare :: Rule
ruleLatentDistPicioare = Rule
{ name = "<latent dist> picioare"
, pattern =
[ dimension Distance
, regex "(picio(are|r))"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Foot dd
_ -> Nothing
}
ruleLatentDistInch :: Rule
ruleLatentDistInch = Rule
{ name = "<latent dist> inch"
, pattern =
[ dimension Distance
, regex "(inch|inci|inchi)"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Inch dd
_ -> Nothing
}
ruleLatentDistYarzi :: Rule
ruleLatentDistYarzi = Rule
{ name = "<latent dist> yarzi"
, pattern =
[ dimension Distance
, regex "y(ar)?(zi|d)?"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Yard dd
_ -> Nothing
}
ruleDistMeters :: Rule
ruleDistMeters = Rule
{ name = "<dist> meters"
, pattern =
[ dimension Distance
, regex "(metr[ui]|m)"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Metre dd
_ -> Nothing
}
ruleDistCentimeters :: Rule
ruleDistCentimeters = Rule
{ name = "<dist> centimeters"
, pattern =
[ dimension Distance
, regex "(centimetr[iu]|cm)"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Centimetre dd
_ -> Nothing
}
ruleDistMiles :: Rule
ruleDistMiles = Rule
{ name = "<dist> miles"
, pattern =
[ dimension Distance
, regex "mil(e|a|ă)"
]
, prod = \tokens -> case tokens of
(Token Distance dd:_) ->
Just . Token Distance $ withUnit TDistance.Mile dd
_ -> Nothing
}
rules :: [Rule]
rules =
[ ruleDistCentimeters
, ruleDistMeters
, ruleDistMiles
, ruleLatentDistInch
, ruleLatentDistKm
, ruleLatentDistPicioare
, ruleLatentDistYarzi
]