packages feed

duckling 0.1.0.0 → 0.1.1.0

raw patch · 112 files changed

+3778/−1900 lines, 112 filesnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

- Duckling.AmountOfMoney.Types: AmountOfMoneyValue :: Currency -> Double -> AmountOfMoneyValue
- Duckling.Resolve: fromZonedTime :: ZonedTime -> DucklingTime
+ Duckling.AmountOfMoney.Helpers: withInterval :: (Double, Double) -> AmountOfMoneyData -> AmountOfMoneyData
+ Duckling.AmountOfMoney.Helpers: withMax :: Double -> AmountOfMoneyData -> AmountOfMoneyData
+ Duckling.AmountOfMoney.Helpers: withMin :: Double -> AmountOfMoneyData -> AmountOfMoneyData
+ Duckling.AmountOfMoney.Types: Above :: IntervalDirection
+ Duckling.AmountOfMoney.Types: IntervalValue :: (SingleValue, SingleValue) -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: MYR :: Currency
+ Duckling.AmountOfMoney.Types: OpenIntervalValue :: (SingleValue, IntervalDirection) -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: SimpleValue :: SingleValue -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: SingleValue :: Currency -> Double -> SingleValue
+ Duckling.AmountOfMoney.Types: Under :: IntervalDirection
+ Duckling.AmountOfMoney.Types: [maxValue] :: AmountOfMoneyData -> Maybe Double
+ Duckling.AmountOfMoney.Types: [minValue] :: AmountOfMoneyData -> Maybe Double
+ Duckling.AmountOfMoney.Types: above :: Currency -> Double -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: between :: Currency -> (Double, Double) -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: data IntervalDirection
+ Duckling.AmountOfMoney.Types: data SingleValue
+ Duckling.AmountOfMoney.Types: instance Control.DeepSeq.NFData Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance Data.Aeson.Types.ToJSON.ToJSON Duckling.AmountOfMoney.Types.SingleValue
+ Duckling.AmountOfMoney.Types: instance Data.Hashable.Class.Hashable Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance GHC.Classes.Eq Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance GHC.Classes.Eq Duckling.AmountOfMoney.Types.SingleValue
+ Duckling.AmountOfMoney.Types: instance GHC.Classes.Ord Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance GHC.Generics.Generic Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance GHC.Show.Show Duckling.AmountOfMoney.Types.IntervalDirection
+ Duckling.AmountOfMoney.Types: instance GHC.Show.Show Duckling.AmountOfMoney.Types.SingleValue
+ Duckling.AmountOfMoney.Types: openInterval :: IntervalDirection -> Currency -> Double -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: simple :: Currency -> Double -> AmountOfMoneyValue
+ Duckling.AmountOfMoney.Types: single :: Currency -> Double -> SingleValue
+ Duckling.AmountOfMoney.Types: under :: Currency -> Double -> AmountOfMoneyValue
+ Duckling.Core: CS :: Lang
+ Duckling.Core: fromZonedTime :: ZonedTime -> DucklingTime
+ Duckling.Dimensions.CS: allDimensions :: [Some Dimension]
+ Duckling.Distance.CS.Corpus: corpus :: Corpus
+ Duckling.Distance.CS.Rules: rules :: [Rule]
+ Duckling.Distance.TR.Corpus: corpus :: Corpus
+ Duckling.Distance.TR.Rules: rules :: [Rule]
+ Duckling.Duration.Helpers: minutesFromHourMixedFraction :: Integer -> Integer -> Integer -> DurationData
+ Duckling.Duration.TR.Corpus: corpus :: Corpus
+ Duckling.Duration.TR.Rules: rules :: [Rule]
+ Duckling.Lang: CS :: Lang
+ Duckling.Numeral.CS.Corpus: corpus :: Corpus
+ Duckling.Numeral.CS.Rules: rules :: [Rule]
+ Duckling.Numeral.Helpers: divide :: Token -> Token -> Maybe Token
+ Duckling.Numeral.Helpers: parseInteger :: Text -> Maybe Integer
+ Duckling.Ordinal.DE.Corpus: negativeCorpus :: NegativeCorpus
+ Duckling.Ranking.Classifiers.CS: classifiers :: Classifiers
+ Duckling.Rules.CS: rules :: Some Dimension -> [Rule]
+ Duckling.Temperature.TR.Corpus: corpus :: Corpus
+ Duckling.Temperature.TR.Rules: rules :: [Rule]
+ Duckling.Time.Types: NoShow :: a -> NoShow a
+ Duckling.Time.Types: containsTimeIntervalsPredicate :: Predicate -> Bool
+ Duckling.Time.Types: instance GHC.Show.Show (Duckling.Time.Types.NoShow a)
+ Duckling.Time.Types: instance GHC.Show.Show Duckling.Time.Types.AMPM
+ Duckling.Time.Types: instance GHC.Show.Show Duckling.Time.Types.Predicate
+ Duckling.Time.Types: mkEmptyPredicate :: Predicate
+ Duckling.Time.Types: newtype NoShow a
+ Duckling.TimeGrain.TR.Rules: rules :: [Rule]
+ Duckling.Volume.TR.Corpus: corpus :: Corpus
+ Duckling.Volume.TR.Rules: rules :: [Rule]
- Duckling.AmountOfMoney.Types: AmountOfMoneyData :: Maybe Double -> Currency -> AmountOfMoneyData
+ Duckling.AmountOfMoney.Types: AmountOfMoneyData :: Maybe Double -> Currency -> Maybe Double -> Maybe Double -> AmountOfMoneyData
- Duckling.AmountOfMoney.Types: [vCurrency] :: AmountOfMoneyValue -> Currency
+ Duckling.AmountOfMoney.Types: [vCurrency] :: SingleValue -> Currency
- Duckling.AmountOfMoney.Types: [vValue] :: AmountOfMoneyValue -> Double
+ Duckling.AmountOfMoney.Types: [vValue] :: SingleValue -> Double
- Duckling.Core: Entity :: Text -> Text -> Text -> Int -> Int -> Entity
+ Duckling.Core: Entity :: Text -> Text -> Value -> Int -> Int -> Entity
- Duckling.Core: [value] :: Entity -> Text
+ Duckling.Core: [value] :: Entity -> Value
- Duckling.Time.Helpers: interval :: TimeIntervalType -> (TimeData, TimeData) -> TimeData
+ Duckling.Time.Helpers: interval :: TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
- Duckling.Time.Types: SeriesPredicate :: SeriesPredicate -> Predicate
+ Duckling.Time.Types: SeriesPredicate :: (NoShow SeriesPredicate) -> Predicate
- Duckling.Types: Entity :: Text -> Text -> Text -> Int -> Int -> Entity
+ Duckling.Types: Entity :: Text -> Text -> Value -> Int -> Int -> Entity
- Duckling.Types: [value] :: Entity -> Text
+ Duckling.Types: [value] :: Entity -> Value

Files

Duckling/AmountOfMoney/EN/Corpus.hs view
@@ -22,31 +22,36 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 1)+             [ "$1"+             , "one dollar"+             , "a dollar"+             ]+  , examples (simple Dollar 10)              [ "$10"              , "$ 10"              , "10$"              , "10 dollars"              , "ten dollars"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "10 cent"              , "ten pennies"              , "ten cents"              , "10 c"              , "10¢"              ]-  , examples (AmountOfMoneyValue Dollar 1e4)+  , examples (simple Dollar 1e4)              [ "$10K"              , "10k$"              , "$10,000"              ]-  , examples (AmountOfMoneyValue USD 3.14)+  , examples (simple USD 3.14)              [ "USD3.14"              , "3.14US$"              , "US$ 3.14"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20\x20ac"              , "20 euros"              , "20 Euro"@@ -56,22 +61,22 @@              , "20€"              , "20 €ur"              ]-  , examples (AmountOfMoneyValue Pound 10)+  , examples (simple Pound 10)              [ "\x00a3\&10"              , "ten pounds"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rupees"              , "20Rs"              , "Rs20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupees 43"              , "twenty rupees 43"              ]-  , examples (AmountOfMoneyValue Dollar 20.43)+  , examples (simple Dollar 20.43)              [ "$20 and 43c"              , "$20 43"              , "20 dollar 43c"@@ -80,34 +85,81 @@              , "20 dollar 43"              , "twenty dollar and 43"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3.01"              , "GBP 3.01"-             , "3 GBP 1 cent"+             , "3 GBP 1 pence"              ]-  , examples (AmountOfMoneyValue Unnamed 42)+  , examples (simple Unnamed 42)              [ "42 bucks"              , "around 42 bucks"              , "exactly 42 bucks"              ]-  , examples (AmountOfMoneyValue KWD 42)+  , examples (simple KWD 42)              [ "42 KWD"              , "42 kuwaiti Dinar"              ]-  , examples (AmountOfMoneyValue LBP 42)+  , examples (simple LBP 42)              [ "42 LBP"              , "42 Lebanese Pounds"              ]-  , examples (AmountOfMoneyValue EGP 42)+  , examples (simple EGP 42)              [ "42 EGP"              , "42 egyptianpound"              ]-  , examples (AmountOfMoneyValue QAR 42)+  , examples (simple QAR 42)              [ "42 QAR"              , "42 qatari riyals"              ]-  , examples (AmountOfMoneyValue SAR 42)+  , examples (simple SAR 42)              [ "42 SAR"              , "42 Saudiriyal"+             ]+  , examples (simple MYR 42)+             [ "42 MYR"+             , "42 RM"+             , "RM 42"+             , "MYR 42"+             , "42MYR"+             , "42RM"+             , "RM42"+             , "MYR42"+             , "ringgit 42"+             , "42 ringgit"+             , "42 malaysia ringgit"+             , "malaysia ringgit 42"+             , "42 malaysian ringgit"+             , "malaysian ringgit 42"+             , "42 malaysia ringgits"+             , "malaysia ringgits 42"+             , "42 malaysian ringgits"+             , "malaysian ringgits 42"+             ]+  , examples (simple MYR 20.43)+             [ "20 ringgit and 43c"+             , "20 ringgit and 43 sen"+             , "twenty ringgit 43 sens"+             , "20 ringgit 43"+             , "twenty ringgit and 43"+             ]+  , examples (between Dollar (10, 20))+             [ "between 10 and 20 dollars"+             , "from 10 dollars to 20 dollars"+             , "around 10-20 dollars"+             , "between 10 dollars and 20 dollars"+             , "from 10 to 20 dollars"+             , "about $10-$20"+             , "10-20 dollars"+             ]+  , examples (under EUR 7)+             [ "under seven euros"+             , "less than 7 EUR"+             , "lower than 7€"+             ]+  , examples (above Dollar 1.42)+             [ "more than 1 dollar and forty-two cents"+             , "at least $1.42"+             , "over 1.42 dollars"+             , "above a dollar and 42 cents"              ]   ]
Duckling/AmountOfMoney/EN/Rules.hs view
@@ -85,11 +85,20 @@   , prod = \_ -> Just . Token AmountOfMoney $ currencyOnly AED   } +ruleRinggit :: Rule+ruleRinggit = Rule+  { name = "ringgit"+  , pattern =+    [ regex "(malaysian? )?ringgits?"+    ]+  , prod = \_ -> Just . Token AmountOfMoney $ currencyOnly MYR+  }+ ruleCent :: Rule ruleCent = Rule   { name = "cent"   , pattern =-    [ regex "cents?|penn(y|ies)"+    [ regex "cents?|penn(y|ies)|pence|sens?"     ]   , prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Cent   }@@ -103,6 +112,18 @@   , prod = \_ -> Just . Token AmountOfMoney $ currencyOnly Unnamed   } +ruleACurrency :: Rule+ruleACurrency = Rule+  { name = "a <currency>"+  , pattern =+    [ regex "an?"+    , financeWith TAmountOfMoney.value isNothing+    ]+  , prod = \tokens -> case tokens of+      (_:Token AmountOfMoney fd:_) -> Just . Token AmountOfMoney $ fd {TAmountOfMoney.value = Just 1}+      _ -> Nothing+  }+ ruleIntersectAndXCents :: Rule ruleIntersectAndXCents = Rule   { name = "intersect (and X cents)"@@ -154,7 +175,9 @@   { name = "intersect (X cents)"   , pattern =     [ financeWith TAmountOfMoney.value isJust-    , financeWith TAmountOfMoney.currency (== Cent)+    , financeWith id $ \x -> case TAmountOfMoney.value x of+        Just v | v > 0 -> TAmountOfMoney.currency x == Cent+        _              -> False     ]   , prod = \tokens -> case tokens of       (Token AmountOfMoney fd:@@ -168,16 +191,117 @@   { name = "about|exactly <amount-of-money>"   , pattern =     [ regex "exactly|precisely|about|approx(\\.|imately)?|close to|near( to)?|around|almost"-    , financeWith TAmountOfMoney.value isJust+    , dimension AmountOfMoney     ]   , prod = \tokens -> case tokens of       (_:token:_) -> Just token       _ -> Nothing   } +ruleIntervalBetweenNumeral :: Rule+ruleIntervalBetweenNumeral = Rule+  { name = "between|from <numeral> to|and <amount-of-money>"+  , pattern =+    [ regex "between|from"+    , dimension Numeral+    , regex "to|and"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (_:+       Token Numeral (NumeralData {TNumeral.value = from}):+       _:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):+       _) ->+        Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c+      _ -> Nothing+  }++ruleIntervalBetween :: Rule+ruleIntervalBetween = Rule+  { name = "between|from <amount-of-money> to|and <amount-of-money>"+  , pattern =+    [ regex "between|from"+    , financeWith TAmountOfMoney.value isJust+    , regex "to|and"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (_:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):+       _:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):+       _) | c1 == c2 ->+        Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1+      _ -> Nothing+  }++ruleIntervalNumeralDash :: Rule+ruleIntervalNumeralDash = Rule+  { name = "<numeral> - <amount-of-money>"+  , pattern =+    [ dimension Numeral+    , regex "-"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (Token Numeral (NumeralData {TNumeral.value = from}):+       _:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):+       _) ->+         Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c+      _ -> Nothing+  }++ruleIntervalDash :: Rule+ruleIntervalDash = Rule+  { name = "<amount-of-money> - <amount-of-money>"+  , pattern =+    [ financeWith TAmountOfMoney.value isJust+    , regex "-"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just from, TAmountOfMoney.currency = c1}):+       _:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c2}):+       _) | c1 == c2 ->+        Just . Token AmountOfMoney . withInterval (from, to) $ currencyOnly c1+      _ -> Nothing+  }++ruleIntervalMax :: Rule+ruleIntervalMax = Rule+  { name = "under/less/lower/no more than <amount-of-money>"+  , pattern =+    [ regex "under|(less|lower|not? more) than"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (_:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):+       _) -> Just . Token AmountOfMoney . withMax to $ currencyOnly c+      _ -> Nothing+  }++ruleIntervalMin :: Rule+ruleIntervalMin = Rule+  { name = "over/above/at least/more than <amount-of-money>"+  , pattern =+    [ regex "over|above|at least|more than"+    , financeWith TAmountOfMoney.value isJust+    ]+  , prod = \tokens -> case tokens of+      (_:+       Token AmountOfMoney (AmountOfMoneyData {TAmountOfMoney.value = Just to, TAmountOfMoney.currency = c}):+       _) -> Just . Token AmountOfMoney . withMin to $ currencyOnly c+      _ -> Nothing+  }+ rules :: [Rule] rules =-  [ ruleBucks+  [ ruleACurrency+  , ruleBucks   , ruleCent   , ruleDinars   , ruleDirham@@ -185,8 +309,15 @@   , ruleIntersectAndNumeral   , ruleIntersectAndXCents   , ruleIntersectXCents+  , ruleIntervalBetweenNumeral+  , ruleIntervalBetween+  , ruleIntervalMax+  , ruleIntervalMin+  , ruleIntervalNumeralDash+  , ruleIntervalDash   , ruleOtherPounds   , rulePounds   , rulePrecision+  , ruleRinggit   , ruleRiyals   ]
Duckling/AmountOfMoney/ES/Corpus.hs view
@@ -24,42 +24,42 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "diez dollars"              , "diez dólares"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "nueve pounds"              , "9 libras"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              , "3 gbp 1 centavo"              , "3 gbp y 1 centavo"              ]-  , examples (AmountOfMoneyValue PTS 15)+  , examples (simple PTS 15)              [ "15 Pt"              , "15pta"              , "15Ptas"
Duckling/AmountOfMoney/FR/Corpus.hs view
@@ -24,41 +24,41 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "dix dollars"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              , "1 USD et 23 centimes"              , "1 USD 23 cents"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue Unnamed 3)+  , examples (simple Unnamed 3)              [ "3 balles"              , "à peu près 3 pouloutes"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "exactement £9"              , "neuf pounds"              , "quasi neuf livres"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]
Duckling/AmountOfMoney/GA/Corpus.hs view
@@ -24,62 +24,62 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "deich dollair"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "deich ceinteanna"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10,000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue EUR 10000)+  , examples (simple EUR 10000)              [ "€10,000"              , "10K€"              , "€10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1.23"              ]-  , examples (AmountOfMoneyValue Dollar 2.23)+  , examples (simple Dollar 2.23)              [ "2 dhollair agus 23 ceinteanna"              , "dhá dhollair 23 ceinteanna"              , "2 dhollair 23"              , "dhá dhollair agus 23"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29.99"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rúpaí"              , "20Rs"              , "Rs20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupees 43"              , "fiche rúpaí 43"              ]-  , examples (AmountOfMoneyValue INR 33)+  , examples (simple INR 33)              [ "INR33"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "naoi bpunt"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3.01"              , "GBP 3.01"              ]
Duckling/AmountOfMoney/HR/Corpus.hs view
@@ -23,73 +23,73 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "deset dolara"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "deset centa"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue Dollar 2.23)+  , examples (simple Dollar 2.23)              [ "2 dolara i 23 centa"              , "dva dolara 23 centa"              , "2 dolara 23"              , "dva dolara i 23"              ]-  , examples (AmountOfMoneyValue HRK 2.23)+  , examples (simple HRK 2.23)              [ "2 kune i 23 lipe"              , "dvije kune 23 lipe"              , "2 kune 23"              , "dvije kune i 23"              ]-  , examples (AmountOfMoneyValue HRK 100)+  , examples (simple HRK 100)              [ "100 kuna"              , "sto kuna"              ]-  , examples (AmountOfMoneyValue HRK 200)+  , examples (simple HRK 200)              [ "200 kuna"              , "dvije stotine kuna"              , "dvjesto kuna"              , "dvjesta kuna"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rupija"              , "20Rs"              , "Rs20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupija 43"              , "dvadeset rupija 43"              ]-  , examples (AmountOfMoneyValue INR 33)+  , examples (simple INR 33)              [ "INR33"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "devet funti"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]
Duckling/AmountOfMoney/Helpers.hs view
@@ -13,14 +13,17 @@   ( currencyOnly   , financeWith   , withCents+  , withInterval+  , withMax+  , withMin   , withValue   )   where  import Prelude -import Duckling.Dimensions.Types import Duckling.AmountOfMoney.Types (Currency (..), AmountOfMoneyData (..))+import Duckling.Dimensions.Types import Duckling.Types hiding (Entity(..))  -- -----------------------------------------------------------------@@ -36,7 +39,8 @@ -- Production  currencyOnly :: Currency -> AmountOfMoneyData-currencyOnly c = AmountOfMoneyData {currency = c, value = Nothing}+currencyOnly c = AmountOfMoneyData+  {currency = c, value = Nothing, minValue = Nothing, maxValue = Nothing}  withValue :: Double -> AmountOfMoneyData -> AmountOfMoneyData withValue x fd = fd {value = Just x}@@ -45,4 +49,13 @@ withCents x fd@AmountOfMoneyData {value = Just value} = fd   {value = Just $ value + x / 100} withCents x AmountOfMoneyData {value = Nothing} = AmountOfMoneyData-  {value = Just x, currency = Cent}+  {value = Just x, currency = Cent, minValue = Nothing, maxValue = Nothing}++withInterval :: (Double, Double) -> AmountOfMoneyData -> AmountOfMoneyData+withInterval (from, to) fd = fd {minValue = Just from, maxValue = Just to}++withMin :: Double -> AmountOfMoneyData -> AmountOfMoneyData+withMin x fd = fd {minValue = Just x}++withMax :: Double -> AmountOfMoneyData -> AmountOfMoneyData+withMax x fd = fd {maxValue = Just x}
Duckling/AmountOfMoney/ID/Corpus.hs view
@@ -24,24 +24,24 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "sepuluh dolar"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue Dollar 2)+  , examples (simple Dollar 2)              [ "2 dola"              , "dua dolar"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"@@ -49,32 +49,32 @@              , "EUR 20"              , "dua puluh Euro"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue IDR 315)+  , examples (simple IDR 315)              [ "Rp. 315,00"              ]-  , examples (AmountOfMoneyValue IDR 20)+  , examples (simple IDR 20)              [ "Rp 20"              , "20 Rupiah"              , "20Rp"              , "Rp20"              ]-  , examples (AmountOfMoneyValue IDR 33000)+  , examples (simple IDR 33000)              [ "IDR33000"              , "IDR 33.000"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "sembilan pound"              , "sembilan pound sterling"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]-  , examples (AmountOfMoneyValue JPY 10)+  , examples (simple JPY 10)              [ "10 yen"              , "10¥"              , "10 ¥."
Duckling/AmountOfMoney/KO/Corpus.hs view
@@ -24,53 +24,53 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "십달러"              , "십불"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "십센트"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "만달러"              , "만불"              ]-  , examples (AmountOfMoneyValue Dollar 1.23)+  , examples (simple Dollar 1.23)              [ "일점이삼달러"              , "일쩜이삼달러"              , "일점이삼불"              , "일쩜이삼불"              ]-  , examples (AmountOfMoneyValue Dollar 2.23)+  , examples (simple Dollar 2.23)              [ "이달러이십삼센트"              , "이불이십삼센트"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "이십유로"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "이십구점구구유로"              , "EUR29.99"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "구파운드"              ]-  , examples (AmountOfMoneyValue KRW 27350000)+  , examples (simple KRW 27350000)              [ "이천칠백삼십오만원"              , "27,350,000원"              , "27350000원"              ]-  , examples (AmountOfMoneyValue KRW 27000)+  , examples (simple KRW 27000)              [ "이만칠천원"              , "27,000원"              , "27000원"              ]-  , examples (AmountOfMoneyValue KRW 100)+  , examples (simple KRW 100)              [ "백원"              , "100원"              ]-  , examples (AmountOfMoneyValue KRW 10)+  , examples (simple KRW 10)              [ "십원"              , "10원"              , "10₩"
Duckling/AmountOfMoney/NB/Corpus.hs view
@@ -24,45 +24,45 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "ti dollar"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "ti øre"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue NOK 10)+  , examples (simple NOK 10)              [ "10kroner"              , "10kr"              , "ti kroner"              , "10 NOK"              ]-  , examples (AmountOfMoneyValue NOK 2.23)+  , examples (simple NOK 2.23)              [ "2 kroner og 23 øre"              , "to kroner 23 øre"              , "to kroner og 23 øre"              , "to kr 23"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euro"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rupees"@@ -70,16 +70,16 @@              , "Rs20"              , "INR20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupees 43"              , "tjue rupees 43"              , "tjue rupees 43¢"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "ni pund"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]
Duckling/AmountOfMoney/PT/Corpus.hs view
@@ -24,49 +24,49 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "dez dolares"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "nove libras"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]-  , examples (AmountOfMoneyValue PTS 15)+  , examples (simple PTS 15)              [ "15 Pt"              , "15pta"              , "15Ptas"              ]-  , examples (AmountOfMoneyValue BRL 15)+  , examples (simple BRL 15)              [ "15 reais"              , "15reais"              , "15 Reais"              , "BRL 15"              ]-  , examples (AmountOfMoneyValue BRL 2.0)+  , examples (simple BRL 2.0)              [ "R$2,00"              , "R$ 2,00"              , "2,00 reais"
Duckling/AmountOfMoney/RO/Corpus.hs view
@@ -24,49 +24,49 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue RON 10)+  [ examples (simple RON 10)              [ "10 lei"              , "10 roni"              , "10 RON"              ]-  , examples (AmountOfMoneyValue Cent 50)+  , examples (simple Cent 50)              [ "50 bani"              , "50 BANI"              ]-  , examples (AmountOfMoneyValue RON 10.5)+  , examples (simple RON 10.5)              [ "10,5 lei"              , "10,5 ron"              , "10 lei si 50 bani"              ]-  , examples (AmountOfMoneyValue Dollar 10)+  , examples (simple Dollar 10)              [ "$10"              , "10$"              , "zece dolari"              , "10 dolari"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "zece centi"              , "zece cenți"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "$10000"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue Dollar 1)+  , examples (simple Dollar 1)              [ "1 dolar"              , "un dolar"              , "$1"              ]-  , examples (AmountOfMoneyValue Cent 2)+  , examples (simple Cent 2)              [ "2 centi"              ]-  , examples (AmountOfMoneyValue Cent 23)+  , examples (simple Cent 23)              [ "23 centi"              ]-  , examples (AmountOfMoneyValue Dollar 2.23)+  , examples (simple Dollar 2.23)              [ "2 dolari si 23 centi"              , "2 dolari și 23 cenți"              , "doi dolari si douăzeci si trei centi"@@ -75,45 +75,45 @@              , "doi dolari si 23"              , "doi dolari și 23"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euro"              , "20 Euro"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "noua lir"              , "nouă lire"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]-  , examples (AmountOfMoneyValue QAR 1)+  , examples (simple QAR 1)              [ "un rial qatarian"              , "1 rial qataria"              ]-  , examples (AmountOfMoneyValue EGP 10)+  , examples (simple EGP 10)              [ "zece lira egiptiana"              ]-  , examples (AmountOfMoneyValue LBP 1)+  , examples (simple LBP 1)              [ "una liră libaneză"              ]-  , examples (AmountOfMoneyValue INR 42)+  , examples (simple INR 42)              [ "42 rupii"              , "Rs. 42"              ]-  , examples (AmountOfMoneyValue KWD 1)+  , examples (simple KWD 1)              [ "un dinar kuweitian"              ]-  , examples (AmountOfMoneyValue AED 2)+  , examples (simple AED 2)              [ "2 dirhami"              ]-  , examples (AmountOfMoneyValue SAR 1)+  , examples (simple SAR 1)              [ "1 rial saudit"              , "un rial saudi"              ]
Duckling/AmountOfMoney/Rules.hs view
@@ -14,21 +14,21 @@   ) where  import Data.HashMap.Strict (HashMap)-import qualified Data.HashMap.Strict as HashMap import Data.Maybe import Data.String import Data.Text (Text)-import qualified Data.Text as Text import Prelude+import qualified Data.HashMap.Strict as HashMap+import qualified Data.Text as Text  import Duckling.AmountOfMoney.Helpers import Duckling.AmountOfMoney.Types (Currency(..), AmountOfMoneyData (..))-import qualified Duckling.AmountOfMoney.Types as TAmountOfMoney import Duckling.Dimensions.Types import Duckling.Numeral.Types (NumeralData (..))-import qualified Duckling.Numeral.Types     as TNumeral import Duckling.Regex.Types import Duckling.Types+import qualified Duckling.AmountOfMoney.Types as TAmountOfMoney+import qualified Duckling.Numeral.Types as TNumeral  currencies :: HashMap Text Currency currencies = HashMap.fromList@@ -64,6 +64,8 @@   , ("krw", KRW)   , ("kwd", KWD)   , ("lbp", LBP)+  , ("myr", MYR)+  , ("rm", MYR)   , ("nok", NOK)   , ("\x00a3", Pound)   , ("pt", PTS)@@ -84,7 +86,7 @@ ruleCurrencies = Rule   { name = "currencies"   , pattern =-    [ regex "(aed|aud|brl|\x00a2|c|\\$|dollars?|egp|(e|\x20ac)uro?s?|\x20ac|gbp|hrk|idr|inr|\x00a5|jpy|krw|kwd|lbp|nok|\x00a3|pta?s?|qar|rs\\.?|ron|rupees?|sar|sek|sgb|us(d|\\$)|vnd|yen)"+    [ regex "(aed|aud|brl|\x00a2|c|\\$|dollars?|egp|(e|\x20ac)uro?s?|\x20ac|gbp|hrk|idr|inr|\x00a5|jpy|krw|kwd|lbp|myr|rm|nok|\x00a3|pta?s?|qar|rs\\.?|ron|rupees?|sar|sek|sgb|us(d|\\$)|vnd|yen)"     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) -> do
Duckling/AmountOfMoney/SV/Corpus.hs view
@@ -24,67 +24,67 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "tio dollar"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "tio öre"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10.000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1,23"              ]-  , examples (AmountOfMoneyValue SEK 10)+  , examples (simple SEK 10)              [ "10kronor"              , "10kr"              , "10 kr"              , "tio kronor"              , "10 SEK"              ]-  , examples (AmountOfMoneyValue SEK 2.23)+  , examples (simple SEK 2.23)              [ "2 kronor och 23 öre"              , "två kronor 23 öre"              , "två kronor och 23 öre"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euro"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29,99"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rupees"              , "20Rs"              , "Rs20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupees 43"              , "tjugo rupees 43"              ]-  , examples (AmountOfMoneyValue INR 33)+  , examples (simple INR 33)              [ "INR33"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "nio pund"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3,01"              , "GBP 3,01"              ]-  , examples (AmountOfMoneyValue NOK 10)+  , examples (simple NOK 10)              [ "10 norska kronor"              , "10 nkr"              ]
Duckling/AmountOfMoney/Types.hs view
@@ -21,6 +21,7 @@ import Data.Text (Text) import GHC.Generics import Prelude+import qualified Data.HashMap.Strict as H  import Duckling.Resolve (Resolve(..)) @@ -44,6 +45,7 @@   | KRW   | KWD   | LBP+  | MYR   | NOK   | PTS   | QAR@@ -73,6 +75,7 @@   toJSON KRW     = "KRW"   toJSON KWD     = "KWD"   toJSON LBP     = "LBP"+  toJSON MYR     = "MYR"   toJSON NOK     = "NOK"   toJSON PTS     = "PTS"   toJSON QAR     = "QAR"@@ -86,24 +89,79 @@ data AmountOfMoneyData = AmountOfMoneyData   { value    :: Maybe Double   , currency :: Currency+  , minValue :: Maybe Double+  , maxValue :: Maybe Double   }   deriving (Eq, Generic, Hashable, Show, Ord, NFData) -data AmountOfMoneyValue = AmountOfMoneyValue+instance Resolve AmountOfMoneyData where+  type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue+  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} =+    Just $ between c (from, to)+  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} =+    Just $ under c v++data IntervalDirection = Above | Under+  deriving (Eq, Generic, Hashable, Ord, Show, NFData)++data SingleValue = SingleValue   { vCurrency :: Currency   , vValue    :: Double   }   deriving (Eq, Show) -instance Resolve AmountOfMoneyData where-  type ResolvedValue AmountOfMoneyData = AmountOfMoneyValue-  resolve _ AmountOfMoneyData {value = Nothing} = Nothing-  resolve _ AmountOfMoneyData {value = Just value, currency} =-    Just AmountOfMoneyValue {vValue = value, vCurrency = currency}+instance ToJSON SingleValue where+  toJSON SingleValue {vCurrency, vValue} = object+    [ "value" .= vValue+    , "unit"  .= vCurrency+    ] +data AmountOfMoneyValue+  = SimpleValue SingleValue+  | IntervalValue (SingleValue, SingleValue)+  | OpenIntervalValue (SingleValue, IntervalDirection)+  deriving (Show, Eq)+ instance ToJSON AmountOfMoneyValue where-  toJSON AmountOfMoneyValue {vCurrency, vValue} = object-    [ "type"  .= ("value" :: Text)-    , "value" .= vValue-    , "unit"  .= vCurrency+  toJSON (SimpleValue value) = case toJSON value of+    Object o -> Object $ H.insert "type" (toJSON ("value" :: Text)) o+    _ -> Object H.empty+  toJSON (IntervalValue (from, to)) = object+    [ "type" .= ("interval" :: Text)+    , "from" .= toJSON from+    , "to" .= toJSON to     ]+  toJSON (OpenIntervalValue (from, Above)) = object+    [ "type" .= ("interval" :: Text)+    , "from" .= toJSON from+    ]+  toJSON (OpenIntervalValue (to, Under)) = object+    [ "type" .= ("interval" :: Text)+    , "to" .= toJSON to+    ]++-- -----------------------------------------------------------------+-- Value helpers++simple :: Currency -> Double -> AmountOfMoneyValue+simple c v = SimpleValue $ single c v++between :: Currency -> (Double, Double) -> AmountOfMoneyValue+between c (from, to) = IntervalValue (single c from, single c to)++above :: Currency -> Double -> AmountOfMoneyValue+above = openInterval Above++under :: Currency -> Double -> AmountOfMoneyValue+under = openInterval Under++openInterval :: IntervalDirection -> Currency -> Double -> AmountOfMoneyValue+openInterval direction c v = OpenIntervalValue (single c v, direction)++single :: Currency -> Double -> SingleValue+single c v = SingleValue {vCurrency = c, vValue = v}
Duckling/AmountOfMoney/VI/Corpus.hs view
@@ -24,26 +24,26 @@  allExamples :: [Example] allExamples = concat-  [ examples (AmountOfMoneyValue Dollar 10)+  [ examples (simple Dollar 10)              [ "$10"              , "10$"              , "mười đô"              , "mười đô la"              , "mười đô mỹ"              ]-  , examples (AmountOfMoneyValue Cent 10)+  , examples (simple Cent 10)              [ "mười xen"              , "mười xu"              ]-  , examples (AmountOfMoneyValue Dollar 10000)+  , examples (simple Dollar 10000)              [ "$10,000"              , "10K$"              , "$10k"              ]-  , examples (AmountOfMoneyValue USD 1.23)+  , examples (simple USD 1.23)              [ "USD1.23"              ]-  , examples (AmountOfMoneyValue Dollar 2.23)+  , examples (simple Dollar 2.23)              [ "2 đô la và 23 xen"              , "hai đô la và 23 xen"              , "2 đô 23 xu"@@ -51,52 +51,52 @@              , "2 chấm 23 đô la"              , "hai phẩy 23 đô"              ]-  , examples (AmountOfMoneyValue VND 10)+  , examples (simple VND 10)              [ "mười đồng"              ]-  , examples (AmountOfMoneyValue VND 10000)+  , examples (simple VND 10000)              [ "10,000 đồng"              , "10K đồng"              , "10k đồng"              ]-  , examples (AmountOfMoneyValue VND 1000)+  , examples (simple VND 1000)              [ "1000 VNĐ"              , "VN$1000"              ]-  , examples (AmountOfMoneyValue EUR 20)+  , examples (simple EUR 20)              [ "20€"              , "20 euros"              , "20 Euro"              , "20 Euros"              , "EUR 20"              ]-  , examples (AmountOfMoneyValue EUR 29.99)+  , examples (simple EUR 29.99)              [ "EUR29.99"              ]-  , examples (AmountOfMoneyValue INR 20)+  , examples (simple INR 20)              [ "Rs. 20"              , "Rs 20"              , "20 Rupees"              , "20Rs"              , "Rs20"              ]-  , examples (AmountOfMoneyValue INR 20.43)+  , examples (simple INR 20.43)              [ "20 Rupees 43"              , "hai mươi rupees 43"              , "hai mươi rupees 43 xen"              ]-  , examples (AmountOfMoneyValue INR 33)+  , examples (simple INR 33)              [ "INR33"              ]-  , examples (AmountOfMoneyValue Pound 9)+  , examples (simple Pound 9)              [ "£9"              , "chín pounds"              ]-  , examples (AmountOfMoneyValue GBP 3.01)+  , examples (simple GBP 3.01)              [ "GBP3.01"              , "GBP 3.01"              ]-  , examples (AmountOfMoneyValue AED 1)+  , examples (simple AED 1)              [ "1 AED."              , "1 dirham"              ]
Duckling/Api.hs view
@@ -55,8 +55,7 @@  -- | Converts the resolved token to the API format formatToken :: Text -> ResolvedToken -> Entity-formatToken sentence (Resolved (Range start end) (Node{token=Token dimension _}) jsonValue) =-  Entity (toName dimension) body val start end+formatToken sentence (Resolved (Range start end) (Node{token=Token dimension _}) value) =+  Entity (toName dimension) body value start end   where     body = Text.drop start $ Text.take end sentence-    val = toJText jsonValue
Duckling/Core.hs view
@@ -25,16 +25,17 @@    -- Reference time builders   , currentReftime+  , fromZonedTime   , makeReftime   ) where  import Data.HashMap.Strict (HashMap)-import qualified Data.HashMap.Strict as HashMap import Data.Maybe import Data.Text (Text) import Data.Time import Data.Time.LocalTime.TimeZone.Series import Prelude+import qualified Data.HashMap.Strict as HashMap  import Duckling.Api import Duckling.Dimensions.Types@@ -56,3 +57,8 @@ currentReftime series tz = do   utcNow <- getCurrentTime   return $ makeReftime series tz utcNow++-- | Builds a `DucklingTime` from a `ZonedTime`.+fromZonedTime :: ZonedTime -> DucklingTime+fromZonedTime (ZonedTime localTime timeZone) = DucklingTime $+  ZoneSeriesTime (toUTC localTime) (TimeZoneSeries timeZone [])
Duckling/Dimensions.hs view
@@ -21,6 +21,7 @@ import Duckling.Dimensions.Types import qualified Duckling.Dimensions.Common as CommonDimensions import qualified Duckling.Dimensions.AR as ARDimensions+import qualified Duckling.Dimensions.CS as CSDimensions import qualified Duckling.Dimensions.DA as DADimensions import qualified Duckling.Dimensions.DE as DEDimensions import qualified Duckling.Dimensions.EN as ENDimensions@@ -77,6 +78,7 @@  langDimensions :: Lang -> [Some Dimension] langDimensions AR = ARDimensions.allDimensions+langDimensions CS = CSDimensions.allDimensions langDimensions DA = DADimensions.allDimensions langDimensions DE = DEDimensions.allDimensions langDimensions EN = ENDimensions.allDimensions
+ Duckling/Dimensions/CS.hs view
@@ -0,0 +1,19 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Dimensions.CS+  ( allDimensions+  ) where++import Duckling.Dimensions.Types++allDimensions :: [Some Dimension]+allDimensions =+  [ This Distance+  , This Numeral+  ]
Duckling/Dimensions/TR.hs view
@@ -14,6 +14,10 @@  allDimensions :: [Some Dimension] allDimensions =-  [ This Numeral+  [ This Distance+  , This Duration+  , This Numeral   , This Ordinal+  , This Temperature+  , This Volume   ]
+ Duckling/Distance/CS/Corpus.hs view
@@ -0,0 +1,60 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Distance.CS.Corpus+  ( corpus ) where++import Data.String+import Prelude++import Duckling.Distance.Types+import Duckling.Lang+import Duckling.Resolve+import Duckling.Testing.Types++corpus :: Corpus+corpus = (testContext {lang = CS}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (DistanceValue Kilometre 3)+             [ "3 kilometry"+             , "3 km"+             , "3km"+             ]+  , examples (DistanceValue Mile 8)+             [ "8 mil"+             , "osm mil"+             ]+  , examples (DistanceValue Metre 1)+             [ "1m"+             , "1 metr"+             ]+  , examples (DistanceValue Metre 2)+             [ "2m"+             , "2 metry"+             ]+  , examples (DistanceValue Metre 9)+             [ "9m"+             , "9 metrů"+             ]+  , examples (DistanceValue Centimetre 1)+             [ "1cm"+             , "1 centimetr"+             ]+  , examples (DistanceValue Centimetre 2)+             [ "2cm"+             , "2 centimetry"+             ]+  , examples (DistanceValue Centimetre 9)+             [ "9cm"+             , "9 centimetrů"+             ]+  ]
+ Duckling/Distance/CS/Rules.hs view
@@ -0,0 +1,81 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Distance.CS.Rules+  ( rules ) where++import Data.String+import Prelude++import Duckling.Dimensions.Types+import Duckling.Distance.Helpers+import Duckling.Types+import qualified Duckling.Distance.Types as TDistance++ruleLatentDistKm :: Rule+ruleLatentDistKm = Rule+  { name = "<latent dist> km"+  , pattern =+    [ dimension Distance+    , regex "km|kilometr(y|\x016f)?"+    ]+  , prod = \tokens -> case tokens of+      (Token Distance dd:_) ->+        Just . Token Distance $ withUnit TDistance.Kilometre dd+      _ -> Nothing+  }++ruleDistMeters :: Rule+ruleDistMeters = Rule+  { name = "<dist> meters"+  , pattern =+    [ dimension Distance+    , regex "metr(y|\x016f)?|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 "cm|centimetr(y|\x016f)?"+    ]+  , 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"+    ]+  , prod = \tokens -> case tokens of+      (Token Distance dd:_) ->+        Just . Token Distance $ withUnit TDistance.Mile dd+      _ -> Nothing+  }++rules :: [Rule]+rules =+  [ ruleDistCentimeters+  , ruleDistMeters+  , ruleDistMiles+  , ruleLatentDistKm+  ]
Duckling/Distance/EN/Corpus.hs view
@@ -32,6 +32,7 @@   , examples (DistanceValue Mile 8)              [ "8 miles"              , "eight mile"+             , "8 mi"              ]   , examples (DistanceValue M 9)              [ "9m"@@ -39,5 +40,11 @@   , examples (DistanceValue Centimetre 2)              [ "2cm"              , "2 centimeters"+             ]+  , examples (DistanceValue Inch 5)+             [ "5 in"+             , "5''"+             , "five inches"+             , "5\""              ]   ]
Duckling/Distance/EN/Rules.hs view
@@ -58,11 +58,11 @@ distances :: [(Text, String, TDistance.Unit)] distances = [ ("<latent dist> km", "k(ilo)?m?(eter)?s?", TDistance.Kilometre)             , ("<latent dist> feet", "('|f(oo|ee)?ts?)", TDistance.Foot)-            , ("<latent dist> inch", "(''|inch(es)?)", TDistance.Inch)+            , ("<latent dist> inch", "(\"|''|in(ch(es)?)?)", TDistance.Inch)             , ("<latent dist> yard", "y(ar)?ds?", TDistance.Yard)             , ("<dist> meters", "meters?", TDistance.Metre)             , ("<dist> centimeters", "cm|centimeters?", TDistance.Centimetre)-            , ("<dist> miles", "miles?", TDistance.Mile)+            , ("<dist> miles", "mi(le(s)?)?", TDistance.Mile)             , ("<dist> m (ambiguous miles or meters)", "m", TDistance.M)             ] 
+ Duckling/Distance/TR/Corpus.hs view
@@ -0,0 +1,52 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Distance.TR.Corpus+  ( corpus ) where++import Data.String+import Prelude++import Duckling.Distance.Types+import Duckling.Lang+import Duckling.Resolve+import Duckling.Testing.Types++corpus :: Corpus+corpus = (testContext {lang = TR}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (DistanceValue Kilometre 3)+             [ "3 Kilometre"+             , "3 kilometre"+             , "3 km"+             , "3km"+             ]+  , examples (DistanceValue Kilometre 3.0)+             [ "3,0 km"+             ]+  , examples (DistanceValue Mile 8)+             [ "8 Mil"+             , "8 mil"+             ]+  , examples (DistanceValue Metre 9)+             [ "9 Metre"+             , "9 metre"+             , "9 m"+             , "9m"+             ]+  , examples (DistanceValue Centimetre 2)+             [ "2 Santimetre"+             , "2 santim"+             , "2 cm"+             , "2cm"+             ]+  ]
+ Duckling/Distance/TR/Rules.hs view
@@ -0,0 +1,81 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Distance.TR.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 "k(ilo)?m?(etre)?"+    ]+  , prod = \tokens -> case tokens of+      (Token Distance dd:_) ->+        Just . Token Distance $ withUnit TDistance.Kilometre dd+      _ -> Nothing+  }++ruleDistMeters :: Rule+ruleDistMeters = Rule+  { name = "<dist> meters"+  , pattern =+    [ dimension Distance+    , regex "m(etre)?"+    ]+  , 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 "cm|santim(etre)?"+    ]+  , 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"+    ]+  , prod = \tokens -> case tokens of+      (Token Distance dd:_) ->+        Just . Token Distance $ withUnit TDistance.Mile dd+      _ -> Nothing+  }++rules :: [Rule]+rules =+  [ ruleDistCentimeters+  , ruleDistMeters+  , ruleDistMiles+  , ruleLatentDistKm+  ]
Duckling/Duration/DA/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData (..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -109,14 +109,11 @@     , regex "timer?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/DE/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData (..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -67,14 +67,11 @@     [ regex "(\\d+)\\.(\\d+) stunden?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/EN/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInt, parseInteger) import Duckling.Numeral.Types (NumeralData(..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -90,14 +90,11 @@   { name = "number.number hours"   , pattern = [regex "(\\d+)\\.(\\d+) *hours?"]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/HE/Rules.hs view
@@ -21,7 +21,7 @@ import Duckling.Dimensions.Types import Duckling.Duration.Helpers import Duckling.Duration.Types (DurationData (..))-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData(..)) import Duckling.Regex.Types import Duckling.Types@@ -64,14 +64,11 @@     , regex "\x05e9\x05e2\x05d4|\x05e9\x05e2\x05d5\x05ea"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/HR/Rules.hs view
@@ -21,7 +21,7 @@ import Duckling.Dimensions.Types import Duckling.Duration.Helpers import Duckling.Duration.Types (DurationData (..))-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData(..)) import Duckling.Regex.Types import Duckling.Types@@ -99,14 +99,11 @@     , regex "sat(i|a)?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/Helpers.hs view
@@ -14,6 +14,7 @@   , isGrain   , isNatural   , isNumeralWith+  , minutesFromHourMixedFraction   ) where  import Prelude@@ -48,3 +49,7 @@  duration :: TG.Grain -> Int -> DurationData duration grain n = DurationData {TDuration.grain = grain, TDuration.value = n}++minutesFromHourMixedFraction :: Integer -> Integer -> Integer -> DurationData+minutesFromHourMixedFraction h n d =+  duration TG.Minute $ fromIntegral $ 60 * h + quot (n * 60) d
Duckling/Duration/KO/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData (..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -53,14 +53,11 @@     , regex "\xc2dc\xac04"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (m1:m2:_)):_) -> do-        hh <- parseInt m1-        dec <- parseInt m2-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length m2 - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/NB/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData (..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -57,14 +57,11 @@     [ regex "(\\d+)\\,(\\d+) *timer?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration $ duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/PL/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData (..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -59,14 +59,11 @@     , regex "godzin(y)?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
Duckling/Duration/SV/Rules.hs view
@@ -19,7 +19,7 @@  import Duckling.Dimensions.Types import Duckling.Duration.Helpers-import Duckling.Numeral.Helpers (parseInt)+import Duckling.Numeral.Helpers (parseInteger) import Duckling.Numeral.Types (NumeralData(..)) import qualified Duckling.Numeral.Types as TNumeral import Duckling.Regex.Types@@ -58,14 +58,11 @@     , regex "timm(e|ar)?"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (h:d:_)):_) -> do-        hh <- parseInt h-        dec <- parseInt d-        let divisor = floor $ (fromIntegral (10 :: Integer) :: Float) **-                        fromIntegral (Text.length d - 1)-            numerator = fromIntegral $ 6 * dec-        Just . Token Duration . duration TG.Minute $-          60 * hh + quot numerator divisor+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden       _ -> Nothing   } 
+ Duckling/Duration/TR/Corpus.hs view
@@ -0,0 +1,55 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Duration.TR.Corpus+  ( corpus+  ) where++import Data.String+import Prelude++import Duckling.Duration.Types+import Duckling.Lang+import Duckling.Resolve+import Duckling.Testing.Types+import Duckling.TimeGrain.Types (Grain (..))++corpus :: Corpus+corpus = (testContext {lang = TR}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (DurationData 1 Second)+             [ "bir sn"+             , "1 saniye"+             , "1\""+             ]+  , examples (DurationData 2 Minute)+             [ "2 dk"+             , "iki dakika"+             , "2'"+             ]+  , examples (DurationData 30 Day)+             [ "30 gün"+             ]+  , examples (DurationData 7 Week)+             [ "yedi hafta"+             ]+  , examples (DurationData 1 Month)+             [ "1 ay"+             , "bir ay"+             ]+  , examples (DurationData 3 Quarter)+             [ "3 çeyrek yıl"+             ]+  , examples (DurationData 2 Year)+             [ "2 yıl"+             ]+  ]
+ Duckling/Duration/TR/Rules.hs view
@@ -0,0 +1,124 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Duration.TR.Rules+  ( rules+  ) where++import Control.Monad (join)+import Data.String+import Prelude+import qualified Data.Text as Text++import Duckling.Dimensions.Types+import Duckling.Duration.Helpers+import Duckling.Numeral.Helpers (parseInteger)+import Duckling.Numeral.Types (NumeralData (..))+import Duckling.Regex.Types+import Duckling.Types+import qualified Duckling.Numeral.Types as TNumeral+import qualified Duckling.TimeGrain.Types as TG++ruleDurationQuarterOfAnHour :: Rule+ruleDurationQuarterOfAnHour = Rule+  { name = "quarter of an hour"+  , pattern = [ regex "(1/4\\s?sa(at)?|\x00e7eyrek saat)" ]+  , prod = \_ -> Just . Token Duration $ duration TG.Minute 15+  }++ruleDurationHalfAnHour :: Rule+ruleDurationHalfAnHour = Rule+  { name = "half an hour"+  , pattern = [regex "(1/2\\s?sa(at)?|yar\305m saat)"]+  , prod = \_ -> Just . Token Duration $ duration TG.Minute 30+  }++ruleDurationThreeQuartersOfAnHour :: Rule+ruleDurationThreeQuartersOfAnHour = Rule+  { name = "three-quarters of an hour"+  , pattern = [regex "(3/4\\s?sa(at)?|\x00fc\x00e7e \231eyrek sa(at)?)"]+  , prod = \_ -> Just . Token Duration $ duration TG.Minute 45+  }++ruleDurationFortnight :: Rule+ruleDurationFortnight = Rule+  { name = "fortnight"+  , pattern = [regex "iki hafta"]+  , prod = \_ -> Just . Token Duration $ duration TG.Day 14+  }++ruleNumeralQuotes :: Rule+ruleNumeralQuotes = Rule+  { name = "<integer> + '\""+  , pattern =+    [ Predicate isNatural+    , regex "(['\"])"+    ]+  , prod = \tokens -> case tokens of+      (Token Numeral (NumeralData {TNumeral.value = v}):+       Token RegexMatch (GroupMatch (x:_)):+       _) -> case x of+         "'"  -> Just . Token Duration . duration TG.Minute $ floor v+         "\"" -> Just . Token Duration . duration TG.Second $ floor v+         _    -> Nothing+      _ -> Nothing+  }++ruleDurationDotNumeralHours :: Rule+ruleDurationDotNumeralHours = Rule+  { name = "number.number hours"+  , pattern = [regex "(\\d+)(\\.|,)(\\d+) *sa(at)?"]+  , prod = \tokens -> case tokens of+      (Token RegexMatch (GroupMatch (h:m:_)):_) -> do+        hh <- parseInteger h+        mnum <- parseInteger m+        let mden = 10 ^ Text.length m+        Just . Token Duration $ minutesFromHourMixedFraction hh mnum mden+      _ -> Nothing+  }++ruleDurationAndHalfHour :: Rule+ruleDurationAndHalfHour = Rule+  { name = "<integer> and an half hour"+  , pattern =+    [ Predicate isNatural+    , regex "bu\x00e7euk sa(at)?"+    ]+  , prod = \tokens -> case tokens of+      (Token Numeral (NumeralData {TNumeral.value = v}):_) ->+        Just . Token Duration . duration TG.Minute $ 30 + 60 * floor v+      _ -> Nothing+  }+++ruleDurationPrecision :: Rule+ruleDurationPrecision = Rule+  { name = "<duration> about|exactly"+  , pattern =+    [ regex "(gibi|civar\305nda|yakla\x015f\305k|tam( olarak)?)"+    , dimension Duration+    ]+    , prod = \tokens -> case tokens of+        (_:token:_) -> Just token+        _           -> Nothing+  }++rules :: [Rule]+rules =+  [ ruleDurationQuarterOfAnHour+  , ruleDurationHalfAnHour+  , ruleDurationThreeQuartersOfAnHour+  , ruleDurationFortnight+  , ruleDurationDotNumeralHours+  , ruleDurationAndHalfHour+  , ruleDurationPrecision+  , ruleNumeralQuotes+  ]
Duckling/Duration/ZH/Corpus.hs view
@@ -27,10 +27,20 @@   [ examples (DurationData 1 Second)              [ "1 秒钟"              , "一 秒鐘"+             , "一 秒"              ]+  , examples (DurationData 1 Minute)+             [ "1 分鐘"+             , "一 分鐘"+             ]+  , examples (DurationData 1 Hour)+             [ "1 小時"+             , "一 小時"+             ]   , examples (DurationData 5 Day)              [ "5 天"              , "五 天"+             , "五 日"              ]   , examples (DurationData 10 Month)              [ "10 月"
Duckling/Lang.hs view
@@ -23,6 +23,7 @@  data Lang   = AR+  | CS   | DA   | DE   | EN
+ Duckling/Numeral/CS/Corpus.hs view
@@ -0,0 +1,47 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Numeral.CS.Corpus+  ( corpus ) where++import Data.String+import Prelude++import Duckling.Lang+import Duckling.Numeral.Types+import Duckling.Resolve+import Duckling.Testing.Types++corpus :: Corpus+corpus = (testContext {lang = CS}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (NumeralValue 0)+             [ "0"+             , "nula"+             ]+  , examples (NumeralValue 1)+             [ "1"+             , "jeden"+             , "jedna"+             , "jedno"+             ]+  , examples (NumeralValue 2)+             [ "dva"+             , "dvĕ"+             ]+  , examples (NumeralValue 3)+             [ "tři"+             ]+  , examples (NumeralValue 4)+             [ "čtyři"+             ]+  ]
+ Duckling/Numeral/CS/Rules.hs view
@@ -0,0 +1,78 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Numeral.CS.Rules+  ( rules ) where++import Data.HashMap.Strict (HashMap)+import Data.Maybe+import Data.String+import Data.Text (Text)+import Prelude+import qualified Data.HashMap.Strict as HashMap+import qualified Data.Text as Text++import Duckling.Dimensions.Types+import Duckling.Numeral.Helpers+import Duckling.Numeral.Types (NumeralData (..))+import Duckling.Regex.Types+import Duckling.Types+import qualified Duckling.Numeral.Types as TNumeral++ruleIntegerNumeric :: Rule+ruleIntegerNumeric = Rule+  { name = "integer (numeric)"+  , pattern =+    [ regex "(\\d{1,18})"+    ]+  , prod = \tokens -> case tokens of+      (Token RegexMatch (GroupMatch (match:_)):+       _) -> do+         v <- parseInt match+         integer $ toInteger v+      _ -> Nothing+  }++ruleNumeralMap :: HashMap Text Integer+ruleNumeralMap = HashMap.fromList+  [ ( "nula", 0 )+  , ( "jeden", 1 )+  , ( "jedna", 1 )+  , ( "jedno", 1 )+  , ( "dva", 2 )+  , ( "dv\x0115", 2 )+  , ( "t\x0159i", 3 )+  , ( "\x010dty\x0159i", 4 )+  , ( "p\x0115t", 5)+  , ( "\x0161est", 6)+  , ( "sedm", 7)+  , ( "osm", 8)+  , ( "dev\x0115t", 9)+  , ( "deset", 10)+  ]++ruleNumeral :: Rule+ruleNumeral = Rule+  { name = "number (0..10)"+  , pattern =+    [ regex "(nula|jed(en|n[ao])|dv(a|\x0115)|t(\x0159)i|(\x010d)ty(\x0159)i|p(\x0115)t|(\x0161)est|sedm|osm|dev(\x0115)t|deset)"+    ]+  , prod = \tokens -> case tokens of+      (Token RegexMatch (GroupMatch (match:_)):_) ->+        HashMap.lookup (Text.toLower match) ruleNumeralMap >>= integer+      _ -> Nothing+  }++rules :: [Rule]+rules =+  [ ruleIntegerNumeric+  , ruleNumeral+  ]
Duckling/Numeral/EN/Corpus.hs view
@@ -103,6 +103,12 @@              , "100k"              , "one hundred thousand"              ]+  , examples (NumeralValue 0.2)+             [ "1/5"+             , "2/10"+             , "3/15"+             , "20/100"+             ]   , examples (NumeralValue 3e6)              [ "3M"              , "3000K"
Duckling/Numeral/EN/Rules.hs view
@@ -8,6 +8,7 @@  {-# LANGUAGE GADTs #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE NoRebindableSyntax #-}  module Duckling.Numeral.EN.Rules   ( rules ) where@@ -197,6 +198,18 @@       _ -> Nothing   } +ruleFractions :: Rule+ruleFractions = Rule+  { name = "fractional number"+  , pattern = [regex "(\\d+)/(\\d+)"]+  , prod = \tokens -> case tokens of+      (Token RegexMatch (GroupMatch (numerator:denominator:_)):_) -> do+        n <- parseDecimal False numerator+        d <- parseDecimal False denominator+        divide n d+      _ -> Nothing+  }+ ruleCommas :: Rule ruleCommas = Rule   { name = "comma-separated numbers"@@ -293,6 +306,7 @@   , ruleDotSpelledOut   , ruleLeadingDotSpelledOut   , ruleDecimals+  , ruleFractions   , ruleCommas   , ruleSuffixes   , ruleNegative
Duckling/Numeral/Helpers.hs view
@@ -14,11 +14,13 @@   , double   , integer   , multiply+  , divide   , numberBetween   , numberWith   , oneOf   , parseDouble   , parseInt+  , parseInteger   , withGrain   , withMultipliable   , parseDecimal,@@ -44,7 +46,10 @@ comma = Text.singleton ','  parseInt :: Text -> Maybe Int-parseInt =+parseInt = (fromIntegral <$>) . parseInteger++parseInteger :: Text -> Maybe Integer+parseInteger =   either (const Nothing) Just . Atto.parseOnly (Atto.signed Atto.decimal)  -- | Add leading 0 when leading . for double parsing to succeed@@ -119,6 +124,14 @@   Just grain | v2 > v1 -> double (v1 * v2) >>= withGrain grain              | otherwise -> Nothing multiply _ _ = Nothing++divide :: Token -> Token -> Maybe Token+divide+  (Token Numeral (NumeralData {value = v1}))+  (Token Numeral (NumeralData {value = v2})) = case v1 / v2 of+    x | isInfinite x || isNaN x -> Nothing+    x -> double x+divide _ _ = Nothing  parseDecimal :: Bool -> Text -> Maybe Token parseDecimal isDot match
Duckling/Numeral/ID/Rules.hs view
@@ -12,8 +12,11 @@ module Duckling.Numeral.ID.Rules   ( rules ) where +import qualified Data.HashMap.Strict as HashMap+import Data.HashMap.Strict (HashMap) import Data.Maybe import qualified Data.Text as Text+import Data.Text (Text) import Prelude import Data.String @@ -24,6 +27,22 @@ import Duckling.Regex.Types import Duckling.Types +ruleIntegerMap :: HashMap Text Integer+ruleIntegerMap = HashMap.fromList+  [ ( "kosong"  , 0 )+  , ( "nol"     , 0 )+  , ( "satu"    , 1 )+  , ( "dua"     , 2 )+  , ( "tiga"    , 3 )+  , ( "empat"   , 4 )+  , ( "lima"    , 5 )+  , ( "enam"    , 6 )+  , ( "tujuh"   , 7 )+  , ( "delapan" , 8 )+  , ( "sembilan", 9 )+  , ( "sebelas" , 11 )+  ]+ ruleTeen :: Rule ruleTeen = Rule   { name = "teen"@@ -209,20 +228,8 @@     [ regex "(kosong|nol|satu|dua|tiga|empat|lima|enam|tujuh|delapan|sembilan|sebelas)"     ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of-        "kosong" -> integer 0-        "nol" -> integer 0-        "satu" -> integer 1-        "dua" -> integer 2-        "tiga" -> integer 3-        "empat" -> integer 4-        "lima" -> integer 5-        "enam" -> integer 6-        "tujuh" -> integer 7-        "delapan" -> integer 8-        "sembilan" -> integer 9-        "sebelas" -> integer 11-        _ -> Nothing+      (Token RegexMatch (GroupMatch (match:_)):_) ->+        HashMap.lookup (Text.toLower match) ruleIntegerMap >>= integer       _ -> Nothing   } 
Duckling/Numeral/TR/Corpus.hs view
@@ -68,18 +68,20 @@              , "on sekiz"              ]   , examples (NumeralValue 1.1)-             [ "1.1"-             , "1.10"-             , "01.10"+             [ "1,1"+             , "1,10"+             , "01,10"              , "bir virgül bir"              , "bir nokta bir"              ]   , examples (NumeralValue 0.77)-             [ "0.77"-             , ".77"+             [ "0,77"+             , ",77"+             , "sıfır virgül yetmişyedi"+             , "sıfır virgül yetmiş yedi"              ]   , examples (NumeralValue 100000)-             [ "100,000"+             [ "100.000"              , "100000"              , "100K"              , "100k"@@ -89,24 +91,24 @@              [ "3M"              , "3000K"              , "3000000"-             , "3,000,000"+             , "3.000.000"              ]   , examples (NumeralValue 1200000)-             [ "1,200,000"+             [ "1.200.000"              , "1200000"-             , "1.2M"+             , "1,2M"              , "1200K"-             , ".0012G"+             , ",0012G"              , "1200B"              ]   , examples (NumeralValue (-1200000))-             [ "- 1,200,000"+             [ "- 1.200.000"              , "-1200000"-             , "eksi 1,200,000"+             , "eksi 1.200.000"              , "negatif 1200000"-             , "-1.2M"+             , "-1,2M"              , "-1200K"-             , "-.0012G"+             , "-,0012G"              , "-1200B"              ]   , examples (NumeralValue 5000)@@ -149,32 +151,34 @@              [ "beş buçuk"              , "beşbuçuk"              , "5 buçuk"-             , "5.5"+             , "5,5"              ]   , examples (NumeralValue 3500000)-             [ "3.5 milyon"+             [ "3,5 milyon"              , "3500000"              , "üç buçuk milyon"              , "üçbuçuk milyon"-             , "3.5M"+             , "3,5M"              ]   , examples (NumeralValue 0.5)              [ "yarım"-             , "0.5"+             , "0,5"              ]   , examples (NumeralValue 2500)-             [ "2.5 bin"+             [ "2,5 bin"              , "2500"-             , "iki buçuk bin"-             , "ikibuçuk bin"+             , "iki bin beş yüz"+             , "ikibin beşyüz"              ]   , examples (NumeralValue 2200000)-             [ "2.2 milyon"+             [ "2,2 milyon"              , "iki nokta iki milyon"+             , "iki virgül iki milyon"              ]   , examples (NumeralValue 72.5)              [ "yetmişikibuçuk"              , "yetmişiki buçuk"-             , "72.5"+             , "yetmiş iki buçuk"+             , "72,5"              ]   ]
Duckling/Numeral/TR/Rules.hs view
@@ -110,11 +110,14 @@ ruleDecimalWithThousandsSeparator = Rule   { name = "decimal with thousands separator"   , pattern =-    [ regex "(\\d+(,\\d\\d\\d)+\\.\\d+)"+    [ regex "(\\d+(\\.\\d\\d\\d)+,\\d+)"     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) ->-        parseDouble (Text.replace (Text.singleton ',') Text.empty match) >>= double+        let dot = Text.singleton '.'+            comma = Text.singleton ','+            fmt = Text.replace comma dot $ Text.replace dot Text.empty match+        in parseDouble fmt >>= double       _ -> Nothing   } @@ -138,11 +141,11 @@ ruleDecimalNumeral = Rule   { name = "decimal number"   , pattern =-    [ regex "(\\d*\\.\\d+)"+    [ regex "(\\d*,\\d+)"     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) ->-        parseDecimal True match+        parseDecimal False match       _ -> Nothing   } @@ -689,13 +692,13 @@  ruleIntegerWithThousandsSeparator :: Rule ruleIntegerWithThousandsSeparator = Rule-  { name = "integer with thousands separator ,"+  { name = "integer with thousands separator ."   , pattern =-    [ regex "(\\d{1,3}(,\\d\\d\\d){1,5})"+    [ regex "(\\d{1,3}(\\.\\d\\d\\d){1,5})"     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) ->-        parseDouble (Text.replace (Text.singleton ',') Text.empty match) >>= double+        parseDouble (Text.replace (Text.singleton '.') Text.empty match) >>= double       _ -> Nothing   } 
Duckling/Ordinal/DE/Corpus.hs view
@@ -9,7 +9,9 @@ {-# LANGUAGE OverloadedStrings #-}  module Duckling.Ordinal.DE.Corpus-  ( corpus ) where+  ( corpus+  , negativeCorpus+  ) where  import Prelude import Data.String@@ -22,10 +24,19 @@ corpus :: Corpus corpus = (testContext {lang = DE}, allExamples) +negativeCorpus :: NegativeCorpus+negativeCorpus = (testContext {lang = DE}, examples)+  where+    examples =+      [ "1.1"+      , "1.1."+      ]+ allExamples :: [Example] allExamples =   examples (OrdinalData 4)            [ "vierter"            , "4ter"            , "Vierter"+           , "4."            ]
Duckling/Ordinal/DE/Rules.hs view
@@ -77,7 +77,7 @@ ruleOrdinalDigits = Rule   { name = "ordinal (digits)"   , pattern =-    [ regex "0*(\\d+)(\\.| ?(te(n|r|s)?)|(ste(n|r|s)?))"+    [ regex "(?<!\\d|\\.)0*(\\d+)(\\.(?!\\d)| ?(te(n|r|s)?)|(ste(n|r|s)?))"     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) -> do
Duckling/Quantity/EN/Corpus.hs view
@@ -31,4 +31,13 @@   , examples (QuantityData Cup 3 (Just "sugar"))              [ "3 Cups of sugar"              ]+  , examples (QuantityData Cup 0.75 Nothing)+             [ "3/4 cup"+             , "0.75 cup"+             , ".75 cups"+             ]+  , examples (QuantityData Gram 500 (Just "strawberries"))+             [ "500 grams of strawberries"+             , "500g of strawberries"+             ]   ]
Duckling/Quantity/EN/Rules.hs view
@@ -12,46 +12,57 @@ module Duckling.Quantity.EN.Rules   ( rules ) where -import qualified Data.Text as Text-import Prelude import Data.String+import Prelude+import qualified Data.Text as Text -import qualified Duckling.Numeral.Types as TNumeral+import Duckling.Dimensions.Types import Duckling.Quantity.Helpers-import qualified Duckling.Quantity.Types as TQuantity import Duckling.Regex.Types-import Duckling.Dimensions.Types import Duckling.Types+import qualified Duckling.Numeral.Types as TNumeral+import qualified Duckling.Quantity.Types as TQuantity  ruleNumeralQuantity :: Rule ruleNumeralQuantity = Rule   { name = "<number> <quantity>"   , pattern =     [ dimension Numeral-    , regex "(pound|cup)s?"+    , regex "((pound|cup|gram)s?|g)"     ]   , prod = \tokens -> case tokens of     (Token Numeral nd:      Token RegexMatch (GroupMatch (match:_)):      _) -> case Text.toLower match of-      "cup"    -> Just . Token Quantity . quantity TQuantity.Cup $ TNumeral.value nd-      "cups"   -> Just . Token Quantity . quantity TQuantity.Cup $ TNumeral.value nd-      "pound"  -> Just . Token Quantity . quantity TQuantity.Pound $ TNumeral.value nd-      "pounds" -> Just . Token Quantity . quantity TQuantity.Pound $ TNumeral.value nd-      _ -> Nothing+      "cup"    ->+        Just . Token Quantity . quantity TQuantity.Cup $ TNumeral.value nd+      "cups"   ->+        Just . Token Quantity . quantity TQuantity.Cup $ TNumeral.value nd+      "g"      ->+        Just . Token Quantity . quantity TQuantity.Gram $ TNumeral.value nd+      "gram"   ->+        Just . Token Quantity . quantity TQuantity.Gram $ TNumeral.value nd+      "grams"  ->+        Just . Token Quantity . quantity TQuantity.Gram $ TNumeral.value nd+      "pound"  ->+        Just . Token Quantity . quantity TQuantity.Pound $ TNumeral.value nd+      "pounds" ->+        Just . Token Quantity . quantity TQuantity.Pound $ TNumeral.value nd+      _        -> Nothing     _ -> Nothing   }  ruleAQuantity :: Rule ruleAQuantity = Rule   { name = "a quantity"-  , pattern = [ regex "a (pound|cup)s?"]+  , pattern =+    [ regex "a (pound|cup|gram)s?"+    ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of         "cup"    -> Just . Token Quantity $ quantity TQuantity.Cup 1-        "cups"   -> Just . Token Quantity $ quantity TQuantity.Cup 1+        "gram"   -> Just . Token Quantity $ quantity TQuantity.Gram 1         "pound"  -> Just . Token Quantity $ quantity TQuantity.Pound 1-        "pounds" -> Just . Token Quantity $ quantity TQuantity.Pound 1         _        -> Nothing       _ -> Nothing   }@@ -61,7 +72,7 @@   { name = "<quantity> of product"   , pattern =     [ dimension Quantity-    , regex "of (meat|sugar)"+    , regex "of (\\w+)"     ]   , prod = \tokens -> case tokens of     (Token Quantity qd:Token RegexMatch (GroupMatch (product:_)):_) ->
Duckling/Ranking/Classifiers.hs view
@@ -12,6 +12,7 @@  import Duckling.Lang import qualified Duckling.Ranking.Classifiers.AR as ARClassifiers+import qualified Duckling.Ranking.Classifiers.CS as CSClassifiers import qualified Duckling.Ranking.Classifiers.DA as DAClassifiers import qualified Duckling.Ranking.Classifiers.DE as DEClassifiers import qualified Duckling.Ranking.Classifiers.EN as ENClassifiers@@ -41,6 +42,7 @@  classifiers :: Lang -> Classifiers classifiers AR = ARClassifiers.classifiers+classifiers CS = CSClassifiers.classifiers classifiers DA = DAClassifiers.classifiers classifiers DE = DEClassifiers.classifiers classifiers EN = ENClassifiers.classifiers
+ Duckling/Ranking/Classifiers/CS.hs view
@@ -0,0 +1,22 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.++-----------------------------------------------------------------+-- Auto-generated by regenClassifiers+--+-- DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING+--  @generated+-----------------------------------------------------------------+{-# LANGUAGE OverloadedStrings #-}+module Duckling.Ranking.Classifiers.CS (classifiers) where+import Prelude+import Duckling.Ranking.Types+import qualified Data.HashMap.Strict as HashMap+import Data.String++classifiers :: Classifiers+classifiers = HashMap.fromList []
Duckling/Ranking/Classifiers/DE.hs view
@@ -35,11 +35,11 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("integer (numeric)",         Classifier{okData =-                     ClassData{prior = -0.668083211896729, unseen = -4.634728988229636,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 101},+                     ClassData{prior = -0.6616839111041602, unseen = -4.74493212836325,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 113},                    koData =-                     ClassData{prior = -0.7188555372701523, unseen = -4.584967478670572,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 96}}),+                     ClassData{prior = -0.7256326357044337, unseen = -4.68213122712422,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 106}}),        ("exactly <time-of-day>",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.3025850929940455,@@ -175,34 +175,35 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("mm/dd",         Classifier{okData =-                     ClassData{prior = -0.2231435513142097, unseen = -1.791759469228055,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 4},+                     ClassData{prior = -0.13353139262452263,+                               unseen = -2.1972245773362196,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 7},                    koData =-                     ClassData{prior = -1.6094379124341003,+                     ClassData{prior = -2.0794415416798357,                                unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),        ("at <time-of-day>",         Classifier{okData =-                     ClassData{prior = -0.20972053098206903,-                               unseen = -4.276666119016055,+                     ClassData{prior = -0.19237189264745613,+                               unseen = -4.356708826689592,                                likelihoods =                                  HashMap.fromList-                                   [("<time-of-day>  o'clock", -2.065455299705096),+                                   [("<time-of-day>  o'clock", -2.0412203288596382),                                     ("half <integer> (german style hour-of-day)",-                                     -3.56953269648137),-                                    ("about <time-of-day>", -3.164067588373206),-                                    ("time-of-day (latent)", -1.6236225474260568),+                                     -3.6506582412937383),+                                    ("about <time-of-day>", -2.7343675094195836),+                                    ("time-of-day (latent)", -1.7047480922384253),                                     ("relative minutes after|past <integer> (hour-of-day)",-                                     -3.56953269648137),-                                    ("hh:mm", -2.8763855159214247),+                                     -3.6506582412937383),+                                    ("hh:mm", -2.9575110607337933),                                     ("quarter after|past <integer> (hour-of-day)",-                                     -3.56953269648137),-                                    ("hour", -1.08462604669337), ("minute", -2.1832383353614793),+                                     -3.6506582412937383),+                                    ("hour", -1.0479685558493548), ("minute", -2.264363880173848),                                     ("<hour-of-day> <integer> (as relative minutes)",-                                     -3.56953269648137)],-                               n = 30},+                                     -3.6506582412937383)],+                               n = 33},                    koData =-                     ClassData{prior = -1.6650077635889111, unseen = -3.258096538021482,+                     ClassData{prior = -1.742969305058623, unseen = -3.258096538021482,                                likelihoods =                                  HashMap.fromList                                    [("time-of-day (latent)", -1.6094379124341003),@@ -211,37 +212,40 @@                                n = 7}}),        ("absorption of , after named day",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -3.1780538303479458,+                     ClassData{prior = -7.410797215372185e-2,+                               unseen = -3.4011973816621555,                                likelihoods =                                  HashMap.fromList-                                   [("on <date>", -2.03688192726104), ("day", -0.7375989431307791),-                                    ("named-day", -0.9382696385929302)],-                               n = 10},+                                   [("on <date>", -2.268683541318364), ("day", -0.7282385003712154),+                                    ("named-day", -0.8823891801984737)],+                               n = 13},                    koData =-                     ClassData{prior = -infinity, unseen = -1.3862943611198906,-                               likelihoods = HashMap.fromList [], n = 0}}),+                     ClassData{prior = -2.639057329615259, unseen = -1.791759469228055,+                               likelihoods =+                                 HashMap.fromList+                                   [("day", -0.916290731874155), ("named-day", -0.916290731874155)],+                               n = 1}}),        ("on <date>",         Classifier{okData =-                     ClassData{prior = -0.20409535634351528,-                               unseen = -4.820281565605037,+                     ClassData{prior = -0.2076393647782445, unseen = -4.804021044733257,                                likelihoods =                                  HashMap.fromList-                                   [("mm/dd", -4.119037174812472),-                                    ("absorption of , after named day", -3.713572066704308),-                                    ("intersect", -1.867745376205977),-                                    ("after lunch", -2.866274206317104),-                                    ("day", -1.4799798451972137), ("afternoon", -2.866274206317104),-                                    ("named-day", -2.866274206317104),-                                    ("intersect by ','", -2.866274206317104),-                                    ("intersect by 'of', 'from', 's", -3.4258899942525267),-                                    ("<day-of-month> (ordinal)", -3.713572066704308),-                                    ("hour", -1.9218125974762528), ("evening", -4.119037174812472),-                                    ("<datetime> - <datetime> (interval)", -4.119037174812472),-                                    ("minute", -2.509599262378372),-                                    ("morning", -4.119037174812472)],-                               n = 53},+                                   [("mm/dd", -4.102643365036796),+                                    ("absorption of , after named day", -3.6971782569286313),+                                    ("intersect", -1.8513515664303006),+                                    ("after lunch", -2.849880396541428),+                                    ("day", -1.499953679592412), ("afternoon", -2.849880396541428),+                                    ("named-day", -2.849880396541428),+                                    ("intersect by ','", -2.849880396541428),+                                    ("intersect by 'of', 'from', 's", -3.4094961844768505),+                                    ("<day-of-month> (ordinal)", -4.102643365036796),+                                    ("hour", -1.9054187877005764), ("evening", -4.102643365036796),+                                    ("<datetime> - <datetime> (interval)", -4.102643365036796),+                                    ("minute", -2.4932054526026954),+                                    ("morning", -4.102643365036796)],+                               n = 52},                    koData =-                     ClassData{prior = -1.6894806201076367,+                     ClassData{prior = -1.6739764335716716,                                unseen = -3.7376696182833684,                                likelihoods =                                  HashMap.fromList@@ -304,24 +308,24 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<time-of-day>  o'clock",         Classifier{okData =-                     ClassData{prior = -4.348511193973878e-2,-                               unseen = -4.61512051684126,+                     ClassData{prior = -3.077165866675366e-2,+                               unseen = -4.9344739331306915,                                likelihoods =                                  HashMap.fromList-                                   [("exactly <time-of-day>", -3.912023005428146),-                                    ("at <time-of-day>", -2.4079456086518722),+                                   [("exactly <time-of-day>", -4.23410650459726),+                                    ("at <time-of-day>", -2.624668592163159),                                     ("half <integer> (german style hour-of-day)",-                                     -3.912023005428146),-                                    ("about <time-of-day>", -3.2188758248682006),-                                    ("time-of-day (latent)", -1.3470736479666092),+                                     -4.23410650459726),+                                    ("about <time-of-day>", -2.847812143477369),+                                    ("time-of-day (latent)", -1.3437347467010947),                                     ("quarter after|past <integer> (hour-of-day)",-                                     -3.912023005428146),-                                    ("until <time-of-day>", -3.2188758248682006),-                                    ("hour", -0.8209805520698302), ("minute", -3.506557897319982),-                                    ("after <time-of-day>", -3.2188758248682006)],-                               n = 45},+                                     -4.23410650459726),+                                    ("until <time-of-day>", -3.1354942159291497),+                                    ("hour", -0.7841189587656721), ("minute", -3.828641396489095),+                                    ("after <time-of-day>", -3.1354942159291497)],+                               n = 64},                    koData =-                     ClassData{prior = -3.1570004211501135, unseen = -2.70805020110221,+                     ClassData{prior = -3.4965075614664802, unseen = -2.70805020110221,                                likelihoods =                                  HashMap.fromList                                    [("time-of-day (latent)", -1.9459101490553135),@@ -354,252 +358,264 @@                                n = 1}}),        ("intersect",         Classifier{okData =-                     ClassData{prior = -0.24751603072644626, unseen = -6.8001700683022,+                     ClassData{prior = -0.23031204079282233,+                               unseen = -6.885509670034817,                                likelihoods =                                  HashMap.fromList-                                   [("intersect by ','named-month", -4.49647076906475),-                                    ("hourday", -4.8531457130034825),-                                    ("dayhour", -2.481567748522486),-                                    ("daymonth", -3.3333199592590694),+                                   [("intersect by ','named-month", -4.399580002254782),+                                    ("hourday", -4.93857650298747), ("dayhour", -2.527777825353191),+                                    ("daymonth", -3.1232865363492204),                                     ("<day-of-month>(ordinal) <named-month> year<time-of-day>  o'clock",-                                     -6.105908681498851),-                                    ("monthyear", -4.49647076906475),-                                    ("yearhour", -6.105908681498851),-                                    ("intersect<time-of-day>  o'clock", -3.9658425180025803),-                                    ("christmasyear", -6.105908681498851),-                                    ("after lunchat <time-of-day>", -6.105908681498851),-                                    ("named-daylast <cycle>", -6.105908681498851),-                                    ("intersect by 'of', 'from', 'syear", -5.700443573390687),-                                    ("<time-of-day> am|pmintersect", -5.0072963928307415),-                                    ("intersect<time> <part-of-day>", -4.026467139819015),-                                    ("<time-of-day>  o'clockafter lunch", -5.412761500938905),+                                     -6.191339471482838),+                                    ("monthyear", -4.4865913792444125),+                                    ("yearhour", -6.191339471482838),+                                    ("intersect<time-of-day>  o'clock", -4.051273307986567),+                                    ("christmasyear", -6.191339471482838),+                                    ("after lunchat <time-of-day>", -6.191339471482838),+                                    ("absorption of , after named daymm/dd/yyyy",+                                     -6.191339471482838),+                                    ("named-daylast <cycle>", -6.191339471482838),+                                    ("intersect by 'of', 'from', 'syear", -5.785874363374673),+                                    ("<time-of-day> am|pmintersect", -5.092727182814728),+                                    ("intersect<time> <part-of-day>", -4.111897929803002),+                                    ("the <day-of-month> (ordinal)named-month", -6.191339471482838),+                                    ("<time-of-day>  o'clockafter lunch", -5.498192290922892),                                     ("<time> <part-of-day><time-of-day>  o'clock",-                                     -6.105908681498851),-                                    ("today<time-of-day>  o'clock", -6.105908681498851),-                                    ("<time-of-day>  o'clockon <date>", -5.700443573390687),-                                    ("<time-of-day> am|pmintersect by ','", -5.412761500938905),-                                    ("intersect by ','year", -5.700443573390687),-                                    ("on <date><time-of-day>  o'clock", -6.105908681498851),-                                    ("exactly <time-of-day>tomorrow", -5.700443573390687),-                                    ("monthhour", -5.700443573390687),+                                     -6.191339471482838),+                                    ("today<time-of-day>  o'clock", -6.191339471482838),+                                    ("<time-of-day>  o'clockon <date>", -5.785874363374673),+                                    ("<time-of-day> am|pmintersect by ','", -5.498192290922892),+                                    ("intersect by ','year", -5.092727182814728),+                                    ("on <date><time-of-day>  o'clock", -6.191339471482838),+                                    ("exactly <time-of-day>tomorrow", -5.785874363374673),+                                    ("mm/dd<time-of-day>  o'clock", -6.191339471482838),+                                    ("monthhour", -5.785874363374673),                                     ("on <date>between <datetime> and <datetime> (interval)",-                                     -6.105908681498851),-                                    ("last <day-of-week> of <time>year", -6.105908681498851),-                                    ("hourmonth", -5.700443573390687),-                                    ("todayat <time-of-day>", -5.412761500938905),+                                     -6.191339471482838),+                                    ("last <day-of-week> of <time>year", -6.191339471482838),+                                    ("hourmonth", -5.785874363374673),+                                    ("todayat <time-of-day>", -5.498192290922892),+                                    ("mm/ddabout <time-of-day>", -5.785874363374673),                                     ("on <date>between <time-of-day> and <time-of-day> (interval)",-                                     -6.105908681498851),-                                    ("on <date>at <time-of-day>", -5.700443573390687),-                                    ("named-dayhh:mm", -6.105908681498851),-                                    ("dayday", -3.1881379494145716),-                                    ("<time> <part-of-day>at <time-of-day>", -5.700443573390687),+                                     -6.191339471482838),+                                    ("on <date>at <time-of-day>", -5.785874363374673),+                                    ("named-dayhh:mm", -6.191339471482838),+                                    ("dayday", -3.013285641134892),+                                    ("<time> <part-of-day>at <time-of-day>", -5.785874363374673),                                     ("<time-of-day> am|pmabsorption of , after named day",-                                     -6.105908681498851),-                                    ("about <time-of-day>on <date>", -6.105908681498851),+                                     -6.191339471482838),+                                    ("about <time-of-day>on <date>", -6.191339471482838),                                     ("<hour-of-day> <integer> (as relative minutes)in|during the <part-of-day>",-                                     -5.700443573390687),-                                    ("<day-of-month> (ordinal)intersect", -5.1896179496246955),-                                    ("hourhour", -3.5801800371905954),-                                    ("<part-of-day> of <time>named-month", -5.700443573390687),-                                    ("hh:mmintersect by ','", -4.8531457130034825),-                                    ("intersectnamed-month", -3.3333199592590694),-                                    ("dayyear", -3.9086841041626315),+                                     -5.785874363374673),+                                    ("<day-of-month> (ordinal)intersect", -5.092727182814728),+                                    ("hourhour", -3.6656108271745818),+                                    ("<part-of-day> of <time>named-month", -5.785874363374673),+                                    ("hh:mmintersect by ','", -4.93857650298747),+                                    ("intersectnamed-month", -3.358126127426621),+                                    ("dayyear", -3.552282141867579),                                     ("<time-of-day>  o'clockin|during the <part-of-day>",-                                     -5.0072963928307415),-                                    ("tomorrow<time-of-day>  o'clock", -6.105908681498851),-                                    ("<time-of-day>  o'clocktomorrow", -5.412761500938905),+                                     -5.092727182814728),+                                    ("tomorrow<time-of-day>  o'clock", -6.191339471482838),+                                    ("<time-of-day>  o'clocktomorrow", -5.498192290922892),                                     ("<day-of-month>(ordinal) <named-month>year",-                                     -6.105908681498851),+                                     -5.785874363374673),                                     ("half <integer> (german style hour-of-day)after lunch",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("absorption of , after named day<day-of-month>(ordinal) <named-month>",-                                     -5.0072963928307415),-                                    ("hourminute", -5.412761500938905),+                                     -4.93857650298747),+                                    ("hourminute", -5.498192290922892),                                     ("on <date><day-of-month>(ordinal) <named-month>",-                                     -5.700443573390687),-                                    ("minutemonth", -3.431760032072322),-                                    ("minutehour", -3.8546168828923557),-                                    ("named-day<time> timezone", -6.105908681498851),+                                     -5.785874363374673),+                                    ("minutemonth", -3.5171908220563086),+                                    ("minutehour", -3.9400476728763425),+                                    ("named-day<time> timezone", -6.191339471482838),                                     ("at <time-of-day>in|during the <part-of-day>",-                                     -5.1896179496246955),-                                    ("named-monthyear", -4.49647076906475),+                                     -5.275048739608683),+                                    ("named-monthyear", -4.4865913792444125),                                     ("absorption of , after named day<day-of-month>(ordinal) <named-month> year",-                                     -6.105908681498851),+                                     -5.785874363374673),                                     ("absorption of , after named day<named-month> <day-of-month> (non ordinal)",-                                     -5.0072963928307415),+                                     -5.092727182814728),                                     ("named-day<time-of-day> - <time-of-day> (interval)",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<day-of-month>(ordinal) <named-month> year<time> <part-of-day>",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<hour-of-day> <integer> (as relative minutes)after lunch",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("named-day<datetime> - <datetime> (interval)",-                                     -6.105908681498851),-                                    ("on <date>named-month", -5.1896179496246955),+                                     -6.191339471482838),+                                    ("on <date>named-month", -5.275048739608683),                                     ("intersect<day-of-month>(ordinal) <named-month>",-                                     -4.71961432037896),+                                     -4.805045110362947),                                     ("this <part-of-day><time-of-day>  o'clock",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<day-of-month>(ordinal) <named-month>intersect",-                                     -6.105908681498851),-                                    ("hh:mmintersect", -3.6635616461296463),+                                     -6.191339471482838),+                                    ("hh:mmintersect", -3.748992436113633),                                     ("named-dayfrom <datetime> - <datetime> (interval)",-                                     -5.700443573390687),-                                    ("named-daynext <cycle>", -6.105908681498851),+                                     -5.785874363374673),+                                    ("named-daynext <cycle>", -6.191339471482838),                                     ("named-dayfrom <time-of-day> - <time-of-day> (interval)",-                                     -5.412761500938905),-                                    ("<day-of-month> (ordinal)named-day", -5.700443573390687),-                                    ("intersect by ','intersect", -5.0072963928307415),+                                     -5.498192290922892),+                                    ("<day-of-month> (ordinal)named-day", -5.785874363374673),+                                    ("intersect by ','intersect", -4.93857650298747),                                     ("half <integer> (german style hour-of-day)in|during the <part-of-day>",-                                     -5.700443573390687),-                                    ("at <time-of-day>intersect", -4.314149212270796),+                                     -5.785874363374673),+                                    ("at <time-of-day>intersect", -4.399580002254782),                                     ("on <date>from <time-of-day> - <time-of-day> (interval)",-                                     -5.700443573390687),+                                     -5.785874363374673),                                     ("<time> <part-of-day>from <time-of-day> - <time-of-day> (interval)",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("absorption of , after named day<day-of-month> (ordinal)",-                                     -5.0072963928307415),-                                    ("dayminute", -3.9086841041626315),+                                     -4.93857650298747),+                                    ("dayminute", -3.9941148941466182),                                     ("on <date>from <datetime> - <datetime> (interval)",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<time> <part-of-day>from <datetime> - <datetime> (interval)",-                                     -6.105908681498851),-                                    ("intersectyear", -4.8531457130034825),-                                    ("on <date>intersect", -5.700443573390687),-                                    ("on <date><day-of-month> (ordinal)", -5.700443573390687),-                                    ("<ordinal> <cycle> of <time>year", -6.105908681498851),-                                    ("minuteday", -2.1262270275968898),+                                     -6.191339471482838),+                                    ("intersectyear", -4.399580002254782),+                                    ("on <date>intersect", -5.785874363374673),+                                    ("on <date><day-of-month> (ordinal)", -5.785874363374673),+                                    ("<ordinal> <cycle> of <time>year", -6.191339471482838),+                                    ("minuteday", -2.2116578175808765),                                     ("absorption of , after named dayintersect",-                                     -3.9658425180025803),+                                     -3.7934441986844667),                                     ("named-daybetween <time-of-day> and <time-of-day> (interval)",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<datetime> - <datetime> (interval)named-month",-                                     -5.700443573390687),-                                    ("year<time-of-day>  o'clock", -6.105908681498851),-                                    ("at <time-of-day>intersect by ','", -5.412761500938905),-                                    ("named-dayat <time-of-day>", -5.700443573390687),-                                    ("hh:mmabsorption of , after named day", -5.700443573390687),-                                    ("<time-of-day> am|pmnamed-day", -6.105908681498851),-                                    ("intersect by ','<time> <part-of-day>", -5.1896179496246955),-                                    ("hh:mmon <date>", -3.6635616461296463),+                                     -5.785874363374673),+                                    ("year<time-of-day>  o'clock", -6.191339471482838),+                                    ("at <time-of-day>intersect by ','", -5.498192290922892),+                                    ("named-dayat <time-of-day>", -5.785874363374673),+                                    ("hh:mmabsorption of , after named day", -5.785874363374673),+                                    ("<time-of-day> am|pmnamed-day", -6.191339471482838),+                                    ("intersect by ','<time> <part-of-day>", -5.275048739608683),+                                    ("hh:mmon <date>", -3.748992436113633),                                     ("named-daybetween <datetime> and <datetime> (interval)",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("at <time-of-day>absorption of , after named day",-                                     -6.105908681498851),-                                    ("until <time-of-day>after lunch", -6.105908681498851),-                                    ("mm/ddyear", -6.105908681498851),-                                    ("intersect by ','<time-of-day>  o'clock", -5.1896179496246955),-                                    ("intersect<day-of-month> (ordinal)", -4.71961432037896),-                                    ("named-day<time-of-day>  o'clock", -6.105908681498851),+                                     -6.191339471482838),+                                    ("until <time-of-day>after lunch", -6.191339471482838),+                                    ("mm/ddyear", -5.785874363374673),+                                    ("intersect by ','<time-of-day>  o'clock", -5.275048739608683),+                                    ("intersect<day-of-month> (ordinal)", -4.805045110362947),+                                    ("absorption of , after named daymm/dd", -6.191339471482838),+                                    ("named-day<time-of-day>  o'clock", -6.191339471482838),                                     ("<day-of-month> (ordinal)intersect by 'of', 'from', 's",-                                     -5.412761500938905),-                                    ("at <time-of-day>on <date>", -4.23410650459726),-                                    ("intersectintersect", -4.026467139819015),-                                    ("dayweek", -5.0072963928307415),-                                    ("weekyear", -5.700443573390687),-                                    ("hh:mmin|during the <part-of-day>", -5.1896179496246955),-                                    ("named-monthintersect", -6.105908681498851),-                                    ("<day-of-month> (ordinal)named-month", -4.401160589260425),-                                    ("tomorrowat <time-of-day>", -5.700443573390687),+                                     -5.498192290922892),+                                    ("at <time-of-day>on <date>", -4.319537294581246),+                                    ("intersectintersect", -4.051273307986567),+                                    ("dayweek", -5.092727182814728),+                                    ("absorption of , after named daythe <day-of-month> (ordinal)",+                                     -6.191339471482838),+                                    ("weekyear", -5.785874363374673),+                                    ("hh:mmin|during the <part-of-day>", -5.275048739608683),+                                    ("intersect by 'of', 'from', 'snamed-month",+                                     -6.191339471482838),+                                    ("named-monthintersect", -6.191339471482838),+                                    ("<day-of-month> (ordinal)named-month", -4.319537294581246),+                                    ("tomorrowat <time-of-day>", -5.785874363374673),                                     ("<hour-of-day> <integer> (as relative minutes)on <date>",-                                     -6.105908681498851),-                                    ("named-daythis <cycle>", -5.412761500938905),-                                    ("at <time-of-day>tomorrow", -6.105908681498851),+                                     -6.191339471482838),+                                    ("named-daythis <cycle>", -5.498192290922892),+                                    ("at <time-of-day>tomorrow", -6.191339471482838),                                     ("about <time-of-day>in|during the <part-of-day>",-                                     -5.700443573390687),+                                     -5.785874363374673),                                     ("half <integer> (german style hour-of-day)on <date>",-                                     -6.105908681498851),-                                    ("this <part-of-day>at <time-of-day>", -5.700443573390687),+                                     -6.191339471482838),+                                    ("this <part-of-day>at <time-of-day>", -5.785874363374673),                                     ("after lunch<hour-of-day> <integer> (as relative minutes)",-                                     -5.700443573390687),-                                    ("last <cycle> of <time>year", -5.700443573390687),+                                     -5.785874363374673),+                                    ("last <cycle> of <time>year", -5.785874363374673),                                     ("<named-month> <day-of-month> (non ordinal)year",-                                     -6.105908681498851),+                                     -6.191339471482838),                                     ("<day-of-month> (non ordinal) <named-month>year",-                                     -6.105908681498851)],-                               n = 381},+                                     -6.191339471482838)],+                               n = 417},                    koData =-                     ClassData{prior = -1.517486571391241, unseen = -5.857933154483459,+                     ClassData{prior = -1.581267035467404, unseen = -5.886104031450156,                                likelihoods =                                  HashMap.fromList-                                   [("intersect by ','named-month", -4.468777561082536),-                                    ("named-day<part-of-day> of <time>", -5.161924741642482),-                                    ("dayhour", -4.468777561082536),-                                    ("daymonth", -3.2901225647408903),-                                    ("monthday", -4.756459633534318),-                                    ("monthyear", -5.161924741642482),-                                    ("yearhour", -5.161924741642482),-                                    ("after lunchat <time-of-day>", -4.756459633534318),-                                    ("intersect by 'of', 'from', 'syear", -4.468777561082536),-                                    ("<time-of-day> am|pmintersect", -3.457176649404057),-                                    ("intersect<time> <part-of-day>", -5.161924741642482),-                                    ("<time-of-day>  o'clockafter lunch", -5.161924741642482),-                                    ("<day-of-month> (ordinal)year", -5.161924741642482),-                                    ("after lunch<time-of-day>  o'clock", -5.161924741642482),-                                    ("at <time-of-day>named-day", -5.161924741642482),-                                    ("<time-of-day> am|pmintersect by ','", -3.909161773147114),+                                   [("intersect by ','named-month", -4.497028027368389),+                                    ("named-day<part-of-day> of <time>", -5.190175207928333),+                                    ("absorption of , after named daythe <day-of-month> (non ordinal)",+                                     -5.190175207928333),+                                    ("dayhour", -4.497028027368389),+                                    ("daymonth", -3.3183730310267423),+                                    ("monthday", -4.7847100998201695),+                                    ("monthyear", -5.190175207928333),+                                    ("yearhour", -5.190175207928333),+                                    ("after lunchat <time-of-day>", -4.7847100998201695),+                                    ("intersect by 'of', 'from', 'syear", -4.497028027368389),+                                    ("<time-of-day> am|pmintersect", -3.4854271156899084),+                                    ("intersect<time> <part-of-day>", -5.190175207928333),+                                    ("<time-of-day>  o'clockafter lunch", -5.190175207928333),+                                    ("after lunch<time-of-day>  o'clock", -5.190175207928333),+                                    ("at <time-of-day>named-day", -5.190175207928333),+                                    ("absorption of , after named dayhh:mm", -5.190175207928333),+                                    ("<time-of-day> am|pmintersect by ','", -3.9374122394329656),                                     ("<time-of-day>  o'clock<time> <part-of-day>",-                                     -4.2456340097683265),-                                    ("monthhour", -5.161924741642482),+                                     -4.273884476054178),+                                    ("monthhour", -5.190175207928333),                                     ("on <date>between <datetime> and <datetime> (interval)",-                                     -5.161924741642482),-                                    ("todayat <time-of-day>", -5.161924741642482),+                                     -5.190175207928333),+                                    ("todayat <time-of-day>", -5.190175207928333),                                     ("on <date>between <time-of-day> and <time-of-day> (interval)",-                                     -5.161924741642482),-                                    ("named-dayhh:mm", -5.161924741642482),-                                    ("dayday", -3.909161773147114),+                                     -5.190175207928333),+                                    ("named-dayhh:mm", -5.190175207928333),+                                    ("dayday", -3.803880846808443),                                     ("<time-of-day> am|pmabsorption of , after named day",-                                     -4.756459633534318),-                                    ("hourhour", -3.657847344866208),-                                    ("intersectnamed-month", -3.5524868292083815),-                                    ("dayyear", -4.0633124529743725),-                                    ("minutemonth", -3.2160145925871686),-                                    ("named-monthyear", -5.161924741642482),+                                     -4.7847100998201695),+                                    ("hourhour", -3.6860978111520595),+                                    ("intersectnamed-month", -3.580737295494233),+                                    ("dayyear", -4.273884476054178),+                                    ("minutemonth", -3.24426505887302),+                                    ("named-monthyear", -5.190175207928333),                                     ("named-day<time-of-day> - <time-of-day> (interval)",-                                     -5.161924741642482),-                                    ("on <date>named-month", -5.161924741642482),+                                     -5.190175207928333),+                                    ("on <date>named-month", -5.190175207928333),                                     ("absorption of , after named daynamed-month",-                                     -4.0633124529743725),+                                     -4.091562919260224),                                     ("intersect<day-of-month>(ordinal) <named-month>",-                                     -4.468777561082536),-                                    ("named-dayafter <time-of-day>", -4.756459633534318),+                                     -4.497028027368389),+                                    ("named-dayafter <time-of-day>", -4.7847100998201695),                                     ("named-dayfrom <datetime> - <datetime> (interval)",-                                     -4.756459633534318),+                                     -4.7847100998201695),                                     ("<hour-of-day> <integer> (as relative minutes)named-month",-                                     -5.161924741642482),+                                     -5.190175207928333),                                     ("named-dayfrom <time-of-day> - <time-of-day> (interval)",-                                     -4.468777561082536),-                                    ("<day-of-month> (ordinal)named-day", -4.468777561082536),-                                    ("at <time-of-day>intersect", -4.0633124529743725),+                                     -4.497028027368389),+                                    ("<day-of-month> (ordinal)named-day", -4.497028027368389),+                                    ("at <time-of-day>intersect", -4.091562919260224),                                     ("on <date>from <time-of-day> - <time-of-day> (interval)",-                                     -4.756459633534318),-                                    ("dayminute", -3.0218585781462113),+                                     -4.7847100998201695),+                                    ("dayminute", -2.992950630592114),                                     ("on <date>from <datetime> - <datetime> (interval)",-                                     -5.161924741642482),-                                    ("minuteday", -2.1661924680884908),+                                     -5.190175207928333),+                                    ("minuteday", -2.194442934374343),                                     ("named-daybetween <time-of-day> and <time-of-day> (interval)",-                                     -5.161924741642482),-                                    ("at <time-of-day>intersect by ','", -4.468777561082536),-                                    ("<time-of-day> am|pmnamed-day", -4.756459633534318),+                                     -5.190175207928333),+                                    ("at <time-of-day>intersect by ','", -4.497028027368389),+                                    ("<time-of-day> am|pmnamed-day", -4.7847100998201695),                                     ("named-daybetween <datetime> and <datetime> (interval)",-                                     -5.161924741642482),+                                     -5.190175207928333),                                     ("at <time-of-day>absorption of , after named day",-                                     -5.161924741642482),+                                     -5.190175207928333),                                     ("named-month<day-of-month> (non ordinal) <named-month>",-                                     -4.756459633534318),-                                    ("year<time> <part-of-day>", -5.161924741642482),-                                    ("intersect<day-of-month> (ordinal)", -4.468777561082536),+                                     -4.7847100998201695),+                                    ("year<time> <part-of-day>", -5.190175207928333),+                                    ("intersect<day-of-month> (ordinal)", -4.497028027368389),                                     ("<day-of-month> (ordinal)intersect by 'of', 'from', 's",-                                     -4.756459633534318),+                                     -4.7847100998201695),                                     ("<named-month> <day-of-month> (non ordinal)named-month",-                                     -4.756459633534318),-                                    ("intersectintersect", -4.468777561082536),-                                    ("<day-of-month> (ordinal)named-month", -4.468777561082536),-                                    ("until <time-of-day>named-month", -5.161924741642482),-                                    ("after <time-of-day>year", -5.161924741642482),-                                    ("on <date>after <time-of-day>", -5.161924741642482),-                                    ("tomorrownoon", -5.161924741642482)],-                               n = 107}}),+                                     -4.7847100998201695),+                                    ("intersectintersect", -4.497028027368389),+                                    ("<day-of-month> (ordinal)named-month", -4.497028027368389),+                                    ("until <time-of-day>named-month", -5.190175207928333),+                                    ("after <time-of-day>year", -5.190175207928333),+                                    ("on <date>after <time-of-day>", -5.190175207928333),+                                    ("tomorrownoon", -5.190175207928333)],+                               n = 108}}),        ("<ordinal> <cycle> of <time>",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.4849066497880004,@@ -715,8 +731,8 @@                                n = 1}}),        ("mm/dd/yyyy",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.3862943611198906,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},+                     ClassData{prior = 0.0, unseen = -1.791759469228055,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 4},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -793,10 +809,18 @@                                     ("ordinals (first..19th)named-daynamed-month",                                      -0.8109302162163288)],                                n = 3}}),+       ("the <day-of-month> (non ordinal)",+        Classifier{okData =+                     ClassData{prior = -infinity, unseen = -0.6931471805599453,+                               likelihoods = HashMap.fromList [], n = 0},+                   koData =+                     ClassData{prior = 0.0, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],+                               n = 1}}),        ("named-month",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -3.8501476017100584,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 45},+                     ClassData{prior = 0.0, unseen = -3.891820298110627,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 47},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -866,15 +890,16 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<day-of-month>(ordinal) <named-month>",         Classifier{okData =-                     ClassData{prior = -0.262364264467491, unseen = -3.1780538303479458,+                     ClassData{prior = -0.2231435513142097, unseen = -3.332204510175204,                                likelihoods =                                  HashMap.fromList-                                   [("ordinal (digits)named-month", -0.832909122935104),-                                    ("month", -0.7375989431307791),-                                    ("ordinals (first..19th)named-month", -2.4423470353692043)],-                               n = 10},+                                   [("ordinal (digits)named-month", -0.8109302162163288),+                                    ("month", -0.7308875085427924),+                                    ("ordinals (first..19th)named-month", -2.6026896854443837)],+                               n = 12},                    koData =-                     ClassData{prior = -1.466337068793427, unseen = -2.3025850929940455,+                     ClassData{prior = -1.6094379124341003,+                               unseen = -2.3025850929940455,                                likelihoods =                                  HashMap.fromList                                    [("ordinal (digits)named-month", -0.8109302162163288),@@ -960,6 +985,13 @@                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("the <day-of-month> (ordinal)",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [("ordinal (digits)", 0.0)], n = 1},+                   koData =+                     ClassData{prior = -infinity, unseen = -0.6931471805599453,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("afternoon",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.4849066497880004,@@ -990,15 +1022,16 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("about <time-of-day>",         Classifier{okData =-                     ClassData{prior = -0.2876820724517809, unseen = -2.833213344056216,+                     ClassData{prior = -0.13353139262452263,+                               unseen = -3.4965075614664802,                                likelihoods =                                  HashMap.fromList                                    [("<time-of-day>  o'clock", -1.3862943611198906),                                     ("time-of-day (latent)", -1.3862943611198906),-                                    ("hour", -0.8266785731844679)],-                               n = 6},+                                    ("hour", -0.7576857016975165)],+                               n = 14},                    koData =-                     ClassData{prior = -1.3862943611198906,+                     ClassData{prior = -2.0794415416798357,                                unseen = -2.1972245773362196,                                likelihoods =                                  HashMap.fromList@@ -1008,15 +1041,14 @@                                n = 2}}),        ("time-of-day (latent)",         Classifier{okData =-                     ClassData{prior = -0.8082165103447325,-                               unseen = -3.8066624897703196,+                     ClassData{prior = -0.6931471805599453, unseen = -4.007333185232471,                                likelihoods =                                  HashMap.fromList-                                   [("integer (numeric)", -0.1466034741918754),-                                    ("integer (0..19)", -2.174751721484161)],-                               n = 41},+                                   [("integer (numeric)", -0.11778303565638351),+                                    ("integer (0..19)", -2.379546134130174)],+                               n = 51},                    koData =-                     ClassData{prior = -0.5899629443247145, unseen = -4.007333185232471,+                     ClassData{prior = -0.6931471805599453, unseen = -4.007333185232471,                                likelihoods =                                  HashMap.fromList                                    [("integer (numeric)", -0.587786664902119),@@ -1025,9 +1057,9 @@                                n = 51}}),        ("year",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.833213344056216,+                     ClassData{prior = 0.0, unseen = -2.9444389791664407,                                likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],-                               n = 15},+                               n = 17},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -1168,13 +1200,12 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("hh:mm",         Classifier{okData =-                     ClassData{prior = -3.17486983145803e-2,+                     ClassData{prior = -0.12136085700426748,                                unseen = -3.4965075614664802,                                likelihoods = HashMap.fromList [("", 0.0)], n = 31},                    koData =-                     ClassData{prior = -3.4657359027997265,-                               unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),+                     ClassData{prior = -2.169053700369523, unseen = -1.791759469228055,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),        ("quarter after|past <integer> (hour-of-day)",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.3025850929940455,@@ -1189,8 +1220,8 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("named-day",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -4.02535169073515,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 54},+                     ClassData{prior = 0.0, unseen = -4.0943445622221,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 58},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -1208,46 +1239,52 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("intersect by ','",         Classifier{okData =-                     ClassData{prior = -0.27087495413539975,-                               unseen = -4.6913478822291435,+                     ClassData{prior = -0.2531958963806117, unseen = -4.962844630259907,                                likelihoods =                                  HashMap.fromList-                                   [("dayhour", -2.4849066497880004),-                                    ("named-day<day-of-month> (ordinal)", -3.295836866004329),-                                    ("dayday", -1.463255402256019),-                                    ("dayyear", -3.9889840465642745),+                                   [("dayhour", -2.7586024802650413),+                                    ("named-day<day-of-month> (ordinal)", -3.3463891451671604),+                                    ("dayday", -1.2922654114716141),+                                    ("dayyear", -4.2626798770413155),                                     ("on <date><day-of-month>(ordinal) <named-month>",-                                     -3.58351893845611),+                                     -3.857214768933151),                                     ("named-day<named-month> <day-of-month> (non ordinal)",-                                     -2.890371757896165),+                                     -3.164067588373206),                                     ("intersect<day-of-month>(ordinal) <named-month>",-                                     -3.0726933146901194),+                                     -3.3463891451671604),                                     ("named-day<day-of-month>(ordinal) <named-month> year",-                                     -3.9889840465642745),-                                    ("named-dayintersect", -1.9740810260220096),-                                    ("on <date>intersect", -3.58351893845611),-                                    ("on <date><day-of-month> (ordinal)", -3.58351893845611),-                                    ("minuteday", -2.117181869662683),-                                    ("intersect<day-of-month> (ordinal)", -3.0726933146901194),-                                    ("intersectintersect", -3.0726933146901194),+                                     -3.857214768933151),+                                    ("named-dayintersect", -1.9113046198778378),+                                    ("on <date>intersect", -3.857214768933151),+                                    ("on <date><day-of-month> (ordinal)", -3.857214768933151),+                                    ("named-daymm/dd/yyyy", -3.857214768933151),+                                    ("minuteday", -2.390877700139724),+                                    ("named-daymm/dd", -3.857214768933151),+                                    ("intersect<day-of-month> (ordinal)", -3.3463891451671604),+                                    ("intersectintersect", -3.3463891451671604),                                     ("named-day<day-of-month>(ordinal) <named-month>",-                                     -3.295836866004329),+                                     -3.3463891451671604),+                                    ("named-daythe <day-of-month> (ordinal)", -4.2626798770413155),                                     ("<named-month> <day-of-month> (non ordinal)year",-                                     -3.9889840465642745)],-                               n = 45},+                                     -4.2626798770413155)],+                               n = 59},                    koData =-                     ClassData{prior = -1.4384801142904609,-                               unseen = -3.8501476017100584,+                     ClassData{prior = -1.497519996230115, unseen = -4.07753744390572,                                likelihoods =                                  HashMap.fromList-                                   [("named-daynamed-month", -2.03688192726104),-                                    ("daymonth", -2.03688192726104),+                                   [("named-daynamed-month", -2.268683541318364),+                                    ("daymonth", -2.268683541318364),+                                    ("named-dayhh:mm", -2.9618307218783095),+                                    ("dayday", -3.367295829986474),                                     ("intersect<day-of-month>(ordinal) <named-month>",-                                     -2.4423470353692043),-                                    ("minuteday", -1.5260563034950494),-                                    ("intersect<day-of-month> (ordinal)", -2.4423470353692043),-                                    ("intersectintersect", -2.4423470353692043)],-                               n = 14}}),+                                     -2.6741486494265287),+                                    ("dayminute", -2.9618307218783095),+                                    ("minuteday", -1.7578579175523736),+                                    ("intersect<day-of-month> (ordinal)", -2.6741486494265287),+                                    ("intersectintersect", -2.6741486494265287),+                                    ("named-daythe <day-of-month> (non ordinal)",+                                     -3.367295829986474)],+                               n = 17}}),        ("second (grain)",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.9459101490553135,@@ -1257,43 +1294,53 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("intersect by 'of', 'from', 's",         Classifier{okData =-                     ClassData{prior = -0.534082485930258, unseen = -3.912023005428146,+                     ClassData{prior = -0.45198512374305727,+                               unseen = -4.143134726391533,                                likelihoods =                                  HashMap.fromList-                                   [("named-daynamed-month", -2.793208009442517),-                                    ("daymonth", -1.9459101490553135),-                                    ("named-daylast <cycle>", -3.1986731175506815),-                                    ("on <date>hh:mm", -3.1986731175506815),-                                    ("named-dayhh:mm", -2.793208009442517),-                                    ("intersectnamed-month", -2.793208009442517),+                                   [("named-daynamed-month", -3.028522096376982),+                                    ("daymonth", -2.181224235989778),+                                    ("named-daylast <cycle>", -3.4339872044851463),+                                    ("on <date>hh:mm", -3.4339872044851463),+                                    ("named-dayhh:mm", -3.028522096376982),+                                    ("dayday", -2.517696472610991),+                                    ("intersectnamed-month", -3.028522096376982),+                                    ("absorption of , after named day<day-of-month>(ordinal) <named-month>",+                                     -3.4339872044851463),+                                    ("absorption of , after named day<day-of-month>(ordinal) <named-month> year",+                                     -3.4339872044851463),                                     ("named-day<time-of-day> - <time-of-day> (interval)",-                                     -2.793208009442517),+                                     -3.028522096376982),                                     ("named-day<datetime> - <datetime> (interval)",-                                     -2.793208009442517),+                                     -3.028522096376982),                                     ("on <date><time-of-day> - <time-of-day> (interval)",-                                     -3.1986731175506815),+                                     -3.4339872044851463),                                     ("on <date><datetime> - <datetime> (interval)",-                                     -3.1986731175506815),-                                    ("named-daynext <cycle>", -3.1986731175506815),-                                    ("named-dayintersect", -3.1986731175506815),-                                    ("dayminute", -1.589235205116581),-                                    ("intersectintersect", -3.1986731175506815),-                                    ("dayweek", -2.793208009442517)],-                               n = 17},+                                     -3.4339872044851463),+                                    ("named-daynext <cycle>", -3.4339872044851463),+                                    ("named-dayintersect", -3.4339872044851463),+                                    ("absorption of , after named day<day-of-month> (ordinal)",+                                     -3.4339872044851463),+                                    ("dayminute", -1.824549292051046),+                                    ("absorption of , after named dayintersect",+                                     -3.4339872044851463),+                                    ("intersectintersect", -3.4339872044851463),+                                    ("dayweek", -3.028522096376982)],+                               n = 21},                    koData =-                     ClassData{prior = -0.8823891801984737,-                               unseen = -3.6888794541139363,+                     ClassData{prior = -1.0116009116784799,+                               unseen = -3.8066624897703196,                                likelihoods =                                  HashMap.fromList-                                   [("named-daynamed-month", -2.0541237336955462),-                                    ("daymonth", -1.3609765531356008),-                                    ("intersectnamed-month", -2.5649493574615367),+                                   [("named-daynamed-month", -2.174751721484161),+                                    ("daymonth", -1.4816045409242156),+                                    ("intersectnamed-month", -2.6855773452501515),                                     ("named-day<time-of-day> - <time-of-day> (interval)",-                                     -2.5649493574615367),+                                     -2.6855773452501515),                                     ("on <date><time-of-day> - <time-of-day> (interval)",-                                     -2.9704144655697013),-                                    ("named-dayintersect", -2.277267285009756),-                                    ("dayminute", -2.277267285009756)],+                                     -3.0910424533583156),+                                    ("named-dayintersect", -2.3978952727983707),+                                    ("dayminute", -2.3978952727983707)],                                n = 12}}),        ("<duration> ago",         Classifier{okData =@@ -1335,7 +1382,7 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<day-of-month> (ordinal)",         Classifier{okData =-                     ClassData{prior = -0.6390799592896695,+                     ClassData{prior = -0.3513978868378886,                                unseen = -3.0910424533583156,                                likelihoods =                                  HashMap.fromList@@ -1343,12 +1390,13 @@                                     ("ordinal (digits)", -0.2113090936672069)],                                n = 19},                    koData =-                     ClassData{prior = -0.750305594399894, unseen = -2.995732273553991,+                     ClassData{prior = -1.2163953243244932,+                               unseen = -2.3978952727983707,                                likelihoods =                                  HashMap.fromList-                                   [("ordinals (first..19th)", -0.9985288301111273),-                                    ("ordinal (digits)", -0.4595323293784402)],-                               n = 17}}),+                                   [("ordinals (first..19th)", -0.35667494393873245),+                                    ("ordinal (digits)", -1.2039728043259361)],+                               n = 8}}),        ("noon",         Classifier{okData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,@@ -1358,20 +1406,21 @@                                likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),        ("until <time-of-day>",         Classifier{okData =-                     ClassData{prior = -0.3022808718729337, unseen = -3.912023005428146,+                     ClassData{prior = -0.25131442828090605,+                               unseen = -4.060443010546419,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day>", -1.9459101490553135),-                                    ("<time-of-day>  o'clock", -2.505525936990736),-                                    ("intersect", -3.1986731175506815),-                                    ("time-of-day (latent)", -2.2823823856765264),-                                    ("<time-of-day> am|pm", -3.1986731175506815),-                                    ("EOM|End of month", -3.1986731175506815),-                                    ("hour", -1.0586069540544105), ("month", -3.1986731175506815),-                                    ("midnight|EOD|end of day", -3.1986731175506815)],-                               n = 17},+                                   [("<time> <part-of-day>", -2.097141118779237),+                                    ("<time-of-day>  o'clock", -2.2512917986064953),+                                    ("intersect", -3.349904087274605),+                                    ("time-of-day (latent)", -2.097141118779237),+                                    ("<time-of-day> am|pm", -3.349904087274605),+                                    ("EOM|End of month", -3.349904087274605),+                                    ("hour", -0.9985288301111273), ("month", -3.349904087274605),+                                    ("midnight|EOD|end of day", -3.349904087274605)],+                               n = 21},                    koData =-                     ClassData{prior = -1.3437347467010947, unseen = -3.332204510175204,+                     ClassData{prior = -1.5040773967762742, unseen = -3.332204510175204,                                likelihoods =                                  HashMap.fromList                                    [("intersect", -2.6026896854443837),@@ -1410,6 +1459,17 @@                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("<time-of-day> until",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -1.6094379124341003,+                               likelihoods =+                                 HashMap.fromList+                                   [("<time-of-day>  o'clock", -0.6931471805599453),+                                    ("hour", -0.6931471805599453)],+                               n = 1},+                   koData =+                     ClassData{prior = -infinity, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("next <time>",         Classifier{okData =                      ClassData{prior = -1.466337068793427, unseen = -2.9444389791664407,@@ -1625,7 +1685,7 @@                                n = 1}}),        ("<named-month> <day-of-month> (non ordinal)",         Classifier{okData =-                     ClassData{prior = -6.453852113757118e-2,+                     ClassData{prior = -0.12516314295400605,                                unseen = -3.4965075614664802,                                likelihoods =                                  HashMap.fromList@@ -1633,12 +1693,13 @@                                     ("month", -0.6931471805599453)],                                n = 15},                    koData =-                     ClassData{prior = -2.772588722239781, unseen = -1.6094379124341003,+                     ClassData{prior = -2.1400661634962708,+                               unseen = -1.9459101490553135,                                likelihoods =                                  HashMap.fromList                                    [("named-monthinteger (numeric)", -0.6931471805599453),                                     ("month", -0.6931471805599453)],-                               n = 1}}),+                               n = 2}}),        ("<day-of-month> (non ordinal) <named-month>",         Classifier{okData =                      ClassData{prior = -1.0986122886681098,@@ -1667,15 +1728,24 @@                    koData =                      ClassData{prior = -infinity, unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("<time-of-day> after",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -1.6094379124341003,+                               likelihoods =+                                 HashMap.fromList+                                   [("<time-of-day>  o'clock", -0.6931471805599453),+                                    ("hour", -0.6931471805599453)],+                               n = 1},+                   koData =+                     ClassData{prior = -infinity, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("ordinal (digits)",         Classifier{okData =-                     ClassData{prior = -0.40546510810816444,-                               unseen = -2.995732273553991,+                     ClassData{prior = 0.0, unseen = -2.995732273553991,                                likelihoods = HashMap.fromList [("", 0.0)], n = 18},                    koData =-                     ClassData{prior = -1.0986122886681098,-                               unseen = -2.3978952727983707,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 9}}),+                     ClassData{prior = -infinity, unseen = -0.6931471805599453,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("quarter (grain)",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.791759469228055,@@ -1700,12 +1770,12 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<day-of-month>(ordinal) <named-month> year",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.9459101490553135,+                     ClassData{prior = 0.0, unseen = -2.3978952727983707,                                likelihoods =                                  HashMap.fromList                                    [("ordinal (digits)named-month", -0.6931471805599453),                                     ("month", -0.6931471805599453)],-                               n = 2},+                               n = 4},                    koData =                      ClassData{prior = -infinity, unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -1725,15 +1795,15 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("after <time-of-day>",         Classifier{okData =-                     ClassData{prior = -0.6931471805599453, unseen = -3.044522437723423,+                     ClassData{prior = -0.4700036292457356, unseen = -3.367295829986474,                                likelihoods =                                  HashMap.fromList-                                   [("<time-of-day>  o'clock", -1.6094379124341003),-                                    ("time-of-day (latent)", -1.6094379124341003),-                                    ("hour", -1.0498221244986778)],-                               n = 6},+                                   [("<time-of-day>  o'clock", -1.540445040947149),+                                    ("time-of-day (latent)", -1.540445040947149),+                                    ("hour", -0.9343092373768334)],+                               n = 10},                    koData =-                     ClassData{prior = -0.6931471805599453, unseen = -3.044522437723423,+                     ClassData{prior = -0.9808292530117262, unseen = -3.044522437723423,                                likelihoods =                                  HashMap.fromList                                    [("<time-of-day>  o'clock", -2.3025850929940455),
Duckling/Ranking/Classifiers/EN.hs view
@@ -59,11 +59,11 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("integer (numeric)",         Classifier{okData =-                     ClassData{prior = -0.840653317668535, unseen = -5.030437921392435,+                     ClassData{prior = -0.8463513387831728, unseen = -5.030437921392435,                                likelihoods = HashMap.fromList [("", 0.0)], n = 151},                    koData =-                     ClassData{prior = -0.5646283297589669, unseen = -5.303304908059076,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 199}}),+                     ClassData{prior = -0.5603262675390213, unseen = -5.313205979041787,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 201}}),        ("<duration> hence|ago",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -3.784189633918261,@@ -169,42 +169,41 @@                                n = 3}}),        ("<time> <part-of-day>",         Classifier{okData =-                     ClassData{prior = -0.10536051565782628,-                               unseen = -4.382026634673881,+                     ClassData{prior = -9.844007281325252e-2,+                               unseen = -4.430816798843313,                                likelihoods =                                  HashMap.fromList                                    [("<day-of-month> (ordinal)in|during the <part-of-day>",-                                     -3.676300671907076),-                                    ("dayhour", -1.5968591302272404),-                                    ("Mondayearly morning", -3.270835563798912),-                                    ("time-of-day (latent)tonight", -3.270835563798912),-                                    ("hourhour", -2.2900063107871858),+                                     -3.7256934272366524),+                                    ("dayhour", -1.5284688499004333),+                                    ("Mondayearly morning", -3.3202283191284883),+                                    ("time-of-day (latent)tonight", -3.3202283191284883),+                                    ("hourhour", -2.339399066116762),                                     ("<time-of-day> o'clockin|during the <part-of-day>",-                                     -3.676300671907076),-                                    ("todaypart of days", -3.676300671907076),-                                    ("minutehour", -2.5776883832389665),+                                     -3.7256934272366524),+                                    ("todaypart of days", -3.7256934272366524),+                                    ("minutehour", -2.627081138568543),                                     ("at <time-of-day>in|during the <part-of-day>",-                                     -3.270835563798912),-                                    ("time-of-day (latent)this <part-of-day>", -3.676300671907076),-                                    ("Mondayin|during the <part-of-day>", -3.676300671907076),-                                    ("intersectpart of days", -3.676300671907076),-                                    ("intersectin|during the <part-of-day>", -3.676300671907076),+                                     -3.3202283191284883),+                                    ("time-of-day (latent)this <part-of-day>", -3.7256934272366524),+                                    ("Mondayin|during the <part-of-day>", -3.7256934272366524),+                                    ("intersectpart of days", -3.7256934272366524),+                                    ("intersectin|during the <part-of-day>", -3.7256934272366524),                                     ("<day-of-month> (ordinal or number) of <named-month>in|during the <part-of-day>",-                                     -3.676300671907076),+                                     -3.7256934272366524),                                     ("the <day-of-month> (ordinal)in|during the <part-of-day>",-                                     -3.676300671907076),-                                    ("tomorrowpart of days", -2.5776883832389665),-                                    ("hh:mmin|during the <part-of-day>", -2.9831534913471307),+                                     -3.7256934272366524),+                                    ("tomorrowpart of days", -2.339399066116762),+                                    ("hh:mmin|during the <part-of-day>", -3.0325462466767075),                                     ("time-of-day (latent)in|during the <part-of-day>",-                                     -3.676300671907076),+                                     -3.7256934272366524),                                     ("hhmm (latent)in|during the <part-of-day>",-                                     -3.676300671907076),-                                    ("yesterdaypart of days", -3.676300671907076),-                                    ("Mondaypart of days", -3.676300671907076)],-                               n = 27},+                                     -3.7256934272366524),+                                    ("yesterdaypart of days", -3.7256934272366524),+                                    ("Mondaypart of days", -3.7256934272366524)],+                               n = 29},                    koData =-                     ClassData{prior = -2.3025850929940455,-                               unseen = -3.4657359027997265,+                     ClassData{prior = -2.367123614131617, unseen = -3.4657359027997265,                                likelihoods =                                  HashMap.fromList                                    [("yearhour", -2.740840023925201),@@ -225,11 +224,10 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("mm/dd",         Classifier{okData =-                     ClassData{prior = -1.6739764335716716,-                               unseen = -1.6094379124341003,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 3},+                     ClassData{prior = -1.4469189829363254, unseen = -1.791759469228055,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 4},                    koData =-                     ClassData{prior = -0.2076393647782445, unseen = -2.70805020110221,+                     ClassData{prior = -0.2682639865946794, unseen = -2.70805020110221,                                likelihoods = HashMap.fromList [("", 0.0)], n = 13}}),        ("at <time-of-day>",         Classifier{okData =@@ -1103,8 +1101,8 @@                                n = 1}}),        ("tomorrow",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.833213344056216,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 15},+                     ClassData{prior = 0.0, unseen = -2.9444389791664407,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 17},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -1214,6 +1212,13 @@                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("fractional number",+        Classifier{okData =+                     ClassData{prior = -infinity, unseen = -0.6931471805599453,+                               likelihoods = HashMap.fromList [], n = 0},+                   koData =+                     ClassData{prior = 0.0, unseen = -2.890371757896165,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 16}}),        ("Sunday",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.3025850929940455,@@ -1384,6 +1389,16 @@                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("part of <named-month>",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -2.1972245773362196,+                               likelihoods =+                                 HashMap.fromList+                                   [("March", -0.6931471805599453), ("month", -0.6931471805599453)],+                               n = 3},+                   koData =+                     ClassData{prior = -infinity, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("a <unit-of-duration>",         Classifier{okData =                      ClassData{prior = -0.6286086594223742,@@ -1616,8 +1631,8 @@                                n = 18}}),        ("March",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.772588722239781,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 14},+                     ClassData{prior = 0.0, unseen = -2.9444389791664407,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 17},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -2094,11 +2109,11 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("part of days",         Classifier{okData =-                     ClassData{prior = -4.445176257083381e-2,-                               unseen = -3.1780538303479458,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 22},+                     ClassData{prior = -4.0821994520255166e-2,+                               unseen = -3.258096538021482,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 24},                    koData =-                     ClassData{prior = -3.1354942159291497,+                     ClassData{prior = -3.2188758248682006,                                unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),        ("this <time>",
Duckling/Ranking/Classifiers/HR.hs view
@@ -221,27 +221,25 @@                                n = 5}}),        ("between <datetime> and <datetime> (interval)",         Classifier{okData =-                     ClassData{prior = -0.916290731874155, unseen = -3.044522437723423,+                     ClassData{prior = -0.8472978603872037, unseen = -2.995732273553991,                                likelihoods =                                  HashMap.fromList-                                   [("minuteminute", -1.2039728043259361),+                                   [("minuteminute", -1.1526795099383855),                                     ("time-of-day (latent)time-of-day (latent)",-                                     -2.3025850929940455),-                                    ("hh:mmhh:mm", -1.2039728043259361),-                                    ("hourhour", -2.3025850929940455)],+                                     -2.2512917986064953),+                                    ("hh:mmhh:mm", -1.1526795099383855),+                                    ("hourhour", -2.2512917986064953)],                                n = 6},                    koData =-                     ClassData{prior = -0.5108256237659907, unseen = -3.295836866004329,+                     ClassData{prior = -0.5596157879354228,+                               unseen = -3.1780538303479458,                                likelihoods =                                  HashMap.fromList-                                   [("hh:mmtime-of-day (latent)", -1.466337068793427),-                                    ("minuteminute", -1.8718021769015913),-                                    ("hourhour", -2.5649493574615367),-                                    ("minutehour", -1.466337068793427),-                                    ("hh:mmintersect", -1.8718021769015913),-                                    ("time-of-day (latent)<time> <part-of-day>",-                                     -2.5649493574615367)],-                               n = 9}}),+                                   [("hh:mmtime-of-day (latent)", -1.3437347467010947),+                                    ("minuteminute", -1.749199854809259),+                                    ("minutehour", -1.3437347467010947),+                                    ("hh:mmintersect", -1.749199854809259)],+                               n = 8}}),        ("month (grain)",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.4849066497880004,@@ -304,7 +302,7 @@                                n = 2}}),        ("intersect",         Classifier{okData =-                     ClassData{prior = -0.5171347929592555, unseen = -6.049733455231958,+                     ClassData{prior = -0.5133540701193493, unseen = -6.049733455231958,                                likelihoods =                                  HashMap.fromList                                    [("u <named-day><day-of-month>(ordinal) <named-month>",@@ -411,89 +409,90 @@                                     ("yearminute", -5.354224998486333)],                                n = 158},                    koData =-                     ClassData{prior = -0.906900991524316, unseen = -5.7745515455444085,+                     ClassData{prior = -0.9125100090342491, unseen = -5.768320995793772,                                likelihoods =                                  HashMap.fromList-                                   [("since <time-of-day>by <time>", -4.385146762010125),+                                   [("since <time-of-day>by <time>", -4.378896741664954),                                     ("year<time-of-day> - <time-of-day> (interval)",-                                     -5.07829394257007),-                                    ("hourday", -4.162003210695915),-                                    ("dayhour", -3.1323837935147574),-                                    ("named-monthnamed-day", -3.979681653901961),-                                    ("daymonth", -2.9382277790737996),-                                    ("monthday", -3.69199958145018),-                                    ("monthyear", -3.4688560301359703),-                                    ("yearhour", -4.672828834461907),+                                     -5.072043922224899),+                                    ("hourday", -4.155753190350744),+                                    ("dayhour", -3.200241745323308),+                                    ("named-monthnamed-day", -3.9734316335567894),+                                    ("daymonth", -2.9319777587286286),+                                    ("monthday", -3.6857495611050086),+                                    ("monthyear", -3.462606009790799),+                                    ("yearhour", -4.666578814116735),                                     ("named-month<hour-of-day> <integer> (as relative minutes)",-                                     -5.07829394257007),-                                    ("hh:mmu <named-day>", -3.979681653901961),-                                    ("last <time>today", -4.385146762010125),-                                    ("intersectat <time-of-day>", -5.07829394257007),-                                    ("named-daysince <time-of-day>", -4.162003210695915),-                                    ("until <time-of-day>u <named-day>", -5.07829394257007),-                                    ("since <time-of-day>u <named-day>", -4.672828834461907),-                                    ("<time> <part-of-day>named-day", -5.07829394257007),-                                    ("dayday", -3.979681653901961),-                                    ("<time> <part-of-day>at <time-of-day>", -5.07829394257007),-                                    ("named-monthnamed-month", -4.385146762010125),-                                    ("monthmonth", -4.162003210695915),-                                    ("hourhour", -5.07829394257007),-                                    ("intersectnamed-month", -4.672828834461907),-                                    ("dayyear", -4.385146762010125),-                                    ("named-dayu <named-month>", -4.162003210695915),+                                     -5.072043922224899),+                                    ("hh:mmu <named-day>", -3.9734316335567894),+                                    ("last <time>today", -4.378896741664954),+                                    ("intersectat <time-of-day>", -5.072043922224899),+                                    ("named-daysince <time-of-day>", -4.155753190350744),+                                    ("until <time-of-day>u <named-day>", -5.072043922224899),+                                    ("since <time-of-day>u <named-day>", -4.666578814116735),+                                    ("<time> <part-of-day>named-day", -5.072043922224899),+                                    ("dayday", -3.9734316335567894),+                                    ("<time> <part-of-day>at <time-of-day>", -5.072043922224899),+                                    ("named-monthnamed-month", -4.378896741664954),+                                    ("monthmonth", -4.155753190350744),+                                    ("hourhour", -5.072043922224899),+                                    ("intersectnamed-month", -4.666578814116735),+                                    ("dayyear", -4.378896741664954),+                                    ("named-dayu <named-month>", -4.155753190350744),                                     ("<time-of-day> - <time-of-day> (interval)u <named-day>",-                                     -5.07829394257007),+                                     -5.072043922224899),                                     ("year<hour-of-day> <integer> (as relative minutes)",-                                     -4.672828834461907),-                                    ("monthminute", -4.672828834461907),+                                     -4.666578814116735),+                                    ("monthminute", -4.666578814116735),                                     ("absorption of , after named day<day-of-month>(ordinal) <named-month>",-                                     -5.07829394257007),-                                    ("minutemonth", -4.672828834461907),+                                     -5.072043922224899),+                                    ("minutemonth", -4.666578814116735),                                     ("absorption of , after named day<named-month> <day-of-month> (ordinal)",-                                     -5.07829394257007),+                                     -5.072043922224899),                                     ("intersect<time-of-day> - <time-of-day> (interval)",-                                     -5.07829394257007),-                                    ("named-monthyear", -4.385146762010125),+                                     -5.072043922224899),+                                    ("named-monthyear", -4.378896741664954),                                     ("absorption of , after named day<named-month> <day-of-month> (non ordinal)",-                                     -4.385146762010125),+                                     -4.378896741664954),                                     ("absorption of , after named daynamed-month",-                                     -3.979681653901961),+                                     -3.9734316335567894),                                     ("intersect by \",\"<time-of-day> - <time-of-day> (interval)",-                                     -4.162003210695915),-                                    ("named-dayafter <time-of-day>", -4.162003210695915),-                                    ("named-dayintersect", -4.385146762010125),-                                    ("dayminute", -3.0633909220278057),-                                    ("<time> <part-of-day>intersect", -4.672828834461907),-                                    ("intersectyear", -4.162003210695915),-                                    ("after <time-of-day>by <time>", -4.385146762010125),-                                    ("minuteday", -3.0633909220278057),-                                    ("absorption of , after named dayintersect", -5.07829394257007),+                                     -4.155753190350744),+                                    ("named-dayafter <time-of-day>", -4.155753190350744),+                                    ("named-dayintersect", -4.378896741664954),+                                    ("dayminute", -3.0571409016826343),+                                    ("<time> <part-of-day>intersect", -4.666578814116735),+                                    ("intersectyear", -4.155753190350744),+                                    ("after <time-of-day>by <time>", -4.378896741664954),+                                    ("minuteday", -3.0571409016826343),+                                    ("absorption of , after named dayintersect",+                                     -5.072043922224899),                                     ("named-daybetween <time-of-day> and <time-of-day> (interval)",-                                     -4.672828834461907),+                                     -4.666578814116735),                                     ("named-monthnumeral to|till|before <integer> (hour-of-day)",-                                     -5.07829394257007),-                                    ("<time> <part-of-day>intersect by \",\"", -5.07829394257007),-                                    ("named-day<time> <part-of-day>", -4.672828834461907),+                                     -5.072043922224899),+                                    ("<time> <part-of-day>intersect by \",\"", -5.072043922224899),+                                    ("named-day<time> <part-of-day>", -4.666578814116735),                                     ("named-daybetween <datetime> and <datetime> (interval)",-                                     -4.385146762010125),-                                    ("intersect by \",\"at <time-of-day>", -4.162003210695915),+                                     -4.666578814116735),+                                    ("intersect by \",\"at <time-of-day>", -4.155753190350744),                                     ("absorption of , after named dayintersect by \",\"",-                                     -5.07829394257007),-                                    ("yearat <time-of-day>", -5.07829394257007),+                                     -5.072043922224899),+                                    ("yearat <time-of-day>", -5.072043922224899),                                     ("named-month<day-of-month> (non ordinal) <named-month>",-                                     -4.672828834461907),+                                     -4.666578814116735),                                     ("<named-month> <day-of-month> (non ordinal)named-month",-                                     -4.672828834461907),-                                    ("u <named-day>named-month", -5.07829394257007),+                                     -4.666578814116735),+                                    ("u <named-day>named-month", -5.072043922224899),                                     ("<named-day> <day-of-month> (ordinal)named-month",-                                     -5.07829394257007),-                                    ("after <time-of-day>u <named-day>", -4.672828834461907),-                                    ("named-monthintersect", -5.07829394257007),-                                    ("hh:mmby <time>", -4.385146762010125),-                                    ("u <named-month>year", -3.979681653901961),-                                    ("minutesecond", -3.4688560301359703),-                                    ("yearminute", -4.672828834461907)],-                               n = 107}}),+                                     -5.072043922224899),+                                    ("after <time-of-day>u <named-day>", -4.666578814116735),+                                    ("named-monthintersect", -5.072043922224899),+                                    ("hh:mmby <time>", -4.378896741664954),+                                    ("u <named-month>year", -3.9734316335567894),+                                    ("minutesecond", -3.462606009790799),+                                    ("yearminute", -4.666578814116735)],+                               n = 106}}),        ("early morning",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.791759469228055,@@ -883,23 +882,23 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("by <time>",         Classifier{okData =-                     ClassData{prior = -2.70805020110221, unseen = -2.3978952727983707,+                     ClassData{prior = -2.5649493574615367,+                               unseen = -2.3025850929940455,                                likelihoods =                                  HashMap.fromList-                                   [("hour", -1.6094379124341003),-                                    ("midnight|EOD|end of day", -1.6094379124341003)],+                                   [("hour", -1.5040773967762742),+                                    ("midnight|EOD|end of day", -1.5040773967762742)],                                n = 1},                    koData =-                     ClassData{prior = -6.899287148695143e-2,-                               unseen = -3.6109179126442243,+                     ClassData{prior = -8.004270767353637e-2,+                               unseen = -3.4657359027997265,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day>", -2.4849066497880004),-                                    ("intersect", -2.890371757896165),-                                    ("time-of-day (latent)", -1.6376087894007967),-                                    ("hh:mm", -2.1972245773362196), ("noon", -2.4849066497880004),-                                    ("hour", -1.1856236656577395), ("minute", -1.9740810260220096)],-                               n = 14}}),+                                   [("intersect", -2.740840023925201),+                                    ("time-of-day (latent)", -1.488077055429833),+                                    ("hh:mm", -2.0476928433652555), ("noon", -2.3353749158170367),+                                    ("hour", -1.2367626271489267), ("minute", -1.824549292051046)],+                               n = 12}}),        ("half an hour",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.0794415416798357,
Duckling/Ranking/Classifiers/KO.hs view
@@ -64,13 +64,6 @@                                    [("integer - TYPE 1: powers of teninteger (21..99) - TYPE 2",                                      -0.40546510810816444)],                                n = 1}}),-       ("the day after tomorrow - \45236\51068\47784\47000",-        Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.3862943611198906,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},-                   koData =-                     ClassData{prior = -infinity, unseen = -0.6931471805599453,-                               likelihoods = HashMap.fromList [], n = 0}}),        ("<time> <part-of-day>",         Classifier{okData =                      ClassData{prior = -0.8472978603872037, unseen = -4.143134726391533,@@ -1369,6 +1362,13 @@                      ClassData{prior = -0.37037378829689427,                                unseen = -3.4339872044851463,                                likelihoods = HashMap.fromList [("", 0.0)], n = 29}}),+       ("the day after tomorrow - \45236\51068\47784\47112",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -1.3862943611198906,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},+                   koData =+                     ClassData{prior = -infinity, unseen = -0.6931471805599453,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("compose by multiplication",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.791759469228055,
Duckling/Ranking/Classifiers/PL.hs view
@@ -87,42 +87,42 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<time> <part-of-day>",         Classifier{okData =-                     ClassData{prior = -0.7392382877602123, unseen = -5.003946305945459,+                     ClassData{prior = -0.7810085363512795, unseen = -4.948759890378168,                                likelihoods =                                  HashMap.fromList-                                   [("<ordinal> (as hour)after <time-of-day>", -3.6109179126442243),-                                    ("dayhour", -3.0513021247088017),-                                    ("<ordinal> (as hour)evening|night", -2.5993170009657445),-                                    ("<ordinal> (as hour)on <date>", -4.304065093204169),-                                    ("yesterdayevening|night", -4.304065093204169),-                                    ("hourhour", -1.1470646720540565),-                                    ("after <time-of-day>after <time-of-day>", -3.898599985096005),-                                    ("until <time-of-day>morning", -3.898599985096005),-                                    ("until <time-of-day>after <time-of-day>", -4.304065093204169),-                                    ("minutehour", -4.304065093204169),-                                    ("named-daymorning", -4.304065093204169),-                                    ("todayevening|night", -4.304065093204169),-                                    ("at <time-of-day>evening|night", -4.304065093204169),-                                    ("named-dayevening|night", -4.304065093204169),-                                    ("intersecton <date>", -4.304065093204169),+                                   [("<ordinal> (as hour)after <time-of-day>", -3.5553480614894135),+                                    ("dayhour", -2.995732273553991),+                                    ("<ordinal> (as hour)evening|night", -2.5437471498109336),+                                    ("<ordinal> (as hour)on <date>", -4.248495242049359),+                                    ("yesterdayevening|night", -4.248495242049359),+                                    ("hourhour", -1.180442306915742),+                                    ("after <time-of-day>after <time-of-day>", -3.8430301339411947),+                                    ("until <time-of-day>morning", -3.8430301339411947),+                                    ("until <time-of-day>after <time-of-day>", -4.248495242049359),+                                    ("minutehour", -4.248495242049359),+                                    ("named-daymorning", -4.248495242049359),+                                    ("todayevening|night", -4.248495242049359),+                                    ("at <time-of-day>evening|night", -4.248495242049359),+                                    ("named-dayevening|night", -4.248495242049359),+                                    ("intersecton <date>", -4.248495242049359),                                     ("<integer> (latent time-of-day)this <part-of-day>",-                                     -4.304065093204169),-                                    ("hh:mmon <date>", -4.304065093204169),-                                    ("<integer> (latent time-of-day)morning", -3.20545280453606),-                                    ("at <time-of-day>on <date>", -4.304065093204169),-                                    ("intersectmorning", -3.0513021247088017),+                                     -4.248495242049359),+                                    ("hh:mmon <date>", -4.248495242049359),+                                    ("<integer> (latent time-of-day)morning", -3.5553480614894135),+                                    ("at <time-of-day>on <date>", -4.248495242049359),+                                    ("intersectmorning", -3.1498829533812494),                                     ("<integer> (latent time-of-day)evening|night",-                                     -3.0513021247088017),+                                     -2.995732273553991),                                     ("from <datetime> - <datetime> (interval)morning",-                                     -3.898599985096005),+                                     -4.248495242049359),                                     ("from <time-of-day> - <time-of-day> (interval)morning",-                                     -4.304065093204169),-                                    ("on <date>morning", -4.304065093204169),-                                    ("at <time-of-day>morning", -3.898599985096005),-                                    ("tomorrowevening|night", -3.898599985096005)],-                               n = 53},+                                     -4.248495242049359),+                                    ("on <date>morning", -4.248495242049359),+                                    ("at <time-of-day>morning", -3.8430301339411947),+                                    ("tomorrowevening|night", -3.8430301339411947)],+                               n = 49},                    koData =-                     ClassData{prior = -0.6490871907659148,+                     ClassData{prior = -0.6123858239154869,                                unseen = -5.0689042022202315,                                likelihoods =                                  HashMap.fromList@@ -146,11 +146,9 @@                                     ("by <time>morning", -4.3694478524670215),                                     ("<integer> (latent time-of-day)after <time-of-day>",                                      -3.963982744358857),-                                    ("<integer> (latent time-of-day)morning", -4.3694478524670215),+                                    ("<integer> (latent time-of-day)morning", -3.676300671907076),                                     ("secondhour", -3.1166848839716534),                                     ("intersectmorning", -3.4531571205928664),-                                    ("from <datetime> - <datetime> (interval)morning",-                                     -3.963982744358857),                                     ("year (latent)morning", -2.6646997602285962),                                     ("year (latent)after <time-of-day>", -3.963982744358857),                                     ("at <time-of-day>after <time-of-day>", -4.3694478524670215)],@@ -394,144 +392,145 @@                                n = 1}}),        ("intersect",         Classifier{okData =-                     ClassData{prior = -0.7200546334798696, unseen = -6.364750756851911,+                     ClassData{prior = -0.7319205664859061,+                               unseen = -6.3473892096560105,                                likelihoods =                                  HashMap.fromList                                    [("<datetime> - <datetime> (interval)on <date>",-                                     -5.264415814872355),+                                     -5.247024072160486),                                     ("mm/dd<time-of-day> popo\322udniu/wieczorem/w nocy",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("<hour-of-day> - <hour-of-day> (interval)on <date>",-                                     -5.264415814872355),-                                    ("named-daynamed-month", -4.7535901911063645),+                                     -5.247024072160486),+                                    ("named-daynamed-month", -4.736198448394496),                                     ("<time-of-day> - <time-of-day> (interval)on <date>",-                                     -5.264415814872355),-                                    ("hourday", -3.8781214537524646),-                                    ("dayhour", -2.6741486494265287),-                                    ("daymonth", -3.8781214537524646),+                                     -5.247024072160486),+                                    ("hourday", -3.8607297110405954),+                                    ("dayhour", -2.790288299339182),+                                    ("daymonth", -3.8607297110405954),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocyabsorption of , after named day",-                                     -4.7535901911063645),-                                    ("monthyear", -3.1849742731925192),+                                     -4.736198448394496),+                                    ("monthyear", -3.1675825304806504),                                     ("from <hour-of-day> - <hour-of-day> (interval)on a named-day",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("from <time-of-day> - <time-of-day> (interval)on a named-day",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("absorption of , after named dayintersect by \",\" 2",-                                     -5.264415814872355),-                                    ("intersecthh:mm", -5.264415814872355),+                                     -5.247024072160486),+                                    ("intersecthh:mm", -5.247024072160486),                                     ("from <datetime> - <datetime> (interval)on a named-day",-                                     -5.66988092298052),-                                    ("at <time-of-day>intersect by \",\" 2", -5.264415814872355),-                                    ("named-daylast <cycle>", -5.264415814872355),-                                    ("named-day<time-of-day> rano", -5.66988092298052),-                                    ("on a named-dayat <time-of-day>", -5.264415814872355),-                                    ("at <time-of-day>named-day", -5.264415814872355),-                                    ("at <time-of-day>on a named-day", -5.66988092298052),-                                    ("<time> <part-of-day>on a named-day", -5.264415814872355),-                                    ("on a named-day<time> <part-of-day>", -5.66988092298052),-                                    ("last <day-of-week> of <time>year", -5.66988092298052),-                                    ("today<time> <part-of-day>", -5.66988092298052),-                                    ("todayat <time-of-day>", -5.66988092298052),-                                    ("on <date>at <time-of-day>", -5.264415814872355),-                                    ("dayday", -2.995732273553991),-                                    ("on <date><time> <part-of-day>", -5.66988092298052),-                                    ("intersect by \",\"hh:mm", -4.4171179544851515),-                                    ("mm/ddat <time-of-day>", -4.976733742420574),-                                    ("last <cycle> <time>year", -4.7535901911063645),+                                     -5.652489180268651),+                                    ("at <time-of-day>intersect by \",\" 2", -5.247024072160486),+                                    ("named-daylast <cycle>", -5.247024072160486),+                                    ("named-day<time-of-day> rano", -5.652489180268651),+                                    ("on a named-dayat <time-of-day>", -5.247024072160486),+                                    ("at <time-of-day>named-day", -5.247024072160486),+                                    ("at <time-of-day>on a named-day", -5.652489180268651),+                                    ("<time> <part-of-day>on a named-day", -5.247024072160486),+                                    ("on a named-day<time> <part-of-day>", -5.652489180268651),+                                    ("last <day-of-week> of <time>year", -5.652489180268651),+                                    ("today<time> <part-of-day>", -5.652489180268651),+                                    ("todayat <time-of-day>", -5.652489180268651),+                                    ("on <date>at <time-of-day>", -5.247024072160486),+                                    ("dayday", -2.978340530842122),+                                    ("on <date><time> <part-of-day>", -5.652489180268651),+                                    ("intersect by \",\"hh:mm", -4.399726211773283),+                                    ("mm/ddat <time-of-day>", -4.959341999708705),+                                    ("last <cycle> <time>year", -4.736198448394496),                                     ("intersect<named-month> <day-of-month> (non ordinal)",-                                     -4.976733742420574),+                                     -4.959341999708705),                                     ("intersect<day-of-month> (non ordinal) <named-month>",-                                     -4.976733742420574),-                                    ("dayyear", -3.654977902438255),+                                     -4.959341999708705),+                                    ("dayyear", -3.6375861597263857),                                     ("<day-of-month>(ordinal) <named-month>year",-                                     -5.264415814872355),+                                     -5.247024072160486),                                     ("day-after-tomorrow (single-word)at <time-of-day>",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("absorption of , after named day<day-of-month>(ordinal) <named-month>",-                                     -4.165803526204246),+                                     -4.148411783492376),                                     ("tomorrow<time-of-day> popo\322udniu/wieczorem/w nocy",-                                     -5.66988092298052),-                                    ("named-monthyear", -3.529814759484249),+                                     -5.652489180268651),+                                    ("named-monthyear", -3.51242301677238),                                     ("absorption of , after named day<named-month> <day-of-month> (non ordinal)",-                                     -4.283586561860629),-                                    ("tomorrowuntil <time-of-day>", -5.264415814872355),+                                     -4.26619481914876),+                                    ("tomorrowuntil <time-of-day>", -5.247024072160486),                                     ("absorption of , after named day<day-of-month> (non ordinal) <named-month>",-                                     -4.165803526204246),+                                     -4.148411783492376),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocyintersect by \",\"",-                                     -4.7535901911063645),-                                    ("named-dayin <duration>", -5.66988092298052),-                                    ("last <day-of-week> <time>year", -5.264415814872355),-                                    ("<time-of-day> ranoon <date>", -5.264415814872355),+                                     -4.736198448394496),+                                    ("named-dayin <duration>", -5.652489180268651),+                                    ("last <day-of-week> <time>year", -5.247024072160486),+                                    ("<time-of-day> ranoon <date>", -5.247024072160486),                                     ("named-dayfrom <datetime> - <datetime> (interval)",-                                     -4.283586561860629),-                                    ("named-daynext <cycle>", -4.7535901911063645),-                                    ("named-dayintersect", -5.264415814872355),+                                     -4.959341999708705),+                                    ("named-daynext <cycle>", -4.736198448394496),+                                    ("named-dayintersect", -5.247024072160486),                                     ("named-dayfrom <time-of-day> - <time-of-day> (interval)",-                                     -4.976733742420574),-                                    ("on <date><time-of-day> rano", -5.66988092298052),+                                     -4.959341999708705),+                                    ("on <date><time-of-day> rano", -5.652489180268651),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocytomorrow",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("from <time-of-day> - <time-of-day> (interval)on <date>",-                                     -5.66988092298052),-                                    ("at <time-of-day>intersect", -5.264415814872355),-                                    ("dayminute", -3.318505665817042),-                                    ("intersect by \",\" 2hh:mm", -4.4171179544851515),-                                    ("<time-of-day> ranoon a named-day", -5.264415814872355),+                                     -5.652489180268651),+                                    ("at <time-of-day>intersect", -5.247024072160486),+                                    ("dayminute", -3.301113923105173),+                                    ("intersect by \",\" 2hh:mm", -4.399726211773283),+                                    ("<time-of-day> ranoon a named-day", -5.247024072160486),                                     ("from <hour-of-day> - <hour-of-day> (interval)on <date>",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("from <datetime> - <datetime> (interval)on <date>",-                                     -5.66988092298052),-                                    ("intersectyear", -5.264415814872355),-                                    ("on a named-day<time-of-day> rano", -5.66988092298052),-                                    ("<ordinal> <cycle> of <time>year", -5.66988092298052),-                                    ("minuteday", -2.3556949183079943),+                                     -5.652489180268651),+                                    ("intersectyear", -5.247024072160486),+                                    ("on a named-day<time-of-day> rano", -5.652489180268651),+                                    ("<ordinal> <cycle> of <time>year", -5.652489180268651),+                                    ("minuteday", -2.338303175596125),                                     ("absorption of , after named dayintersect",-                                     -5.264415814872355),-                                    ("named-dayon <date>", -4.060443010546419),-                                    ("named-day<time> <part-of-day>", -4.7535901911063645),-                                    ("named-dayat <time-of-day>", -5.264415814872355),-                                    ("yearhh:mm", -5.66988092298052),-                                    ("at <time-of-day>intersect by \",\"", -5.264415814872355),+                                     -5.247024072160486),+                                    ("named-dayon <date>", -4.04305126783455),+                                    ("named-day<time> <part-of-day>", -4.959341999708705),+                                    ("named-dayat <time-of-day>", -5.247024072160486),+                                    ("yearhh:mm", -5.652489180268651),+                                    ("at <time-of-day>intersect by \",\"", -5.247024072160486),                                     ("absorption of , after named dayintersect by \",\"",-                                     -5.264415814872355),-                                    ("tomorrowexactly <time-of-day>", -4.976733742420574),+                                     -5.247024072160486),+                                    ("tomorrowexactly <time-of-day>", -4.959341999708705),                                     ("at <time-of-day>absorption of , after named day",-                                     -5.264415814872355),-                                    ("at <time-of-day>on <date>", -5.66988092298052),-                                    ("on <date>year", -4.283586561860629),-                                    ("dayweek", -3.7239707739252066),-                                    ("<time> <part-of-day>on <date>", -5.264415814872355),-                                    ("weekyear", -4.4171179544851515),+                                     -5.247024072160486),+                                    ("at <time-of-day>on <date>", -5.652489180268651),+                                    ("on <date>year", -4.26619481914876),+                                    ("dayweek", -3.7065790312133373),+                                    ("<time> <part-of-day>on <date>", -5.247024072160486),+                                    ("weekyear", -4.399726211773283),                                     ("named-day<day-of-month>(ordinal) <named-month>",-                                     -4.976733742420574),-                                    ("<ordinal> <cycle> <time>year", -5.264415814872355),+                                     -4.959341999708705),+                                    ("<ordinal> <cycle> <time>year", -5.247024072160486),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocyintersect by \",\" 2",-                                     -4.7535901911063645),-                                    ("tomorrowat <time-of-day>", -5.66988092298052),-                                    ("named-daythis <cycle>", -5.264415814872355),-                                    ("tomorrow<time> <part-of-day>", -5.66988092298052),+                                     -4.736198448394496),+                                    ("tomorrowat <time-of-day>", -5.652489180268651),+                                    ("named-daythis <cycle>", -5.247024072160486),+                                    ("tomorrow<time> <part-of-day>", -5.652489180268651),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocyintersect",-                                     -4.7535901911063645),+                                     -4.736198448394496),                                     ("<named-month> <day-of-month> (ordinal)year",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("<time-of-day> popo\322udniu/wieczorem/w nocynamed-day",-                                     -4.7535901911063645),-                                    ("tomorrow<time-of-day> rano", -5.66988092298052),+                                     -4.736198448394496),+                                    ("tomorrow<time-of-day> rano", -5.652489180268651),                                     ("<datetime> - <datetime> (interval)on a named-day",-                                     -5.264415814872355),-                                    ("last <cycle> of <time>year", -5.264415814872355),+                                     -5.247024072160486),+                                    ("last <cycle> of <time>year", -5.247024072160486),                                     ("<named-month> <day-of-month> (non ordinal)year",-                                     -5.66988092298052),+                                     -5.652489180268651),                                     ("<time-of-day> - <time-of-day> (interval)on a named-day",-                                     -5.264415814872355),+                                     -5.247024072160486),                                     ("<day-of-month> (non ordinal) <named-month>year",-                                     -5.264415814872355),+                                     -5.247024072160486),                                     ("<hour-of-day> - <hour-of-day> (interval)on a named-day",-                                     -5.264415814872355),-                                    ("yearminute", -5.66988092298052)],-                               n = 220},+                                     -5.247024072160486),+                                    ("yearminute", -5.652489180268651)],+                               n = 215},                    koData =-                     ClassData{prior = -0.6669448081659212, unseen = -6.405228458030842,+                     ClassData{prior = -0.655821222947259, unseen = -6.405228458030842,                                likelihoods =                                  HashMap.fromList                                    [("<ordinal> (as hour)<named-month> <day-of-month> (non ordinal)",@@ -688,40 +687,25 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("from <datetime> - <datetime> (interval)",         Classifier{okData =-                     ClassData{prior = -0.7537718023763802,-                               unseen = -3.4339872044851463,+                     ClassData{prior = -0.6931471805599453, unseen = -2.833213344056216,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day><integer> (latent time-of-day)",-                                     -2.70805020110221),-                                    ("minuteminute", -2.3025850929940455),-                                    ("<time> <part-of-day><time> <part-of-day>", -2.70805020110221),-                                    ("<time-of-day> rano<time-of-day> rano", -2.70805020110221),-                                    ("hh:mmhh:mm", -2.3025850929940455),-                                    ("hourhour", -1.455287232606842),-                                    ("<time> <part-of-day><time-of-day> rano", -2.70805020110221),-                                    ("<time-of-day> rano<time> <part-of-day>", -2.70805020110221),+                                   [("minuteminute", -1.6739764335716716),+                                    ("<time-of-day> rano<time-of-day> rano", -2.0794415416798357),+                                    ("hh:mmhh:mm", -1.6739764335716716),+                                    ("hourhour", -1.6739764335716716),                                     ("<time-of-day> rano<integer> (latent time-of-day)",-                                     -2.70805020110221)],-                               n = 8},+                                     -2.0794415416798357)],+                               n = 4},                    koData =-                     ClassData{prior = -0.6359887667199967,-                               unseen = -3.4965075614664802,+                     ClassData{prior = -0.6931471805599453, unseen = -2.833213344056216,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day><integer> (latent time-of-day)",-                                     -2.772588722239781),-                                    ("houryear", -2.772588722239781),-                                    ("minuteminute", -2.367123614131617),-                                    ("<time> <part-of-day><time> <part-of-day>",-                                     -2.367123614131617),-                                    ("hourhour", -1.8562979903656263),-                                    ("minutehour", -2.367123614131617),-                                    ("hh:mmintersect", -2.367123614131617),-                                    ("<time> <part-of-day>year (latent)", -2.772588722239781),-                                    ("<time> <part-of-day><time-of-day> rano", -2.772588722239781),-                                    ("hh:mm<integer> (latent time-of-day)", -2.367123614131617)],-                               n = 9}}),+                                   [("minuteminute", -1.6739764335716716),+                                    ("minutehour", -1.6739764335716716),+                                    ("hh:mmintersect", -1.6739764335716716),+                                    ("hh:mm<integer> (latent time-of-day)", -1.6739764335716716)],+                               n = 4}}),        ("from <hour-of-day> - <hour-of-day> (interval)",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.6094379124341003,@@ -1193,23 +1177,22 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("by <time>",         Classifier{okData =-                     ClassData{prior = -infinity, unseen = -2.5649493574615367,+                     ClassData{prior = -infinity, unseen = -2.4849066497880004,                                likelihoods = HashMap.fromList [], n = 0},                    koData =-                     ClassData{prior = 0.0, unseen = -3.6635616461296463,+                     ClassData{prior = 0.0, unseen = -3.58351893845611,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day>", -2.9444389791664407),-                                    ("<ordinal> (as hour)", -2.538973871058276),-                                    ("year (latent)", -2.9444389791664407),-                                    ("<integer> (latent time-of-day)", -2.0281482472922856),-                                    ("day", -2.538973871058276), ("year", -2.9444389791664407),-                                    ("hh:mm", -2.9444389791664407),-                                    ("<day-of-month> (ordinal)", -2.538973871058276),-                                    ("noon", -2.9444389791664407),-                                    ("<time-of-day> rano", -2.9444389791664407),-                                    ("hour", -1.3350010667323402), ("minute", -2.9444389791664407)],-                               n = 13}}),+                                   [("<ordinal> (as hour)", -2.456735772821304),+                                    ("year (latent)", -2.8622008809294686),+                                    ("<integer> (latent time-of-day)", -1.9459101490553135),+                                    ("day", -2.456735772821304), ("year", -2.8622008809294686),+                                    ("hh:mm", -2.8622008809294686),+                                    ("<day-of-month> (ordinal)", -2.456735772821304),+                                    ("noon", -2.8622008809294686),+                                    ("<time-of-day> rano", -2.8622008809294686),+                                    ("hour", -1.3581234841531944), ("minute", -2.8622008809294686)],+                               n = 12}}),        ("seventh ordinal",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.3862943611198906,@@ -1822,23 +1805,22 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("by the end of <time>",         Classifier{okData =-                     ClassData{prior = -infinity, unseen = -2.5649493574615367,+                     ClassData{prior = -infinity, unseen = -2.4849066497880004,                                likelihoods = HashMap.fromList [], n = 0},                    koData =-                     ClassData{prior = 0.0, unseen = -3.6635616461296463,+                     ClassData{prior = 0.0, unseen = -3.58351893845611,                                likelihoods =                                  HashMap.fromList-                                   [("<time> <part-of-day>", -2.9444389791664407),-                                    ("<ordinal> (as hour)", -2.538973871058276),-                                    ("year (latent)", -2.9444389791664407),-                                    ("<integer> (latent time-of-day)", -2.0281482472922856),-                                    ("day", -2.538973871058276), ("year", -2.9444389791664407),-                                    ("hh:mm", -2.9444389791664407),-                                    ("<day-of-month> (ordinal)", -2.538973871058276),-                                    ("noon", -2.9444389791664407),-                                    ("<time-of-day> rano", -2.9444389791664407),-                                    ("hour", -1.3350010667323402), ("minute", -2.9444389791664407)],-                               n = 13}}),+                                   [("<ordinal> (as hour)", -2.456735772821304),+                                    ("year (latent)", -2.8622008809294686),+                                    ("<integer> (latent time-of-day)", -1.9459101490553135),+                                    ("day", -2.456735772821304), ("year", -2.8622008809294686),+                                    ("hh:mm", -2.8622008809294686),+                                    ("<day-of-month> (ordinal)", -2.456735772821304),+                                    ("noon", -2.8622008809294686),+                                    ("<time-of-day> rano", -2.8622008809294686),+                                    ("hour", -1.3581234841531944), ("minute", -2.8622008809294686)],+                               n = 12}}),        ("in <duration>",         Classifier{okData =                      ClassData{prior = -0.2231435513142097, unseen = -4.0943445622221,@@ -1867,41 +1849,36 @@                                n = 6}}),        ("<datetime> - <datetime> (interval)",         Classifier{okData =-                     ClassData{prior = -1.6739764335716716,-                               unseen = -3.4657359027997265,+                     ClassData{prior = -1.466337068793427, unseen = -3.367295829986474,                                likelihoods =                                  HashMap.fromList-                                   [("minuteminute", -1.824549292051046),-                                    ("hh:mmhh:mm", -1.824549292051046),-                                    ("dayday", -2.3353749158170367),+                                   [("minuteminute", -1.7227665977411035),+                                    ("hh:mmhh:mm", -1.7227665977411035),+                                    ("dayday", -2.2335922215070942),                                     ("<named-month> <day-of-month> (non ordinal)<named-month> <day-of-month> (non ordinal)",-                                     -2.3353749158170367)],+                                     -2.2335922215070942)],                                n = 6},                    koData =-                     ClassData{prior = -0.2076393647782445, unseen = -4.276666119016055,+                     ClassData{prior = -0.262364264467491, unseen = -4.04305126783455,                                likelihoods =                                  HashMap.fromList-                                   [("daymonth", -3.164067588373206),-                                    ("about <time-of-day>noon", -3.56953269648137),-                                    ("minuteminute", -2.4709204078132605),-                                    ("<time> <part-of-day><time> <part-of-day>",-                                     -2.8763855159214247),-                                    ("<time-of-day> rano<time-of-day> rano", -3.56953269648137),-                                    ("until <time-of-day>noon", -3.56953269648137),-                                    ("hh:mmhh:mm", -3.56953269648137),-                                    ("hourhour", -1.3723081191451507),+                                   [("daymonth", -2.9267394020670396),+                                    ("about <time-of-day>noon", -3.332204510175204),+                                    ("minuteminute", -2.2335922215070942),+                                    ("<time-of-day> rano<time-of-day> rano", -3.332204510175204),+                                    ("until <time-of-day>noon", -3.332204510175204),+                                    ("hh:mmhh:mm", -3.332204510175204),+                                    ("hourhour", -1.540445040947149),                                     ("year<hour-of-day> <integer> (as relative minutes)",-                                     -3.164067588373206),-                                    ("after <time-of-day>noon", -3.164067588373206),-                                    ("hh:mmintersect", -2.653241964607215),-                                    ("<time> <part-of-day><time-of-day> rano", -3.164067588373206),-                                    ("at <time-of-day>noon", -3.56953269648137),-                                    ("<time-of-day> rano<time> <part-of-day>", -3.56953269648137),-                                    ("<ordinal> (as hour)noon", -2.4709204078132605),+                                     -2.9267394020670396),+                                    ("after <time-of-day>noon", -2.9267394020670396),+                                    ("hh:mmintersect", -2.4159137783010487),+                                    ("at <time-of-day>noon", -3.332204510175204),+                                    ("<ordinal> (as hour)noon", -2.2335922215070942),                                     ("<named-month> <day-of-month> (non ordinal)named-month",-                                     -3.164067588373206),-                                    ("yearminute", -3.164067588373206)],-                               n = 26}}),+                                     -2.9267394020670396),+                                    ("yearminute", -2.9267394020670396)],+                               n = 20}}),        ("second ordinal",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.5649493574615367,@@ -2115,13 +2092,13 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("morning",         Classifier{okData =-                     ClassData{prior = -0.6190392084062235,-                               unseen = -2.1972245773362196,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 7},-                   koData =                      ClassData{prior = -0.7731898882334817,                                unseen = -2.0794415416798357,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 6}}),+                               likelihoods = HashMap.fromList [("", 0.0)], n = 6},+                   koData =+                     ClassData{prior = -0.6190392084062235,+                               unseen = -2.1972245773362196,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),        ("relative minutes to|till|before <integer> (hour-of-day)",         Classifier{okData =                      ClassData{prior = -infinity, unseen = -1.0986122886681098,
Duckling/Ranking/Classifiers/ZH.hs view
@@ -34,24 +34,23 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("integer (numeric)",         Classifier{okData =-                     ClassData{prior = -0.5292593254548287,-                               unseen = -3.8066624897703196,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 43},+                     ClassData{prior = -0.5020919437972361, unseen = -3.871201010907891,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 46},                    koData =-                     ClassData{prior = -0.8892620594862358,+                     ClassData{prior = -0.9295359586241757,                                unseen = -3.4657359027997265,                                likelihoods = HashMap.fromList [("", 0.0)], n = 30}}),        ("the day before yesterday",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.3862943611198906,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("today",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.3862943611198906,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -65,12 +64,12 @@                                likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),        ("absorption of , after named day",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.70805020110221,+                     ClassData{prior = 0.0, unseen = -2.833213344056216,                                likelihoods =                                  HashMap.fromList                                    [("day", -0.6931471805599453),                                     ("named-day", -0.6931471805599453)],-                               n = 6},+                               n = 7},                    koData =                      ClassData{prior = -infinity, unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -83,28 +82,28 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("month (grain)",         Classifier{okData =-                     ClassData{prior = -1.0296194171811581,-                               unseen = -3.0910424533583156,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 20},+                     ClassData{prior = -0.9808292530117262, unseen = -3.258096538021482,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 24},                    koData =-                     ClassData{prior = -0.4418327522790392,-                               unseen = -3.6375861597263857,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 36}}),+                     ClassData{prior = -0.4700036292457356,+                               unseen = -3.7376696182833684,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 40}}),        ("<time-of-day> o'clock",         Classifier{okData =-                     ClassData{prior = -0.5108256237659907, unseen = -2.70805020110221,+                     ClassData{prior = -0.4418327522790392, unseen = -3.044522437723423,                                likelihoods =                                  HashMap.fromList                                    [("<integer> (latent time-of-day)", -0.6931471805599453),                                     ("hour", -0.6931471805599453)],-                               n = 6},+                               n = 9},                    koData =-                     ClassData{prior = -0.916290731874155, unseen = -2.3978952727983707,+                     ClassData{prior = -1.0296194171811581,+                               unseen = -2.5649493574615367,                                likelihoods =                                  HashMap.fromList                                    [("<integer> (latent time-of-day)", -0.6931471805599453),                                     ("hour", -0.6931471805599453)],-                               n = 4}}),+                               n = 5}}),        ("national day",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.0794415416798357,@@ -114,68 +113,69 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("hour (grain)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.639057329615259,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 12},+                     ClassData{prior = 0.0, unseen = -3.0910424533583156,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 20},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("intersect",         Classifier{okData =-                     ClassData{prior = -0.4473122180436648, unseen = -4.553876891600541,+                     ClassData{prior = -0.4367176516122688, unseen = -4.61512051684126,                                likelihoods =                                  HashMap.fromList-                                   [("children's day<part-of-day> <dim time>", -3.4446824936018943),+                                   [("children's day<part-of-day> <dim time>", -3.506557897319982),                                     ("year (numeric with year symbol)<named-month> <day-of-month>",-                                     -1.547562508716013),-                                    ("dayday", -1.978345424808467),-                                    ("hourhour", -2.9338568698359033),-                                    ("hourminute", -3.4446824936018943),+                                     -1.5606477482646683),+                                    ("dayday", -1.8971199848858813),+                                    ("hourhour", -2.995732273553991),+                                    ("hourminute", -3.506557897319982),                                     ("absorption of , after named day<named-month> <day-of-month>",-                                     -1.978345424808467),-                                    ("dayminute", -3.4446824936018943),-                                    ("tonight<time-of-day> o'clock", -2.9338568698359033),+                                     -1.8971199848858813),+                                    ("dayminute", -3.506557897319982),+                                    ("tonight<time-of-day> o'clock", -2.995732273553991),                                     ("<dim time> <part-of-day>relative minutes after|past <integer> (hour-of-day)",-                                     -3.4446824936018943),-                                    ("yearday", -1.547562508716013)],-                               n = 39},+                                     -3.506557897319982),+                                    ("yearday", -1.5606477482646683)],+                               n = 42},                    koData =-                     ClassData{prior = -1.0198314108149953, unseen = -4.110873864173311,+                     ClassData{prior = -1.0388930539664873, unseen = -4.143134726391533,                                likelihoods =                                  HashMap.fromList-                                   [("children's day<part-of-day> <dim time>", -2.1484344131667874),-                                    ("dayhour", -2.4849066497880004),-                                    ("daymonth", -2.1484344131667874),+                                   [("children's day<part-of-day> <dim time>", -2.181224235989778),+                                    ("dayhour", -2.517696472610991),+                                    ("daymonth", -2.0476928433652555),                                     ("<dim time> <part-of-day><time-of-day> o'clock",-                                     -2.995732273553991),+                                     -3.028522096376982),                                     ("year (numeric with year symbol)named-month",-                                     -2.1484344131667874),-                                    ("hourhour", -2.995732273553991),-                                    ("hourminute", -2.995732273553991),+                                     -2.181224235989778),+                                    ("hourhour", -3.028522096376982),+                                    ("hourminute", -3.028522096376982),                                     ("absorption of , after named daynamed-month",-                                     -2.1484344131667874),-                                    ("yearmonth", -2.1484344131667874),-                                    ("dayminute", -2.995732273553991),+                                     -2.0476928433652555),+                                    ("yearmonth", -2.181224235989778),+                                    ("dayminute", -3.028522096376982),                                     ("<dim time> <part-of-day>relative minutes after|past <integer> (hour-of-day)",-                                     -2.995732273553991)],-                               n = 22}}),+                                     -3.028522096376982)],+                               n = 23}}),        ("year (grain)",         Classifier{okData =-                     ClassData{prior = -1.2809338454620642,-                               unseen = -1.9459101490553135,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 5},+                     ClassData{prior = -0.8209805520698302,+                               unseen = -2.5649493574615367,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 11},                    koData =-                     ClassData{prior = -0.325422400434628, unseen = -2.70805020110221,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 13}}),+                     ClassData{prior = -0.579818495252942, unseen = -2.772588722239781,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 14}}),        ("last tuesday, last july",         Classifier{okData =-                     ClassData{prior = -1.3350010667323402, unseen = -3.332204510175204,+                     ClassData{prior = -1.2039728043259361,+                               unseen = -3.4657359027997265,                                likelihoods =                                  HashMap.fromList-                                   [("day", -0.8979415932059586),-                                    ("named-day", -0.8979415932059586)],-                               n = 10},+                                   [("day", -0.8690378470236094),+                                    ("named-day", -0.8690378470236094)],+                               n = 12},                    koData =-                     ClassData{prior = -0.3053816495511819,+                     ClassData{prior = -0.35667494393873245,                                unseen = -4.1588830833596715,                                likelihoods =                                  HashMap.fromList@@ -186,36 +186,38 @@                                n = 28}}),        ("next <cycle>",         Classifier{okData =-                     ClassData{prior = -0.7884573603642702, unseen = -2.70805020110221,+                     ClassData{prior = -0.7472144018302211,+                               unseen = -3.2188758248682006,                                likelihoods =                                  HashMap.fromList-                                   [("week", -1.540445040947149),-                                    ("month (grain)", -1.252762968495368),-                                    ("week (grain)", -1.540445040947149),-                                    ("month", -1.252762968495368)],-                               n = 5},+                                   [("week", -1.3862943611198906),+                                    ("month (grain)", -1.791759469228055),+                                    ("year (grain)", -2.4849066497880004),+                                    ("week (grain)", -1.3862943611198906),+                                    ("year", -2.4849066497880004), ("month", -1.791759469228055)],+                               n = 9},                    koData =-                     ClassData{prior = -0.6061358035703156, unseen = -2.833213344056216,+                     ClassData{prior = -0.6418538861723948, unseen = -3.295836866004329,                                likelihoods =                                  HashMap.fromList-                                   [("week", -0.8266785731844679),-                                    ("week (grain)", -0.8266785731844679)],-                               n = 6}}),+                                   [("week", -0.8602012652231115),+                                    ("week (grain)", -0.8602012652231115)],+                               n = 10}}),        ("last year",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.3862943611198906,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("this <day-of-week>",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -3.295836866004329,+                     ClassData{prior = 0.0, unseen = -3.8066624897703196,                                likelihoods =                                  HashMap.fromList                                    [("day", -0.6931471805599453),                                     ("named-day", -0.6931471805599453)],-                               n = 12},+                               n = 21},                    koData =                      ClassData{prior = -infinity, unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -242,15 +244,15 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("yesterday",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.6094379124341003,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 3},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("next year",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.3862943611198906,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -263,14 +265,15 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<integer> (latent time-of-day)",         Classifier{okData =-                     ClassData{prior = -1.540445040947149, unseen = -2.70805020110221,+                     ClassData{prior = -1.3217558399823195,+                               unseen = -2.9444389791664407,                                likelihoods =                                  HashMap.fromList-                                   [("integer (numeric)", -1.0296194171811581),-                                    ("integer (0..10)", -0.4418327522790392)],-                               n = 12},+                                   [("integer (numeric)", -1.2809338454620642),+                                    ("integer (0..10)", -0.325422400434628)],+                               n = 16},                    koData =-                     ClassData{prior = -0.2411620568168881,+                     ClassData{prior = -0.3101549283038396,                                unseen = -3.8501476017100584,                                likelihoods =                                  HashMap.fromList@@ -279,50 +282,48 @@                                n = 44}}),        ("nth <time> of <time>",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.4849066497880004,+                     ClassData{prior = 0.0, unseen = -2.995732273553991,                                likelihoods =                                  HashMap.fromList-                                   [("monthday", -0.7884573603642702),+                                   [("monthday", -0.7472144018302211),                                     ("month (numeric with month symbol)ordinal (digits)named-day",-                                     -1.2992829841302609),-                                    ("named-monthordinal (digits)named-day", -1.2992829841302609)],-                               n = 4},+                                     -1.3350010667323402),+                                    ("named-monthordinal (digits)named-day", -1.3350010667323402)],+                               n = 8},                    koData =                      ClassData{prior = -infinity, unseen = -1.3862943611198906,                                likelihoods = HashMap.fromList [], n = 0}}),        ("named-month",         Classifier{okData =-                     ClassData{prior = -4.255961441879589e-2,-                               unseen = -3.2188758248682006,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 23},+                     ClassData{prior = -3.7740327982847086e-2,+                               unseen = -3.332204510175204,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 26},                    koData =-                     ClassData{prior = -3.1780538303479458,-                               unseen = -1.0986122886681098,+                     ClassData{prior = -3.295836866004329, unseen = -1.0986122886681098,                                likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),        ("month (numeric with month symbol)",         Classifier{okData =-                     ClassData{prior = -0.15415067982725836,-                               unseen = -3.6635616461296463,+                     ClassData{prior = -0.13976194237515874,+                               unseen = -3.7612001156935624,                                likelihoods =                                  HashMap.fromList-                                   [("integer (numeric)", -0.9985288301111273),-                                    ("integer (0..10)", -0.4595323293784402)],-                               n = 36},+                                   [("integer (numeric)", -1.0296194171811581),+                                    ("integer (0..10)", -0.4418327522790392)],+                               n = 40},                    koData =-                     ClassData{prior = -1.9459101490553135,-                               unseen = -2.1972245773362196,+                     ClassData{prior = -2.03688192726104, unseen = -2.1972245773362196,                                likelihoods =                                  HashMap.fromList [("integer (0..10)", -0.13353139262452263)],                                n = 6}}),        ("week (grain)",         Classifier{okData =-                     ClassData{prior = -0.8754687373538999,-                               unseen = -3.0910424533583156,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 20},+                     ClassData{prior = -0.8434293836092833,+                               unseen = -3.6635616461296463,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 37},                    koData =-                     ClassData{prior = -0.5389965007326869,-                               unseen = -3.4011973816621555,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 28}}),+                     ClassData{prior = -0.5625269981428811,+                               unseen = -3.9318256327243257,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 49}}),        ("valentine's day",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.3862943611198906,@@ -332,16 +333,16 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("year (numeric with year symbol)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.70805020110221,+                     ClassData{prior = 0.0, unseen = -2.772588722239781,                                likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],-                               n = 13},+                               n = 14},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("now",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.1972245773362196,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 7},+                     ClassData{prior = 0.0, unseen = -2.4849066497880004,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 10},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -355,8 +356,8 @@                                n = 4}}),        ("tomorrow",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 1},+                     ClassData{prior = 0.0, unseen = -1.6094379124341003,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 3},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -369,34 +370,48 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("afternoon",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.9459101490553135,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 5},+                     ClassData{prior = 0.0, unseen = -2.3978952727983707,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 9},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("<duration> from now",+        Classifier{okData =+                     ClassData{prior = -infinity, unseen = -2.1972245773362196,+                               likelihoods = HashMap.fromList [], n = 0},+                   koData =+                     ClassData{prior = 0.0, unseen = -3.891820298110627,+                               likelihoods =+                                 HashMap.fromList+                                   [("week", -2.2617630984737906), ("second", -2.772588722239781),+                                    ("day", -2.2617630984737906), ("year", -2.772588722239781),+                                    ("<integer> <unit-of-duration>", -0.8266785731844679),+                                    ("hour", -2.2617630984737906), ("month", -2.772588722239781),+                                    ("minute", -2.772588722239781)],+                               n = 20}}),        ("this <cycle>",         Classifier{okData =-                     ClassData{prior = -0.8754687373538999,-                               unseen = -3.2188758248682006,+                     ClassData{prior = -1.0185695809945732,+                               unseen = -3.4339872044851463,                                likelihoods =                                  HashMap.fromList-                                   [("week", -0.9808292530117262),-                                    ("year (grain)", -2.0794415416798357),-                                    ("week (grain)", -0.9808292530117262),-                                    ("year", -2.0794415416798357)],-                               n = 10},+                                   [("week", -0.916290731874155),+                                    ("year (grain)", -2.3025850929940455),+                                    ("week (grain)", -0.916290731874155),+                                    ("year", -2.3025850929940455)],+                               n = 13},                    koData =-                     ClassData{prior = -0.5389965007326869,-                               unseen = -3.4965075614664802,+                     ClassData{prior = -0.4480247225269604,+                               unseen = -3.9318256327243257,                                likelihoods =                                  HashMap.fromList-                                   [("week", -0.7576857016975165),-                                    ("week (grain)", -0.7576857016975165)],-                               n = 14}}),+                                   [("week", -0.7339691750802004),+                                    ("week (grain)", -0.7339691750802004)],+                               n = 23}}),        ("minute (grain)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.639057329615259,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 12},+                     ClassData{prior = 0.0, unseen = -2.890371757896165,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 16},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -416,59 +431,60 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<part-of-day> <dim time>",         Classifier{okData =-                     ClassData{prior = -0.6931471805599453,-                               unseen = -3.5553480614894135,+                     ClassData{prior = -0.587786664902119, unseen = -3.891820298110627,                                likelihoods =                                  HashMap.fromList-                                   [("tonight<integer> (latent time-of-day)", -1.916922612182061),-                                    ("hourhour", -1.329135947279942),+                                   [("tonight<integer> (latent time-of-day)", -2.2617630984737906),+                                    ("hourhour", -1.1631508098056809),                                     ("afternoonrelative minutes after|past <integer> (hour-of-day)",-                                     -1.916922612182061),-                                    ("hourminute", -1.7346010553881064),-                                    ("afternoonhh:mm (time-of-day)", -2.833213344056216),-                                    ("tonight<time-of-day> o'clock", -1.916922612182061)],-                               n = 13},+                                     -2.0794415416798357),+                                    ("afternoon<time-of-day> o'clock", -2.4849066497880004),+                                    ("hourminute", -1.9252908618525775),+                                    ("afternoon<integer> (latent time-of-day)",+                                     -2.4849066497880004),+                                    ("afternoonhh:mm (time-of-day)", -3.1780538303479458),+                                    ("tonight<time-of-day> o'clock", -2.2617630984737906)],+                               n = 20},                    koData =-                     ClassData{prior = -0.6931471805599453,-                               unseen = -3.5553480614894135,+                     ClassData{prior = -0.8109302162163288, unseen = -3.713572066704308,                                likelihoods =                                  HashMap.fromList-                                   [("hourhour", -1.2237754316221157),+                                   [("hourhour", -1.2039728043259361),                                     ("afternoonrelative minutes after|past <integer> (hour-of-day)",-                                     -1.916922612182061),-                                    ("afternoon<time-of-day> o'clock", -1.916922612182061),-                                    ("hourminute", -1.916922612182061),+                                     -1.8971199848858813),+                                    ("afternoon<time-of-day> o'clock", -1.8971199848858813),+                                    ("hourminute", -1.8971199848858813),                                     ("afternoon<integer> (latent time-of-day)",-                                     -1.7346010553881064)],-                               n = 13}}),+                                     -1.742969305058623)],+                               n = 16}}),        ("<integer> <unit-of-duration>",         Classifier{okData =                      ClassData{prior = -infinity, unseen = -2.833213344056216,                                likelihoods = HashMap.fromList [], n = 0},                    koData =-                     ClassData{prior = 0.0, unseen = -5.54907608489522,+                     ClassData{prior = 0.0, unseen = -5.877735781779639,                                likelihoods =                                  HashMap.fromList-                                   [("week", -2.9802280870180256),-                                    ("integer (0..10)month (grain)", -1.9075912847531766),-                                    ("integer (0..10)hour (grain)", -2.9802280870180256),-                                    ("second", -3.242592351485517),-                                    ("integer (0..10)day (grain)", -3.4657359027997265),-                                    ("integer (0..10)year (grain)", -3.7534179752515073),-                                    ("integer (numeric)year (grain)", -2.906120114864304),-                                    ("integer (0..10)second (grain)", -3.242592351485517),-                                    ("day", -3.4657359027997265), ("year", -2.600738465313122),-                                    ("integer (0..10)minute (grain)", -2.9802280870180256),-                                    ("hour", -2.9802280870180256),-                                    ("integer (0..10)week (grain)", -2.9802280870180256),-                                    ("month", -1.6133518117552368),-                                    ("integer (numeric)month (grain)", -2.906120114864304),-                                    ("minute", -2.9802280870180256)],-                               n = 120}}),+                                   [("week", -2.6560549059838294),+                                    ("integer (0..10)month (grain)", -2.068268241081711),+                                    ("integer (0..10)hour (grain)", -2.8304082931286074),+                                    ("second", -3.235873401236772),+                                    ("integer (0..10)day (grain)", -3.0417173867958143),+                                    ("integer (0..10)year (grain)", -3.572345637857985),+                                    ("integer (numeric)year (grain)", -3.1668805297498204),+                                    ("integer (0..10)second (grain)", -3.235873401236772),+                                    ("day", -3.0417173867958143), ("year", -2.6968769005040847),+                                    ("integer (0..10)minute (grain)", -3.0417173867958143),+                                    ("hour", -2.8304082931286074),+                                    ("integer (0..10)week (grain)", -2.6560549059838294),+                                    ("month", -1.7973932869463112),+                                    ("integer (numeric)month (grain)", -3.1668805297498204),+                                    ("minute", -3.0417173867958143)],+                               n = 170}}),        ("integer (11..19)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.639057329615259,-                               likelihoods = HashMap.fromList [("integer (0..10)", 0.0)], n = 12},+                     ClassData{prior = 0.0, unseen = -2.70805020110221,+                               likelihoods = HashMap.fromList [("integer (0..10)", 0.0)], n = 13},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -491,23 +507,21 @@                                n = 3}}),        ("relative minutes after|past <integer> (hour-of-day)",         Classifier{okData =-                     ClassData{prior = -0.6931471805599453,-                               unseen = -2.4849066497880004,+                     ClassData{prior = -0.6931471805599453, unseen = -2.639057329615259,                                likelihoods =                                  HashMap.fromList                                    [("<integer> (latent time-of-day)integer (11..19)",-                                     -0.7884573603642702),-                                    ("hour", -0.7884573603642702)],-                               n = 4},+                                     -0.7731898882334817),+                                    ("hour", -0.7731898882334817)],+                               n = 5},                    koData =-                     ClassData{prior = -0.6931471805599453,-                               unseen = -2.4849066497880004,+                     ClassData{prior = -0.6931471805599453, unseen = -2.639057329615259,                                likelihoods =                                  HashMap.fromList                                    [("<integer> (latent time-of-day)integer (0..10)",-                                     -0.7884573603642702),-                                    ("hour", -0.7884573603642702)],-                               n = 4}}),+                                     -0.7731898882334817),+                                    ("hour", -0.7731898882334817)],+                               n = 5}}),        ("army's day",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.3862943611198906,@@ -518,78 +532,113 @@        ("intersect by \",\"",         Classifier{okData =                      ClassData{prior = -0.40546510810816444,-                               unseen = -3.367295829986474,+                               unseen = -3.4965075614664802,                                likelihoods =                                  HashMap.fromList-                                   [("dayday", -0.7672551527136672),-                                    ("named-day<named-month> <day-of-month>", -0.7672551527136672)],-                               n = 12},+                                   [("dayday", -0.7576857016975165),+                                    ("named-day<named-month> <day-of-month>", -0.7576857016975165)],+                               n = 14},                    koData =-                     ClassData{prior = -1.0986122886681098, unseen = -2.833213344056216,+                     ClassData{prior = -1.0986122886681098,+                               unseen = -2.9444389791664407,                                likelihoods =                                  HashMap.fromList-                                   [("named-daynamed-month", -0.8266785731844679),-                                    ("daymonth", -0.8266785731844679)],-                               n = 6}}),+                                   [("named-daynamed-month", -0.8109302162163288),+                                    ("daymonth", -0.8109302162163288)],+                               n = 7}}),        ("named-day",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -4.406719247264253,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 80},+                     ClassData{prior = 0.0, unseen = -4.605170185988091,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 98},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("second (grain)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.3978952727983707,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 9},+                     ClassData{prior = 0.0, unseen = -2.70805020110221,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 13},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("<duration> ago",+        Classifier{okData =+                     ClassData{prior = -infinity, unseen = -2.1972245773362196,+                               likelihoods = HashMap.fromList [], n = 0},+                   koData =+                     ClassData{prior = 0.0, unseen = -3.891820298110627,+                               likelihoods =+                                 HashMap.fromList+                                   [("week", -2.2617630984737906), ("second", -2.772588722239781),+                                    ("day", -2.2617630984737906), ("year", -2.772588722239781),+                                    ("<integer> <unit-of-duration>", -0.8266785731844679),+                                    ("hour", -2.2617630984737906), ("month", -2.772588722239781),+                                    ("minute", -2.772588722239781)],+                               n = 20}}),+       ("last <time>",+        Classifier{okData =+                     ClassData{prior = -1.2039728043259361,+                               unseen = -3.4657359027997265,+                               likelihoods =+                                 HashMap.fromList+                                   [("day", -0.8690378470236094),+                                    ("named-day", -0.8690378470236094)],+                               n = 12},+                   koData =+                     ClassData{prior = -0.35667494393873245,+                               unseen = -4.1588830833596715,+                               likelihoods =+                                 HashMap.fromList+                                   [("<integer> (latent time-of-day)", -1.0076405104623831),+                                    ("named-month", -3.4499875458315876),+                                    ("month (numeric with month symbol)", -2.3513752571634776),+                                    ("hour", -1.0076405104623831), ("month", -2.1972245773362196)],+                               n = 28}}),        ("the day after tomorrow",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.3862943611198906,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 2},+                     ClassData{prior = 0.0, unseen = -1.6094379124341003,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 3},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),        ("next <time>",         Classifier{okData =-                     ClassData{prior = -2.2512917986064953,-                               unseen = -2.3978952727983707,+                     ClassData{prior = -1.5260563034950494, unseen = -2.833213344056216,                                likelihoods =                                  HashMap.fromList-                                   [("day", -1.2039728043259361),-                                    ("named-day", -1.2039728043259361)],-                               n = 2},+                                   [("day", -0.9808292530117262),+                                    ("named-day", -0.9808292530117262)],+                               n = 5},                    koData =-                     ClassData{prior = -0.11122563511022437,-                               unseen = -3.713572066704308,+                     ClassData{prior = -0.24512245803298496,+                               unseen = -3.7612001156935624,                                likelihoods =                                  HashMap.fromList-                                   [("<integer> (latent time-of-day)", -1.1239300966523995),-                                    ("month (numeric with month symbol)", -2.995732273553991),-                                    ("day", -2.0794415416798357),-                                    ("named-day", -2.0794415416798357),-                                    ("hour", -1.1239300966523995), ("month", -2.995732273553991)],-                               n = 17}}),+                                   [("<integer> (latent time-of-day)", -1.1727202608218315),+                                    ("month (numeric with month symbol)", -3.044522437723423),+                                    ("day", -1.9459101490553135),+                                    ("named-day", -1.9459101490553135),+                                    ("hour", -1.1727202608218315), ("month", -3.044522437723423)],+                               n = 18}}),        ("last <cycle>",         Classifier{okData =-                     ClassData{prior = -0.9555114450274363, unseen = -2.70805020110221,+                     ClassData{prior = -0.8472978603872037,+                               unseen = -3.2188758248682006,                                likelihoods =                                  HashMap.fromList-                                   [("week", -1.540445040947149),-                                    ("month (grain)", -1.252762968495368),-                                    ("week (grain)", -1.540445040947149),-                                    ("month", -1.252762968495368)],-                               n = 5},+                                   [("week", -1.3862943611198906),+                                    ("month (grain)", -1.791759469228055),+                                    ("year (grain)", -2.4849066497880004),+                                    ("week (grain)", -1.3862943611198906),+                                    ("year", -2.4849066497880004), ("month", -1.791759469228055)],+                               n = 9},                    koData =-                     ClassData{prior = -0.48550781578170077,-                               unseen = -3.044522437723423,+                     ClassData{prior = -0.5596157879354228,+                               unseen = -3.4339872044851463,                                likelihoods =                                  HashMap.fromList-                                   [("week", -0.7985076962177716),-                                    ("week (grain)", -0.7985076962177716)],-                               n = 8}}),+                                   [("week", -0.8362480242006186),+                                    ("week (grain)", -0.8362480242006186)],+                               n = 12}}),        ("christmas",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.791759469228055,@@ -606,22 +655,22 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("next n <cycle>",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -4.07753744390572,+                     ClassData{prior = 0.0, unseen = -4.59511985013459,                                likelihoods =                                  HashMap.fromList-                                   [("week", -2.451005098112319),-                                    ("integer (0..10)month (grain)", -2.6741486494265287),-                                    ("integer (0..10)hour (grain)", -2.451005098112319),-                                    ("second", -2.6741486494265287),-                                    ("integer (0..10)day (grain)", -2.6741486494265287),-                                    ("integer (0..10)year (grain)", -3.367295829986474),-                                    ("integer (0..10)second (grain)", -2.6741486494265287),-                                    ("day", -2.6741486494265287), ("year", -3.367295829986474),-                                    ("integer (0..10)minute (grain)", -2.451005098112319),-                                    ("hour", -2.451005098112319),-                                    ("integer (0..10)week (grain)", -2.451005098112319),-                                    ("month", -2.6741486494265287), ("minute", -2.451005098112319)],-                               n = 22},+                                   [("week", -2.3877429013343523),+                                    ("integer (0..10)month (grain)", -2.793208009442517),+                                    ("integer (0..10)hour (grain)", -2.3877429013343523),+                                    ("second", -2.793208009442517),+                                    ("integer (0..10)day (grain)", -2.505525936990736),+                                    ("integer (0..10)year (grain)", -3.1986731175506815),+                                    ("integer (0..10)second (grain)", -2.793208009442517),+                                    ("day", -2.505525936990736), ("year", -3.1986731175506815),+                                    ("integer (0..10)minute (grain)", -2.639057329615259),+                                    ("hour", -2.3877429013343523),+                                    ("integer (0..10)week (grain)", -2.3877429013343523),+                                    ("month", -2.793208009442517), ("minute", -2.639057329615259)],+                               n = 42},                    koData =                      ClassData{prior = -infinity, unseen = -2.70805020110221,                                likelihoods = HashMap.fromList [], n = 0}}),@@ -634,31 +683,31 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("<named-month> <day-of-month>",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -4.770684624465665,+                     ClassData{prior = 0.0, unseen = -4.820281565605037,                                likelihoods =                                  HashMap.fromList                                    [("month (numeric with month symbol)integer (11..19)",-                                     -2.5649493574615367),-                                    ("named-monthinteger (11..19)", -2.5649493574615367),-                                    ("named-monthinteger (numeric)", -3.6635616461296463),+                                     -2.6149597780361984),+                                    ("named-monthinteger (11..19)", -2.6149597780361984),+                                    ("named-monthinteger (numeric)", -3.713572066704308),                                     ("month (numeric with month symbol)integer (numeric)",-                                     -2.1231166051824975),-                                    ("month", -0.7368222440626069),+                                     -2.1041341542702074),+                                    ("month", -0.734646911466698),                                     ("month (numeric with month symbol)integer (0..10)",-                                     -2.1231166051824975),-                                    ("named-monthinteger (0..10)", -2.277267285009756)],-                               n = 55},+                                     -2.1041341542702074),+                                    ("named-monthinteger (0..10)", -2.2472349979108808)],+                               n = 58},                    koData =                      ClassData{prior = -infinity, unseen = -2.0794415416798357,                                likelihoods = HashMap.fromList [], n = 0}}),        ("integer (0..10)",         Classifier{okData =-                     ClassData{prior = -0.5010216236693698,-                               unseen = -4.8283137373023015,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 123},+                     ClassData{prior = -0.44306352166517193,+                               unseen = -5.170483995038151,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 174},                    koData =-                     ClassData{prior = -0.9311793443679057, unseen = -4.406719247264253,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 80}}),+                     ClassData{prior = -1.0274078423763182, unseen = -4.59511985013459,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 97}}),        ("last n <cycle>",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -4.61512051684126,@@ -682,22 +731,48 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("this|next <day-of-week>",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.70805020110221,+                     ClassData{prior = -0.17185025692665928,+                               unseen = -3.5553480614894135,                                likelihoods =                                  HashMap.fromList                                    [("day", -0.6931471805599453),                                     ("named-day", -0.6931471805599453)],-                               n = 6},+                               n = 16},                    koData =-                     ClassData{prior = -infinity, unseen = -1.0986122886681098,-                               likelihoods = HashMap.fromList [], n = 0}}),+                     ClassData{prior = -1.845826690498331, unseen = -2.1972245773362196,+                               likelihoods =+                                 HashMap.fromList+                                   [("day", -0.6931471805599453),+                                    ("named-day", -0.6931471805599453)],+                               n = 3}}),        ("ordinal (digits)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -1.3862943611198906,-                               likelihoods = HashMap.fromList [("integer (0..10)", 0.0)], n = 2},+                     ClassData{prior = 0.0, unseen = -1.791759469228055,+                               likelihoods = HashMap.fromList [("integer (0..10)", 0.0)], n = 4},                    koData =                      ClassData{prior = -infinity, unseen = -0.6931471805599453,                                likelihoods = HashMap.fromList [], n = 0}}),+       ("n <cycle> last",+        Classifier{okData =+                     ClassData{prior = 0.0, unseen = -4.007333185232471,+                               likelihoods =+                                 HashMap.fromList+                                   [("week", -2.379546134130174),+                                    ("integer (0..10)month (grain)", -2.890371757896165),+                                    ("integer (0..10)hour (grain)", -2.379546134130174),+                                    ("second", -2.890371757896165),+                                    ("integer (0..10)day (grain)", -2.379546134130174),+                                    ("integer (0..10)year (grain)", -2.890371757896165),+                                    ("integer (0..10)second (grain)", -2.890371757896165),+                                    ("day", -2.379546134130174), ("year", -2.890371757896165),+                                    ("integer (0..10)minute (grain)", -2.890371757896165),+                                    ("hour", -2.379546134130174),+                                    ("integer (0..10)week (grain)", -2.379546134130174),+                                    ("month", -2.890371757896165), ("minute", -2.890371757896165)],+                               n = 20},+                   koData =+                     ClassData{prior = -infinity, unseen = -2.70805020110221,+                               likelihoods = HashMap.fromList [], n = 0}}),        ("morning",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -2.890371757896165,@@ -714,11 +789,12 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("day (grain)",         Classifier{okData =-                     ClassData{prior = 0.0, unseen = -2.1972245773362196,-                               likelihoods = HashMap.fromList [("", 0.0)], n = 7},+                     ClassData{prior = -6.453852113757118e-2,+                               unseen = -2.833213344056216,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 15},                    koData =-                     ClassData{prior = -infinity, unseen = -0.6931471805599453,-                               likelihoods = HashMap.fromList [], n = 0}}),+                     ClassData{prior = -2.772588722239781, unseen = -1.0986122886681098,+                               likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),        ("labor day",         Classifier{okData =                      ClassData{prior = 0.0, unseen = -1.3862943611198906,@@ -735,17 +811,15 @@                                likelihoods = HashMap.fromList [], n = 0}}),        ("this <time>",         Classifier{okData =-                     ClassData{prior = -0.35667494393873245,-                               unseen = -3.5263605246161616,+                     ClassData{prior = -0.2318016140573243, unseen = -3.951243718581427,                                likelihoods =                                  HashMap.fromList-                                   [("day", -0.9315582040049435),-                                    ("named-day", -0.9315582040049435),-                                    ("hour", -2.3978952727983707),-                                    ("week-end", -2.3978952727983707)],-                               n = 14},+                                   [("day", -0.8407831793660099),+                                    ("named-day", -0.8407831793660099),+                                    ("hour", -2.833213344056216), ("week-end", -2.833213344056216)],+                               n = 23},                    koData =-                     ClassData{prior = -1.2039728043259361, unseen = -2.890371757896165,+                     ClassData{prior = -1.575536360758419, unseen = -2.890371757896165,                                likelihoods =                                  HashMap.fromList                                    [("<integer> (latent time-of-day)", -0.8873031950009028),
Duckling/Resolve.hs view
@@ -14,15 +14,13 @@   , DucklingTime(..)   , Resolve(..)   , fromUTC-  , fromZonedTime   , toUTC   ) where  import Data.Aeson-import Data.String+import Prelude import qualified Data.Time as Time import qualified Data.Time.LocalTime.TimeZone.Series as Series-import Prelude  import Duckling.Lang @@ -41,10 +39,6 @@ class ToJSON (ResolvedValue a) => Resolve a where   type ResolvedValue a   resolve :: Context -> a -> Maybe (ResolvedValue a)--fromZonedTime :: Time.ZonedTime -> DucklingTime-fromZonedTime (Time.ZonedTime localTime timeZone) = DucklingTime $-  Series.ZoneSeriesTime (toUTC localTime) (Series.TimeZoneSeries timeZone [])  -- | Given a UTCTime and an TimeZone, build a ZonedTime (no conversion) fromUTC :: Time.UTCTime -> Time.TimeZone -> Time.ZonedTime
Duckling/Rules.hs view
@@ -23,6 +23,7 @@ import Duckling.Lang import qualified Duckling.Rules.AR as ARRules import qualified Duckling.Rules.Common as CommonRules+import qualified Duckling.Rules.CS as CSRules import qualified Duckling.Rules.DA as DARules import qualified Duckling.Rules.DE as DERules import qualified Duckling.Rules.EN as ENRules@@ -68,6 +69,7 @@  langRules :: Lang -> Some Dimension -> [Rule] langRules AR = ARRules.rules+langRules CS = CSRules.rules langRules DA = DARules.rules langRules DE = DERules.rules langRules EN = ENRules.rules
+ Duckling/Rules/CS.hs view
@@ -0,0 +1,35 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Rules.CS+  ( rules+  ) where++import Duckling.Dimensions.Types+import Duckling.Types+import qualified Duckling.Distance.CS.Rules as Distance+import qualified Duckling.Numeral.CS.Rules as Numeral++rules :: Some Dimension -> [Rule]+rules (This Distance) = Distance.rules+rules (This Duration) = []+rules (This Numeral) = Numeral.rules+rules (This Email) = []+rules (This AmountOfMoney) = []+rules (This Ordinal) = []+rules (This PhoneNumber) = []+rules (This Quantity) = []+rules (This RegexMatch) = []+rules (This Temperature) = []+rules (This Time) = []+rules (This TimeGrain) = []+rules (This Url) = []+rules (This Volume) = []
Duckling/Rules/TR.hs view
@@ -14,13 +14,18 @@   ) where  import Duckling.Dimensions.Types+import Duckling.Types+import qualified Duckling.Distance.TR.Rules as Distance+import qualified Duckling.Duration.TR.Rules as Duration import qualified Duckling.Numeral.TR.Rules as Numeral import qualified Duckling.Ordinal.TR.Rules as Ordinal-import Duckling.Types+import qualified Duckling.Temperature.TR.Rules as Temperature+import qualified Duckling.TimeGrain.TR.Rules as TimeGrain+import qualified Duckling.Volume.TR.Rules as Volume  rules :: Some Dimension -> [Rule]-rules (This Distance) = []-rules (This Duration) = []+rules (This Distance) = Distance.rules+rules (This Duration) = Duration.rules rules (This Numeral) = Numeral.rules rules (This Email) = [] rules (This AmountOfMoney) = []@@ -28,8 +33,8 @@ rules (This PhoneNumber) = [] rules (This Quantity) = [] rules (This RegexMatch) = []-rules (This Temperature) = []+rules (This Temperature) = Temperature.rules rules (This Time) = []-rules (This TimeGrain) = []+rules (This TimeGrain) = TimeGrain.rules rules (This Url) = []-rules (This Volume) = []+rules (This Volume) = Volume.rules
+ Duckling/Temperature/TR/Corpus.hs view
@@ -0,0 +1,56 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Temperature.TR.Corpus+  ( corpus ) where++import Prelude+import Data.String+import Duckling.Lang+import Duckling.Resolve+import Duckling.Temperature.Types+import Duckling.Testing.Types++corpus :: Corpus+corpus = (testContext {lang = TR}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (TemperatureValue Celsius 37)+             [ "37°C"+             , "37 ° santigrat"+             , "37 derece C"+             , "37 C"+             , "37 derece santigrat"+             , "otuz yedi santigrat"+             ]+  , examples (TemperatureValue Fahrenheit 70)+             [ "70°F"+             , "70 ° Fahrenhayt"+             , "70 ° Fahrenayt"+             , "70 derece fahrenhayt"+             , "70 derece F"+             , "70 F"+             , "yetmiş fahrenayt"+             ]+  , examples (TemperatureValue Degree 45)+             [ "45°"+             , "45 derece"+             , "kırk beş derece"+             ]+  , examples (TemperatureValue Degree (-2))+             [ "-2°"+             , "- 2 derece"+             , "sıfırın altında 2°"+             , "sıfırın altında 2 derece"+             , "2° sıfırın altında"+             , "2 derece sıfırın altında"+             ]+  ]
+ Duckling/Temperature/TR/Rules.hs view
@@ -0,0 +1,103 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Temperature.TR.Rules+  ( rules ) where++import Data.Maybe+import Prelude+import Data.String++import Duckling.Dimensions.Types+import Duckling.Temperature.Helpers+import qualified Duckling.Temperature.Types as TTemperature+import Duckling.Temperature.Types (TemperatureData(..))+import Duckling.Types++ruleTemperatureDegrees :: Rule+ruleTemperatureDegrees = Rule+  { name = "<latent temp> degrees"+  , pattern =+    [ dimension Temperature+    , regex "derece|°"+    ]+  , prod = \tokens -> case tokens of+    (Token Temperature td:_) -> Just . Token Temperature $+      withUnit TTemperature.Degree td+    _ -> Nothing+  }++ruleTemperatureCelsius :: Rule+ruleTemperatureCelsius = Rule+  { name = "<temp> Celsius"+  , pattern =+    [ dimension Temperature+    , regex "c|santigrat"+    ]+  , prod = \tokens -> case tokens of+    (Token Temperature td:_) -> Just . Token Temperature $+      withUnit TTemperature.Celsius td+    _ -> Nothing+  }++ruleTemperatureFahrenheit :: Rule+ruleTemperatureFahrenheit = Rule+  { name = "<temp> Fahrenheit"+  , pattern =+    [ dimension Temperature+    , regex "f(ahrenh?ayt)?"+    ]+  , prod = \tokens -> case tokens of+    (Token Temperature td:_) -> Just . Token Temperature $+      withUnit TTemperature.Fahrenheit td+    _ -> Nothing+  }++ruleTemperatureBelowZero :: Rule+ruleTemperatureBelowZero = Rule+  { name = "below zero <temp>"+  , pattern =+    [ regex "s\305f\305r\305n alt\305nda"+    , dimension Temperature+    ]+  , prod = \tokens -> case tokens of+      (_:Token Temperature td@(TemperatureData {TTemperature.value = v}):_) ->+        case TTemperature.unit td of+          Nothing -> Just . Token Temperature . withUnit TTemperature.Degree $+            td {TTemperature.value = - v}+          _ -> Just . Token Temperature $ td {TTemperature.value = - v}+      _ -> Nothing+  }++ruleTemperatureBelowZeroReverse :: Rule+ruleTemperatureBelowZeroReverse = Rule+  { name = "<temp> below zero"+  , pattern =+    [ dimension Temperature+    , regex "s\305f\305r\305n alt\305nda"+    ]+  , prod = \tokens -> case tokens of+      (Token Temperature td@(TemperatureData {TTemperature.value = v}):_) ->+        case TTemperature.unit td of+          Nothing -> Just . Token Temperature . withUnit TTemperature.Degree $+            td {TTemperature.value = - v}+          _ -> Just . Token Temperature $ td {TTemperature.value = - v}+      _ -> Nothing+  }++rules :: [Rule]+rules =+  [ ruleTemperatureDegrees+  , ruleTemperatureCelsius+  , ruleTemperatureFahrenheit+  , ruleTemperatureBelowZero+  , ruleTemperatureBelowZeroReverse+  ]
Duckling/Testing/Types.hs view
@@ -26,11 +26,11 @@  import Data.Aeson import Data.Fixed (Pico)-import qualified Data.Time as Time import Data.Text (Text) import Prelude+import qualified Data.Time as Time -import Duckling.Lang+import Duckling.Core import Duckling.Resolve import Duckling.Types 
Duckling/Time/DA/Rules.hs view
@@ -202,7 +202,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -224,8 +224,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleTheDayofmonthNonOrdinal :: Rule@@ -304,7 +304,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -373,7 +373,7 @@         v2 <- parseInt m2         from <- intersect td (dayOfMonth v1)         to <- intersect td (dayOfMonth v2)-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -420,8 +420,8 @@   , pattern =     [ regex "for\x00e5r"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 3 20, monthDay 6 21)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 3 20) (monthDay 6 21)   }  ruleYearLatent2 :: Rule@@ -516,7 +516,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -610,8 +610,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -649,8 +649,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -855,7 +855,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -903,7 +903,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -915,7 +915,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleBetweenDatetimeAndDatetimeInterval :: Rule@@ -929,7 +929,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -963,8 +963,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $-        interval TTime.Closed (cycleNth TG.Second 0, td)+      (_:Token Time td:_) -> Token Time <$>+        interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -974,10 +974,10 @@   , pattern =     [ regex "efter arbejde"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 17, hour False 21)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleLastNCycle :: Rule@@ -1015,8 +1015,8 @@     , dimension Duration     ]   , prod = \tokens -> case tokens of-      (_:Token Duration dd:_) -> tt $-        interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+      (_:Token Duration dd:_) -> Token Time <$>+        interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)       _ -> Nothing   } @@ -1148,7 +1148,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleAboutDuration :: Rule@@ -1301,8 +1301,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1376,10 +1376,10 @@   , pattern =     [ regex "efter (frokost|middag)"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 13, hour False 17)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleOnANamedday :: Rule@@ -1425,7 +1425,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule@@ -1459,8 +1459,8 @@   , prod = \_ ->       let from = hour False 0           to = hour False 4-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayofmonthOrdinal :: Rule@@ -1543,10 +1543,10 @@   , pattern =     [ regex "i aften"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleYear :: Rule@@ -1667,7 +1667,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } 
Duckling/Time/DE/Corpus.hs view
@@ -268,7 +268,13 @@              [ "zirka 15 uhr"              , "zirka 3 uhr am nachmittag"              , "um ungefähr 15 uhr"+             , "gegen 15 uhr"+             , "ca. 15h"+             , "um ca 15h"              ]+  , examples (datetime (2013, 4, 1, 18, 0, 0) Hour)+             [ "01.04. gegen 18Uhr"+             ]   , examples (datetime (2013, 2, 13, 17, 0, 0) Hour)              [ "pünktlich um 17 uhr morgen"              ]@@ -319,6 +325,12 @@   , examples (datetime (2014, 7, 18, 19, 0, 0) Hour)              [ "Fr, 18. Juli 2014 7 uhr abends"              ]+  , examples (datetime (2014, 7, 18, 0, 0, 0) Day)+             [ "Fr, 18. Juli 2014"+             , "Freitag, 18.07.14"+             , "Freitag, den 18.07.2014"+             , "Freitag, der 18. Juli 14"+             ]   , examples (datetime (2013, 2, 12, 4, 30, 1) Second)              [ "in einer sekunde"              ]@@ -581,12 +593,18 @@   , examples (datetimeOpenInterval After (2013, 2, 12, 14, 0, 0) Hour)              [ "nach 14 Uhr"              , "nach 14h"+             , "ab 14Uhr"              , "nach 2 Uhr"+             , "frühestens 14 Uhr"+             , "14 Uhr frühstens"              ]   , examples (datetimeOpenInterval Before (2013, 2, 12, 11, 0, 0) Hour)              [ "bis 11 uhr"+             , "vor 11 uhr"              , "bis 11h vormittags"              , "bis 11 am vormittag"+             , "spätestens 11 uhr"+             , "11Uhr spätestens"              ]   , examples (datetimeInterval ((2013, 2, 12, 12, 0, 0), (2013, 2, 12, 19, 0, 0)) Hour)              [ "am nachmittag"
Duckling/Time/DE/Rules.hs view
@@ -185,7 +185,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -207,8 +207,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleTheDayofmonthNonOrdinal :: Rule@@ -273,7 +273,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -342,7 +342,7 @@         v2 <- parseInt m2         from <- intersect (dayOfMonth v1) td         to <- intersect (dayOfMonth v2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -403,7 +403,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -488,7 +488,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -569,8 +569,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -595,8 +595,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -723,7 +723,7 @@   { name = "intersect by ','"   , pattern =     [ Predicate isNotLatent-    , regex ","+    , regex ",( den|r)?"     , Predicate isNotLatent     ]   , prod = \tokens -> case tokens of@@ -801,7 +801,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -835,7 +835,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -847,7 +847,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSchweizerBundesfeiertag :: Rule@@ -870,7 +870,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -904,8 +904,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $-        interval TTime.Closed (td, cycleNth TG.Second 0)+      (_:Token Time td:_) -> Token Time <$>+        interval TTime.Closed td (cycleNth TG.Second 0)       _ -> Nothing   } @@ -915,10 +915,10 @@   , pattern =     [ regex "nach (der)? arbeit|(am)? feier ?abend"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 17, hour False 21)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleBeforeYesterday :: Rule@@ -974,8 +974,8 @@     , dimension Duration     ]   , prod = \tokens -> case tokens of-      (_:Token Duration dd:_) -> tt $-        interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+      (_:Token Duration dd:_) -> Token Time <$>+        interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)       _ -> Nothing   } @@ -1017,7 +1017,7 @@ ruleAboutTimeofday = Rule   { name = "about <time-of-day>"   , pattern =-    [ regex "(um )?zirka|ungef(\x00e4)hr|etwa"+    [ regex "(um )?zirka|ca\\.?|ungef(\x00e4)hr|etwa|gegen"     , Predicate isATimeOfDay     ]   , prod = \tokens -> case tokens of@@ -1029,15 +1029,26 @@ ruleUntilTimeofday = Rule   { name = "until <time-of-day>"   , pattern =-    [ regex "vor|bis( zu[rm]?)?"+    [ regex "vor|bis( zu[rm]?)?|sp(\x00e4)testens?"     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) ->-        tt $ withDirection TTime.Before td+      (_:Token Time td:_) -> tt $ withDirection TTime.Before td       _ -> Nothing   } +ruleUntilTimeofdayPostfix :: Rule+ruleUntilTimeofdayPostfix = Rule+  { name = "<time-of-day> until"+  , pattern =+    [ dimension Time+    , regex "sp(\x00e4)testens"+    ]+  , prod = \tokens -> case tokens of+      (Token Time td:_:_) -> tt $ withDirection TTime.Before td+      _ -> Nothing+  }+ ruleSterreichischerNationalfeiertag :: Rule ruleSterreichischerNationalfeiertag = Rule   { name = "Österreichischer Nationalfeiertag"@@ -1117,7 +1128,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleTagDerDeutschenEinheit :: Rule@@ -1267,8 +1278,8 @@   , prod = \_ ->       let from = hour False 3           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1351,10 +1362,10 @@   , pattern =     [ regex "nach dem mittagessen|nachmittags?"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 13, hour False 17)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleOnANamedday :: Rule@@ -1401,22 +1412,33 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule ruleAfterTimeofday = Rule   { name = "after <time-of-day>"   , pattern =-    [ regex "nach"+    [ regex "nach|ab|fr(\x00fc)he?stens"     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) ->-        tt $ withDirection TTime.After td+      (_:Token Time td:_) -> tt $ withDirection TTime.After td       _ -> Nothing   } +ruleAfterTimeofdayPostfix :: Rule+ruleAfterTimeofdayPostfix = Rule+  { name = "<time-of-day> after"+  , pattern =+    [ dimension Time+    , regex "fr(\x00fc)he?stens"+    ]+  , prod = \tokens -> case tokens of+      (Token Time td:_:_) -> tt $ withDirection TTime.After td+      _ -> Nothing+  }+ ruleChristmas :: Rule ruleChristmas = Rule   { name = "christmas"@@ -1435,8 +1457,8 @@   , prod = \_ ->       let from = hour False 0           to = hour False 4-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayofmonthOrdinal :: Rule@@ -1559,10 +1581,10 @@   , pattern =     [ regex "heute? (am)? abends?"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleYear :: Rule@@ -1684,10 +1706,24 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } +ruleTimeofdayTimeofdayInterval2 :: Rule+ruleTimeofdayTimeofdayInterval2 = Rule+  { name = "<time-of-day> - <time-of-day> (interval)"+  , pattern =+    [ Predicate isATimeOfDay+    , regex "\\-|bis"+    , Predicate $ liftM2 (&&) isATimeOfDay isNotLatent+    ]+  , prod = \tokens -> case tokens of+      (Token Time td1:_:Token Time td2:_) ->+        Token Time <$> interval TTime.Closed td1 td2+      _ -> Nothing+  }+ ruleNamedmonth11 :: Rule ruleNamedmonth11 = Rule   { name = "named-month"@@ -1880,6 +1916,7 @@   , ruleAfterLunch   , ruleAfterNextTime   , ruleAfterTimeofday+  ,  ruleAfterTimeofdayPostfix   , ruleAfterTomorrow   , ruleAfterWork   , ruleAfternoon@@ -2002,10 +2039,12 @@   , ruleTimeofdayOclock   , ruleTimeofdaySharp   , ruleTimeofdayTimeofdayInterval+  , ruleTimeofdayTimeofdayInterval2   , ruleToday   , ruleTomorrow   , ruleTonight   , ruleUntilTimeofday+  , ruleUntilTimeofdayPostfix   , ruleValentinesDay   , ruleWeekend   , ruleWithinDuration
Duckling/Time/EN/Corpus.hs view
@@ -116,6 +116,7 @@              , "2/15"              , "on 2/15"              , "February 15"+             , "2 / 15"              ]   , examples (datetime (2013, 8, 8, 0, 0, 0) Day)              ["Aug 8"]@@ -755,6 +756,10 @@              , "at 5pm tomorrow"              , "tomorrow at 5pm"              ]+  , examples (datetimeInterval ((2013, 2, 13, 12, 0, 0), (2013, 2, 13, 19, 0, 0)) Hour)+             [ "tomorrow afternoon"+             , "tomorrow afternoonish"+             ]   , examples (datetimeInterval ((2013, 2, 13, 13, 0, 0), (2013, 2, 13, 15, 0, 0)) Hour)              [ "1pm-2pm tomorrow"              ]@@ -779,5 +784,14 @@     -- yes, the result is in the past, we may need to revisit              [ "at 4:23"              , "4:23am"+             ]+  , examples (datetimeInterval ((2013, 3, 1, 0, 0, 0), (2013, 3, 11, 0, 0, 0)) Day)+             [ "early March"+             ]+  , examples (datetimeInterval ((2013, 3, 11, 0, 0, 0), (2013, 3, 21, 0, 0, 0)) Day)+             [ "mid March"+             ]+  , examples (datetimeInterval ((2013, 3, 21, 0, 0, 0), (2013, 4, 1, 0, 0, 0)) Day)+             [ "late March"              ]   ]
Duckling/Time/EN/Rules.hs view
@@ -699,7 +699,7 @@ ruleMMDD :: Rule ruleMMDD = Rule   { name = "mm/dd"-  , pattern = [regex "(0?[1-9]|1[0-2])/(3[01]|[12]\\d|0?[1-9])"]+  , pattern = [regex "(0?[1-9]|1[0-2])\\s?/\\s?(3[01]|[12]\\d|0?[1-9])"]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (mm:dd:_)):_) -> do         m <- parseInt mm@@ -721,17 +721,20 @@ rulePartOfDays :: Rule rulePartOfDays = Rule   { name = "part of days"-  , pattern = [regex "(morning|after ?noo?n|evening|night|(at )?lunch)"]+  , pattern =+    [ regex "(morning|after ?noo?n(ish)?|evening|night|(at )?lunch)"+    ]   , prod = \tokens -> case tokens of-      (Token RegexMatch (GroupMatch (match:_)):_) ->-        let td = interval TTime.Open $ case Text.toLower match of+      (Token RegexMatch (GroupMatch (match:_)):_) -> do+        let (start, end) = case Text.toLower match of               "morning"  -> (hour False 4, hour False 12)               "evening"  -> (hour False 18, hour False 0)               "night"    -> (hour False 18, hour False 0)               "lunch"    -> (hour False 12, hour False 14)               "at lunch" -> (hour False 12, hour False 14)               _          -> (hour False 12, hour False 19)-          in tt . partOfDay $ mkLatent td+        td <- interval TTime.Open start end+        tt . partOfDay $ mkLatent td       _ -> Nothing   } @@ -741,8 +744,8 @@   , pattern =     [ regex "early ((in|hours of) the )?morning"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 4, hour False 9)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 4) (hour False 9)   }  rulePODIn :: Rule@@ -774,10 +777,10 @@ ruleTonight = Rule   { name = "tonight"   , pattern = [regex "toni(ght|gth|te)"]-  , prod = \_ ->+  , prod = \_ -> do       let today = cycleNth TG.Day 0-          evening = interval TTime.Open (hour False 18, hour False 0) in-        Token Time . partOfDay . notLatent <$> intersect today evening+      evening <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay . notLatent <$> intersect today evening   }  ruleAfterPartofday :: Rule@@ -788,13 +791,14 @@     ]   , prod = \tokens -> case tokens of       (Token RegexMatch (GroupMatch (match:_)):_) -> do-        pair <- case Text.toLower match of+        (start, end) <- case Text.toLower match of           "lunch"  -> Just (hour False 13, hour False 17)           "work"   -> Just (hour False 17, hour False 21)           "school" -> Just (hour False 15, hour False 21)           _        -> Nothing+        td <- interval TTime.Open start end         Token Time . partOfDay . notLatent <$>-          intersect (cycleNth TG.Day 0) (interval TTime.Open pair)+          intersect (cycleNth TG.Day 0) td       _ -> Nothing   } @@ -831,7 +835,7 @@   , prod = \_ -> do       fri <- intersect (dayOfWeek 5) (hour False 18)       mon <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (fri, mon)+      Token Time <$> interval TTime.Open fri mon   }  ruleSeasons :: Rule@@ -854,7 +858,7 @@           "winter" -> Just $ monthDay 3 20           "spring" -> Just $ monthDay 6 21           _ -> Nothing-        tt $ interval TTime.Open (start, end)+        Token Time <$> interval TTime.Open start end       _ -> Nothing    }@@ -902,7 +906,7 @@         dd2 <- parseInt d2         dom1 <- intersect (dayOfMonth dd1) td         dom2 <- intersect (dayOfMonth dd2) td-        tt $ interval TTime.Closed (dom1, dom2)+        Token Time <$> interval TTime.Closed dom1 dom2       _ -> Nothing   } @@ -917,7 +921,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -932,7 +936,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -947,7 +951,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -962,7 +966,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -977,7 +981,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1003,8 +1007,8 @@            td1 = case parseInt mm of              Just m -> hourMinute True h m              Nothing -> hour True h-       tt $-         interval TTime.Closed (timeOfDayAMPM td1 ampm, timeOfDayAMPM td2 ampm)+       Token Time <$>+         interval TTime.Closed (timeOfDayAMPM td1 ampm) (timeOfDayAMPM td2 ampm)      _ -> Nothing  } @@ -1019,7 +1023,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1032,7 +1036,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Open (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Open (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -1045,7 +1049,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Closed (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -1130,6 +1134,28 @@       , prod = \_ -> tt $ month i       } +rulePartOfMonth :: Rule+rulePartOfMonth = Rule+  { name = "part of <named-month>"+  , pattern =+    [ regex "(early|mid|late)-?( of)?"+    , Predicate isAMonth+    ]+  , prod = \tokens -> case tokens of+      (Token RegexMatch (GroupMatch (match:_)):Token Time td:_) -> do+        (sd, ed) <- case Text.toLower match of+          "early" -> Just (1, 10)+          "mid"   -> Just (11, 20)+          "late"  -> Just (21, -1)+          _       -> Nothing+        start <- intersect td $ dayOfMonth sd+        end <- if ed /= -1+          then intersect td $ dayOfMonth ed+          else Just $ cycleLastOf TG.Day td+        Token Time <$> interval TTime.Open start end+      _ -> Nothing+  }+ usHolidays :: [(Text, String, Int, Int)] usHolidays =   [ ( "Christmas"       , "(xmas|christmas)( day)?"         , 12, 25 )@@ -1422,8 +1448,8 @@       (Token RegexMatch (GroupMatch (match:_)):        Token Duration dd:        _) -> case Text.toLower match of-         "within" -> tt $-           interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+         "within" -> Token Time <$>+           interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)          "after" -> tt . withDirection TTime.After $ inDuration dd          "in" -> tt $ inDuration dd          _ -> Nothing@@ -1589,6 +1615,7 @@   , ruleDurationAfterBeforeTime   , ruleInNumeral   , ruleTimezone+  , rulePartOfMonth   ]   ++ ruleInstants   ++ ruleDaysOfWeek
Duckling/Time/ES/Rules.hs view
@@ -122,7 +122,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -144,8 +144,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayOfMonthSt :: Rule@@ -205,7 +205,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -313,7 +313,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -662,8 +662,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -723,7 +723,7 @@         d2 <- parseInt m2         from <- intersect (dayOfMonth d1) td         to <- intersect (dayOfMonth d2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -771,7 +771,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -783,7 +783,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleRightNow :: Rule@@ -803,9 +803,9 @@     , regex "(a|en|de) la tarde"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let tarde = interval TTime.Open (hour False 12, hour False 21)-        in Token Time <$> intersect td (mkLatent $ partOfDay tarde)+      (Token Time td:_) -> do+        tarde <- interval TTime.Open (hour False 12) (hour False 21)+        Token Time <$> intersect td (mkLatent $ partOfDay tarde)       _ -> Nothing   } @@ -885,9 +885,9 @@     , regex "(a|en|de) la ma(\x00f1|n)ana"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let manana = interval TTime.Open (hour False 0, hour False 12)-        in Token Time <$> intersect td (mkLatent $ partOfDay manana)+      (Token Time td:_) -> do+        manana <- interval TTime.Open (hour False 0) (hour False 12)+        Token Time <$> intersect td (mkLatent $ partOfDay manana)       _ -> Nothing   } @@ -902,7 +902,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -944,8 +944,8 @@     ]   , prod = \tokens -> case tokens of       (_:Token Duration dd:_) ->-        tt $-          interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+        Token Time <$>+          interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)       _ -> Nothing   } @@ -967,7 +967,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleOrdinalQuarterYear :: Rule@@ -1060,8 +1060,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleALasHourmintimeofday :: Rule@@ -1135,7 +1135,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleDayofweekDayofmonth :: Rule@@ -1199,7 +1199,7 @@         v2 <- parseInt m2         from <- intersect (dayOfMonth v1) td         to <- intersect (dayOfMonth v2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1398,8 +1398,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 17-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedday3 :: Rule
Duckling/Time/FR/Rules.hs view
@@ -70,8 +70,8 @@   , pattern =     [ regex "d(\x00e9|e)but de journ(\x00e9|e)e"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-        interval TTime.Open (hour False 6, hour False 10)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+        interval TTime.Open (hour False 6) (hour False 10)   }  ruleLeLendemainDuTime :: Rule@@ -173,7 +173,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -200,7 +200,7 @@         n <- parseInt match         from <- intersect td2 td1         to <- intersect (dayOfMonth n) td2-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -215,7 +215,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -273,7 +273,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -292,7 +292,7 @@         n <- parseInt match         from <- intersect td2 td1         to <- intersect (dayOfMonth n) td2-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -370,8 +370,8 @@     ]   , prod = \tokens -> case tokens of       (_:Token Duration dd:_) ->-        tt $-          interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+        Token Time <$>+          interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)       _ -> Nothing   } @@ -434,8 +434,8 @@   , pattern =     [ regex "(ce )?printemps"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 3 20, monthDay 6 21)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 3 20) (monthDay 6 21)   }  ruleYearLatent2 :: Rule@@ -474,10 +474,10 @@     , regex "((du|dans|de) )?((au|le|la) )?mat(in(\x00e9|e)?e?)?"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let morning = partOfDay . mkLatent $-                        interval TTime.Open (hour False 0, hour False 12)-        in Token Time <$> intersect td morning+      (Token Time td:_) -> do+        morning <- partOfDay . mkLatent <$>+          interval TTime.Open (hour False 0) (hour False 12)+        Token Time <$> intersect td morning       _ -> Nothing   } @@ -494,7 +494,7 @@         n <- getIntValue token         from <- intersect (dayOfWeek 5) (hour False 18)         to <- intersect (dayOfWeek 1) (hour False 0)-        td2 <- intersect td (interval TTime.Open (from, to))+        td2 <- intersect td =<< interval TTime.Open from to         tt $ predNth (n - 1) False td2       _ -> Nothing   }@@ -706,8 +706,8 @@   , pattern =     [ regex "(pendant la |en )?semaine"     ]-  , prod = \_ -> tt $-      interval TTime.Open (dayOfWeek 1, dayOfWeek 5)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (dayOfWeek 1) (dayOfWeek 5)   }  ruleDdmm :: Rule@@ -781,8 +781,8 @@   , pattern =     [ regex "soir(\x00e9|e)?e?"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 18, hour False 0)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 18) (hour False 0)   }  ruleDbutDeSoire :: Rule@@ -791,8 +791,8 @@   , pattern =     [ regex "d(\x00e9|e)but de soir(\x00e9|e)e?"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 18, hour False 21)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 18) (hour False 21)   }  ruleFinDeSoire :: Rule@@ -801,8 +801,8 @@   , pattern =     [ regex "fin de soir(\x00e9|e)e?"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 21, hour False 0)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 21) (hour False 0)   }  ruleDbutDeMatine :: Rule@@ -811,8 +811,8 @@   , pattern =     [ regex "le matin (tr(e|\x00e8)s )?t(\x00f4|o)t|(tr(e|\x00e8)s )?t(\x00f4|o)t le matin|d(\x00e9|e)but de matin(\x00e9|e)e"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 7, hour False 9)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 7) (hour False 9)   }  ruleNamedday5 :: Rule@@ -839,7 +839,7 @@         d2 <- parseInt m2         from <- intersect td (dayOfMonth d1)         to <- intersect td (dayOfMonth d2)-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -873,7 +873,7 @@         d2 <- parseInt m2         from <- intersect (dayOfMonth d1) td         to <- intersect (dayOfMonth d2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -888,7 +888,7 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfMonth 1) td         to <- intersect (dayOfMonth 5) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -907,8 +907,8 @@   , pattern =     [ regex "milieu de journ(\x00e9|e)e"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 11, hour False 16)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 11) (hour False 16)   }  ruleFinDeJourne :: Rule@@ -917,8 +917,8 @@   , pattern =     [ regex "fin de journ(\x00e9|e)e"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 17, hour False 21)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 17) (hour False 21)   }  ruleLeCycleDeTime :: Rule@@ -942,8 +942,8 @@   , pattern =     [ regex "(cet )?hiver"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 12 21, monthDay 3 20)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 12 21) (monthDay 3 20)   }  ruleSeason :: Rule@@ -952,8 +952,8 @@   , pattern =     [ regex "(cet )?(\x00e9|e)t(\x00e9|e)"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 6 21, monthDay 9 23)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 6 21) (monthDay 9 23)   }  ruleAprsmidi :: Rule@@ -962,8 +962,8 @@   , pattern =     [ regex "apr(e|\x00e9|\x00e8)s?[ \\-]?midi"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 12, hour False 19)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 12) (hour False 19)   }  ruleNoel :: Rule@@ -1045,10 +1045,10 @@     , regex "((du|dans|de) )?((au|le|la) )?soir(\x00e9|e)?e?"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let td2 = mkLatent . partOfDay $-                    interval TTime.Open (hour False 16, hour False 0)-        in Token Time <$> intersect td td2+      (Token Time td:_) -> do+        td2 <- mkLatent . partOfDay <$>+          interval TTime.Open (hour False 16) (hour False 0)+        Token Time <$> intersect td td2       _ -> Nothing   } @@ -1071,10 +1071,10 @@   , pattern =     [ regex "apr(e|\x00e8)s (le )?d(e|\x00e9|\x00e8)jeuner"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 13, hour False 17)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleIntersect :: Rule@@ -1110,7 +1110,7 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfMonth 1) td         to <- intersect (dayOfMonth 14) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1125,7 +1125,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1166,10 +1166,10 @@   , pattern =     [ regex "apr(e|\x00e8)s (le )?travail"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 17, hour False 21)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleNamedmonth8 :: Rule@@ -1206,7 +1206,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleCedansLeCycle :: Rule@@ -1257,10 +1257,10 @@   , pattern =     [ regex "avant (le )?d(e|\x00e9|\x00e8)jeuner"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 10, hour False 12)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 10) (hour False 12)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleDernierWeekendDeTime :: Rule@@ -1274,7 +1274,8 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfWeek 5) (hour False 18)         to <- intersect (dayOfWeek 1) (hour False 0)-        tt $ predLastOf (interval TTime.Open (from, to)) td+        td2 <- interval TTime.Open from to+        tt $ predLastOf td2 td       _ -> Nothing   } @@ -1328,7 +1329,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1357,7 +1358,7 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfMonth 15) td         let to = cycleLastOf TG.Day td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1396,8 +1397,8 @@   , pattern =     [ regex "(en |au )?milieu de (cette |la )?semaine"     ]-  , prod = \_ -> tt $-      interval TTime.Open (dayOfWeek 3, dayOfWeek 4)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (dayOfWeek 3) (dayOfWeek 4)   }  ruleDbutDeSemaine :: Rule@@ -1406,8 +1407,8 @@   , pattern =     [ regex "(en |au )?d(\x00e9|e)but de (cette |la )?semaine"     ]-  , prod = \_ -> tt $-      interval TTime.Open (dayOfWeek 1, dayOfWeek 2)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (dayOfWeek 1) (dayOfWeek 2)   }  ruleTimeofdayHeures :: Rule@@ -1467,7 +1468,7 @@         n <- parseInt m         from <- intersect td2 td1         to <- intersect (dayOfMonth n) td2-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1484,7 +1485,7 @@       (_:Token RegexMatch (GroupMatch (m1:_)):_:Token RegexMatch (GroupMatch (m2:_)):_) -> do         n1 <- parseInt m1         n2 <- parseInt m2-        tt $ interval TTime.Closed (dayOfMonth n1, dayOfMonth n2)+        Token Time <$> interval TTime.Closed (dayOfMonth n1) (dayOfMonth n2)       _ -> Nothing   } @@ -1494,8 +1495,8 @@   , pattern =     [ regex "mat(in(\x00e9|e)?e?)?"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 4, hour False 12)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 4) (hour False 12)   }  ruleYearLatent :: Rule@@ -1517,8 +1518,8 @@   , pattern =     [ regex "(cet )?automne"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 9 23, monthDay 12 21)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 9 23) (monthDay 12 21)   }  ruleVersTimeofday :: Rule@@ -1545,7 +1546,7 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfMonth 25) td         let to = cycleLastOf TG.Day td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1633,7 +1634,7 @@         n2 <- parseInt m2         from <- intersect (dayOfMonth n1) td         to <- intersect (dayOfMonth n2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1670,8 +1671,8 @@   , pattern =     [ regex "(en |(\x00e0|a) la )?fin de (cette |la )?semaine"     ]-  , prod = \_ -> tt $-      interval TTime.Open (dayOfWeek 4, dayOfWeek 7)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (dayOfWeek 4) (dayOfWeek 7)   }  ruleIlYADuration :: Rule@@ -1706,8 +1707,8 @@   , pattern =     [ regex "((\x00e0|a) l(')?heure du|pendant( le)?|au)? d(e|\x00e9|\x00e8)jeuner"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 12, hour False 14)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 12) (hour False 14)   }  ruleYear :: Rule@@ -1747,8 +1748,8 @@   , pattern =     [ regex "milieu de matin(\x00e9|e)e"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 9, hour False 11)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 9) (hour False 11)   }  ruleFinDeMatine :: Rule@@ -1757,8 +1758,8 @@   , pattern =     [ regex "fin de matin(\x00e9|e)e"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 10, hour False 12)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 10) (hour False 12)   }  ruleDdmmyyyy :: Rule@@ -1810,7 +1811,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1842,8 +1843,8 @@   , pattern =     [ regex "d(\x00e9|e)but d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 12, hour False 14)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 12) (hour False 14)   }  ruleLeTime :: Rule@@ -1867,7 +1868,7 @@   , prod = \_ -> do       from <- intersect (monthDay 12 24) (hour False 18)       to <- intersect (monthDay 12 25) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleDayofweekDayofmonthTimeofday :: Rule@@ -1891,8 +1892,8 @@   , pattern =     [ regex "milieu d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 15, hour False 17)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 15) (hour False 17)   }  ruleFinDaprsmidi :: Rule@@ -1901,8 +1902,8 @@   , pattern =     [ regex "fin d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 17, hour False 19)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 17) (hour False 19)   }  ruleJourDeLan :: Rule@@ -1958,7 +1959,7 @@       (_:Token Time td:_) -> do         from <- intersect (dayOfMonth 10) td         to <- intersect (dayOfMonth 19) td-        tt $ interval TTime.Open (from, to)+        Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1978,7 +1979,7 @@         n <- parseInt m         from <- intersect (dayOfMonth 1) td         to <- intersect (dayOfMonth n) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -2000,7 +2001,7 @@   , prod = \_ -> do       let from = cycleNthAfter False TG.Day (- 10) $ cycleNth TG.Month 1           to = cycleNth TG.Month 1-      tt . mkLatent . partOfDay $ interval TTime.Open (from, to)+      Token Time . mkLatent . partOfDay <$> interval TTime.Open from to   }  ruleTimezone :: Rule
Duckling/Time/HE/Rules.hs view
@@ -303,7 +303,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -401,7 +401,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -500,7 +500,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -566,8 +566,8 @@   , pattern =     [ regex "(\x05d1)?\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 14)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 14)   }  ruleLastCycle :: Rule@@ -589,8 +589,8 @@   , pattern =     [ regex "\x05d0\x05d7\x05d4(\x05f4)?\x05e6|\x05d0\x05d7\x05e8 \x05d4\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 19)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 19)   }  ruleNamedmonth4 :: Rule@@ -730,9 +730,9 @@   , pattern =     [ regex "\x05d4\x05e2\x05e8\x05d1"     ]-  , prod = \_ ->-      let td = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect (cycleNth TG.Day 0) td+  , prod = \_ -> do+      td <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect (cycleNth TG.Day 0) td   }  ruleBetweenDatetimeAndDatetimeInterval :: Rule@@ -746,7 +746,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -899,7 +899,7 @@   , prod = \_ -> do       fri <- intersect (dayOfWeek 5) (hour False 18)       mon <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (fri, mon)+      Token Time <$> interval TTime.Open fri mon   }  ruleNameddayDayofmonthOrdinal :: Rule@@ -1004,8 +1004,8 @@   , pattern =     [ regex "(\x05d1)?\x05d1\x05d5\x05e7\x05e8"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 4, hour False 12)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 4) (hour False 12)   }  ruleThisCycle :: Rule@@ -1291,8 +1291,8 @@   , pattern =     [ regex "(\x05d1)?\x05e2\x05e8\x05d1"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 18, hour False 0)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 18) (hour False 0)   }  ruleOrdinalQuarter :: Rule
Duckling/Time/HR/Rules.hs view
@@ -300,7 +300,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -374,7 +374,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -397,7 +397,7 @@         d2 <- parseInt m2         from <- intersect (dayOfMonth d1) td         to <- intersect (dayOfMonth d2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -416,7 +416,8 @@   , pattern =     [ regex "prolje(c|\x0107)(e|a)"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 3 20, monthDay 6 21)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 3 20) (monthDay 6 21)   }  ruleYearLatent2 :: Rule@@ -459,8 +460,8 @@   , pattern =     [ regex "(rano( (u )?u?jutros?)?)|(u ran(im|e) jutarnj(im|e) sat(ima|e))"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 3, hour False 9)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 3) (hour False 9)   }  ruleToday :: Rule@@ -495,7 +496,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -586,8 +587,8 @@   , pattern =     [ regex "(((za )|(u vrijeme )) )?ru(c|\x010d)a?k(a|om)?"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 14)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 14)   }  ruleLastCycle :: Rule@@ -622,8 +623,8 @@   , pattern =     [ regex "po(slije)?podne"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 20)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 20)   }  ruleNamedmonth4 :: Rule@@ -654,8 +655,8 @@   , pattern =     [ regex "(((u|po)\\s)?no(c|\x0107)(i|as|u)?|u?jutros?)"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 0, hour False 4)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 0) (hour False 4)   }  ruleNamedmonthDayofmonthOrdinal :: Rule@@ -789,7 +790,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -820,7 +821,8 @@   , pattern =     [ regex "zim(a|e|us)?"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 12 21, monthDay 3 20)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 12 21) (monthDay 3 20)   }  ruleSeason :: Rule@@ -829,7 +831,8 @@   , pattern =     [ regex "ljet(os?|a)"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 6 21, monthDay 9 23)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 6 21) (monthDay 9 23)   }  ruleUNamedday :: Rule@@ -855,7 +858,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -877,7 +880,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Closed (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -887,9 +890,10 @@   , pattern =     [ regex "poslije (posla|kraja radnog vremena)"     ]-  , prod = \_ -> Token Time . partOfDay . notLatent <$>-      intersect (cycleNth TG.Day 0)-      (interval TTime.Open (hour False 17, hour False 21))+  , prod = \_ -> do+      td <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay . notLatent <$>+        intersect (cycleNth TG.Day 0) td   }  ruleLastDayofweekTime2 :: Rule@@ -929,8 +933,8 @@     , dimension Duration     ]   , prod = \tokens -> case tokens of-      (_:Token Duration dd:_) ->-        tt $ interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+      (_:Token Duration dd:_) -> Token Time <$>+        interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)       _ -> Nothing   } @@ -1057,7 +1061,7 @@   , prod = \_ -> do       fri <- intersect (dayOfWeek 5) (hour False 18)       mon <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (fri, mon)+      Token Time <$> interval TTime.Open fri mon   }  rulePrijeDuration :: Rule@@ -1168,8 +1172,8 @@   , pattern =     [ regex "(u )?u?jutros?"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 4, hour False 12)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 4) (hour False 12)   }  ruleThisPartofday :: Rule@@ -1263,9 +1267,10 @@   , pattern =     [ regex "poslije ru(c|\x010d)ka"     ]-  , prod = \_ -> Token Time . partOfDay . notLatent <$>-      intersect (cycleNth TG.Day 0)-      (interval TTime.Open (hour False 13, hour False 17))+  , prod = \_ -> do+      td <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay . notLatent <$>+        intersect (cycleNth TG.Day 0) td   }  ruleYearLatent :: Rule@@ -1298,7 +1303,7 @@     [ regex "jesen(i|as)?"     ]   , prod = \_ ->-      tt $ interval TTime.Open (monthDay 9 23, monthDay 12 21)+      Token Time <$> interval TTime.Open (monthDay 9 23) (monthDay 12 21)   }  ruleAfterTimeofday :: Rule@@ -1425,10 +1430,10 @@   , pattern =     [ regex "(na)?ve(c|\x010d)er(as)?"     ]-  , prod = \_ ->+  , prod = \_ -> do       let today = cycleNth TG.Day 0-          evening = interval TTime.Open (hour False 18, hour False 0) in-        Token Time . partOfDay . notLatent <$> intersect today evening+      evening <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay . notLatent <$> intersect today evening   }  ruleBeforeLasttime :: Rule@@ -1529,7 +1534,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $ interval TTime.Open (cycleNth TG.Second 0, td)+      (_:Token Time td:_) ->+        Token Time <$> interval TTime.Open (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -1572,7 +1578,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        Just . Token Time $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1605,8 +1611,8 @@   , pattern =     [ regex "(na)?ve(c|\x010d)er(i|as)?"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 18, hour False 0)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 18) (hour False 0)   }  ruleOrdinalQuarter :: Rule
Duckling/Time/Helpers.hs view
@@ -405,8 +405,8 @@     , TTime.timeGrain = g     } -interval :: TTime.TimeIntervalType -> (TimeData, TimeData) -> TimeData-interval intervalType (TimeData p1 _ g1 _ _ _, TimeData p2 _ g2 _ _ _) =+interval' :: TTime.TimeIntervalType -> (TimeData, TimeData) -> TimeData+interval' intervalType (TimeData p1 _ g1 _ _ _, TimeData p2 _ g2 _ _ _) =   TTime.timedata'     { TTime.timePred = mkTimeIntervalsPredicate intervalType' p1 p2     , TTime.timeGrain = min g1 g2@@ -416,6 +416,13 @@         | g1 == g2 && g1 == TG.Day = TTime.Closed         | otherwise = intervalType +interval :: TTime.TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData+interval intervalType td1 td2 =+  case interval' intervalType (td1, td2) of+    TTime.TimeData { TTime.timePred = pred }+      | TTime.isEmptyPredicate pred -> Nothing+    res -> Just res+ durationAgo :: DurationData -> TimeData durationAgo dd = inDuration $ timeNegPeriod dd @@ -466,7 +473,7 @@ withDirection dir td = td {TTime.direction = Just dir}  longWEBefore :: TimeData -> TimeData-longWEBefore monday = interval TTime.Open (start, end)+longWEBefore monday = interval' TTime.Open (start, end)   where     start = intersect' (fri, hour False 18)     end = intersect' (tue, hour False 0)
Duckling/Time/IT/Rules.hs view
@@ -110,10 +110,10 @@   , pattern =     [ regex "(sta|nella )notte|(in|nella) nottata"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 1-          td2 = interval TTime.Open (hour False 0, hour False 4)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 0) (hour False 4)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleDomattina :: Rule@@ -122,10 +122,10 @@   , pattern =     [ regex "domattina"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 1-          td2 = interval TTime.Open (hour False 4, hour False 12)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 4) (hour False 12)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleNamedmonth12 :: Rule@@ -178,10 +178,10 @@   , pattern =     [ regex "stamattina"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 4, hour False 12)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 4) (hour False 12)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleNamedday2 :: Rule@@ -312,7 +312,7 @@          v2 <- parseInt m2          from <- intersect (dayOfMonth v1) td          to <- intersect (dayOfMonth v2) td-         tt $ interval TTime.Closed (from, to)+         Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -423,7 +423,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -445,8 +445,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayOfMonthSt :: Rule@@ -469,8 +469,8 @@       (Token RegexMatch (GroupMatch (match:_)):        Token Duration dd:        _) -> case Text.toLower match of-        "entro" -> tt $-          interval TTime.Open (cycleNth TG.Second 0, inDuration dd)+        "entro" -> Token Time <$>+          interval TTime.Open (cycleNth TG.Second 0) (inDuration dd)         "in"    -> tt $ inDuration dd         _       -> Nothing       _ -> Nothing@@ -990,8 +990,8 @@       (_:token1:_:token2:_) -> do          v1 <- getIntValue token1          v2 <- getIntValue token2-         tt $-           interval TTime.Closed (dayOfMonth v1, dayOfMonth v2)+         Token Time <$>+           interval TTime.Closed (dayOfMonth v1) (dayOfMonth v2)       _ -> Nothing   } @@ -1008,8 +1008,8 @@       (_:token1:_:token2:_) -> do          v1 <- getIntValue token1          v2 <- getIntValue token2-         tt $-           interval TTime.Closed (dayOfMonth v1, dayOfMonth v2)+         Token Time <$>+           interval TTime.Closed (dayOfMonth v1) (dayOfMonth v2)       _ -> Nothing   } @@ -1089,7 +1089,7 @@       (_:Token TimeGrain grain:_) ->         let from = cycleNth TG.Second 0             to = cycleNth grain 1-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1116,7 +1116,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -1205,8 +1205,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDdmm :: Rule@@ -1247,8 +1247,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -1282,11 +1282,11 @@     , regex "del mattino"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->+      (Token Time td:_) -> do         let from = hour False 0             to = hour False 12-            td2 = mkLatent . partOfDay $ interval TTime.Open (from, to)-        in Token Time <$> intersect td td2+        td2 <- mkLatent . partOfDay <$> interval TTime.Open from to+        Token Time <$> intersect td td2       _ -> Nothing   } @@ -1357,10 +1357,10 @@     , regex "((in|nella|alla) )?nott(e|ata)"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->+      (Token Time td:_) -> do         let td1 = cycleNthAfter False TG.Day 1 td-            td2 = interval TTime.Open (hour False 0, hour False 4)-        in Token Time <$> intersect td1 td2+        td2 <- interval TTime.Open (hour False 0) (hour False 4)+        Token Time <$> intersect td1 td2       _ -> Nothing   } @@ -1379,10 +1379,10 @@   , pattern =     [ regex "stasera"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleSeason3 :: Rule@@ -1394,7 +1394,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -1406,7 +1406,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-       in tt $ interval TTime.Open (from, to)+       in Token Time <$> interval TTime.Open from to   }  ruleIntegerLatentTimeofday :: Rule@@ -1476,10 +1476,10 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) ->+      (_:Token Time td:_) -> do         let td1 = cycleNthAfter False TG.Day 1 td-            td2 = interval TTime.Open (hour False 0, hour False 4)-        in Token Time <$> intersect td1 td2+        td2 <- interval TTime.Open (hour False 0) (hour False 4)+        Token Time <$> intersect td1 td2       _ -> Nothing   } @@ -1533,7 +1533,7 @@   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->         let now = cycleNth TG.Second 0-        in tt $ interval TTime.Open (now, td)+        in Token Time <$> interval TTime.Open now td       _ -> Nothing   } @@ -1610,7 +1610,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1627,7 +1627,7 @@       (Token Time td1:_:Token Time td2:Token Time td3:_) -> do         from <- intersect td1 td3         to <- intersect td2 td3-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -1640,7 +1640,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleIlWeekendDelTime :: Rule@@ -1656,7 +1656,7 @@         from <- intersect from1 (hour False 18)         to1 <- intersect (cycleNthAfter False TG.Week 1 td) (dayOfWeek 1)         to <- intersect to1 (hour False 0)-        tt $ interval TTime.Open (from, to)+        Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1711,7 +1711,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1893,8 +1893,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleTheDayofmonth :: Rule@@ -2007,7 +2007,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleCircaPerLeTimeofday :: Rule@@ -2049,10 +2049,10 @@   , pattern =     [ regex "nott(e|ata)"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 1-          td2 = interval TTime.Open (hour False 0, hour False 4)-      in Token Time . partOfDay . mkLatent <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 0) (hour False 4)+      Token Time . partOfDay . mkLatent <$> intersect td1 td2   }  ruleOgnissanti :: Rule@@ -2137,7 +2137,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -2321,7 +2321,7 @@       (_:Token TimeGrain grain:_) ->         let from = cycleNth grain 1             to = cycleNth grain 3-        in tt $ interval TTime.Closed (from, to)+        in Token Time <$> interval TTime.Closed from to       _ -> Nothing   } 
Duckling/Time/KO/Corpus.hs view
@@ -173,8 +173,8 @@              [ "이번주 수요일"              ]   , examples (datetime (2013, 2, 14, 0, 0, 0) Day)-             [ "내일모래"-             , "모래"+             [ "내일모레"+             , "모레"              ]   , examples (datetime (2013, 2, 13, 17, 0, 0) Hour)              [ "내일 저녁다섯시"
Duckling/Time/KO/Rules.hs view
@@ -51,9 +51,9 @@  ruleTheDayAfterTomorrow :: Rule ruleTheDayAfterTomorrow = Rule-  { name = "the day after tomorrow - 내일모래"+  { name = "the day after tomorrow - 내일모레"   , pattern =-    [ regex "(\xb0b4\xc77c)?\xbaa8\xb798"+    [ regex "(\xb0b4\xc77c)?\xbaa8\xb808"     ]   , prod = \_ ->       tt . cycleNthAfter False TG.Day 1 $ cycleNth TG.Day 1@@ -153,7 +153,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -202,7 +202,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -423,8 +423,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -449,8 +449,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleChristmasEve :: Rule@@ -550,7 +550,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -562,7 +562,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleDayWithKoreanNumeral :: Rule@@ -681,7 +681,7 @@       (Token Duration dd:_) ->         let from = cycleNth TG.Second 0             to = inDuration dd-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -754,7 +754,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleTimeDayofweek :: Rule@@ -849,8 +849,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisCycle :: Rule@@ -932,7 +932,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule@@ -1095,8 +1095,8 @@     , regex "\xae4c\xc9c0"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) -> tt $-        interval TTime.Open (cycleNth TG.Second 0, td)+      (Token Time td:_) -> Token Time <$>+        interval TTime.Open (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -1141,7 +1141,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1163,8 +1163,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . partOfDay . mkLatent $-           interval TTime.Open (from, to)+      in Token Time . partOfDay . mkLatent <$>+           interval TTime.Open from to   }  ruleIndependenceMovementDay :: Rule
Duckling/Time/NB/Rules.hs view
@@ -282,7 +282,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -304,8 +304,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleTheDayofmonthNonOrdinal :: Rule@@ -384,7 +384,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -407,7 +407,7 @@         dd2 <- parseInt d2         dom1 <- intersect (dayOfMonth dd1) td         dom2 <- intersect (dayOfMonth dd2) td-        tt $ interval TTime.Closed (dom1, dom2)+        Token Time <$> interval TTime.Closed dom1 dom2       _ -> Nothing   } @@ -540,7 +540,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -635,8 +635,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -675,8 +675,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -836,7 +836,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -884,7 +884,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleBetweenDatetimeAndDatetimeInterval :: Rule@@ -898,7 +898,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -932,8 +932,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $-        interval TTime.Closed (cycleNth TG.Second 0, td)+      (_:Token Time td:_) -> Token Time <$>+        interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -943,10 +943,10 @@   , pattern =     [ regex "etter jobb"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 17, hour False 21)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleLastNCycle :: Rule@@ -970,7 +970,8 @@   , pattern =     [ regex "romjul(a|en)"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 12 24, monthDay 12 30)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 12 24) (monthDay 12 30)   }  ruleTimeofdaySharp :: Rule@@ -996,7 +997,7 @@       (_:Token Duration dd:_) ->         let from = cycleNth TG.Second 0             to = inDuration dd-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1127,7 +1128,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleEomendOfMonth :: Rule@@ -1273,8 +1274,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1335,10 +1336,10 @@   , pattern =     [ regex "etter (frokost|middag|lunsj|lunch)"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 13, hour False 17)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleOnANamedday :: Rule@@ -1385,7 +1386,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule@@ -1419,8 +1420,8 @@   , prod = \_ ->       let from = hour False 0           to = hour False 4-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayofmonthOrdinal :: Rule@@ -1503,10 +1504,10 @@   , pattern =     [ regex "i kveld"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleYear :: Rule@@ -1627,7 +1628,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } 
Duckling/Time/PL/Rules.hs view
@@ -238,7 +238,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -313,7 +313,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -348,7 +348,7 @@         dd2 <- parseInt d2         dom1 <- intersect (dayOfMonth dd1) td         dom2 <- intersect (dayOfMonth dd2) td-        tt $ interval TTime.Closed (dom1, dom2)+        Token Time <$> interval TTime.Closed dom1 dom2       _ -> Nothing   } @@ -370,7 +370,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -455,7 +455,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -574,8 +574,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -600,8 +600,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleHourofdayHourofdayInterval :: Rule@@ -614,7 +614,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -797,7 +797,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -831,7 +831,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -843,7 +843,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleIntegerLatentTimeofday :: Rule@@ -870,7 +870,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -904,8 +904,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $-        interval TTime.Closed (cycleNth TG.Second 0, td)+      (_:Token Time td:_) -> Token Time <$>+        interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -956,7 +956,7 @@       (_:Token Duration dd:_) ->         let from = cycleNth TG.Second 0             to = inDuration dd-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1090,7 +1090,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleEomendOfMonth :: Rule@@ -1207,8 +1207,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1345,7 +1345,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule@@ -1455,7 +1455,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1575,7 +1575,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Open (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Open (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -1621,7 +1621,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -1657,8 +1657,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleOrdinalQuarter :: Rule
Duckling/Time/PT/Rules.hs view
@@ -156,7 +156,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -178,8 +178,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayOfMonthSt :: Rule@@ -208,10 +208,10 @@     , regex "(da|na|pela) madruga(da)?"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let td2 = mkLatent . partOfDay $-                    interval TTime.Open (hour False 1, hour False 4)-        in Token Time <$> intersect td td2+      (Token Time td:_) -> do+        td2 <- mkLatent . partOfDay <$>+          interval TTime.Open (hour False 1) (hour False 4)+        Token Time <$> intersect td td2       _ -> Nothing   } @@ -302,7 +302,7 @@   , prod = \_ ->       let from = monthDay 3 20           to = monthDay 6 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleYearLatent2 :: Rule@@ -687,8 +687,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -708,10 +708,10 @@     , regex "(da|na|pela) manh(\x00e3|a)"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let td2 = mkLatent . partOfDay $-                    interval TTime.Open (hour False 4, hour False 12)-        in Token Time <$> intersect td td2+      (Token Time td:_) -> do+        td2 <- mkLatent . partOfDay <$>+          interval TTime.Open (hour False 4) (hour False 12)+        Token Time <$> intersect td td2       _ -> Nothing   } @@ -769,7 +769,7 @@         d2 <- parseInt m2         from <- intersect (dayOfMonth d1) td         to <- intersect (dayOfMonth d2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -830,7 +830,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleSeason :: Rule@@ -842,7 +842,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleRightNow :: Rule@@ -946,7 +946,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -970,7 +970,7 @@       (_:Token Duration dd:_) ->         let from = cycleNth TG.Second 0             to = inDuration dd-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1004,10 +1004,10 @@     , regex "(da|na|pela) tarde"     ]   , prod = \tokens -> case tokens of-      (Token Time td:_) ->-        let td2 = mkLatent . partOfDay $-                    interval TTime.Open (hour False 12, hour False 18)-        in Token Time <$> intersect td td2+      (Token Time td:_) -> do+        td2 <- mkLatent . partOfDay <$>+          interval TTime.Open (hour False 12) (hour False 18)+        Token Time <$> intersect td td2       _ -> Nothing   } @@ -1020,7 +1020,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleDayofweekSHourmin :: Rule@@ -1191,8 +1191,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent .partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1261,7 +1261,7 @@   , prod = \_ ->       let from = monthDay 9 23           to = monthDay 12 21-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleDiaDoTrabalhador :: Rule@@ -1325,7 +1325,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Open (td1, td2)+        Token Time <$> interval TTime.Open td1 td2       _ -> Nothing   } @@ -1352,7 +1352,7 @@         dd2 <- parseInt d2         dom1 <- intersect (dayOfMonth dd1) td         dom2 <- intersect (dayOfMonth dd2) td-        tt $ interval TTime.Closed (dom1, dom2)+        Token Time <$> interval TTime.Closed dom1 dom2       _ -> Nothing   } 
Duckling/Time/RO/Rules.hs view
@@ -49,8 +49,8 @@   , pattern =     [ regex "dupamiaz(a|\x0103)|dup(a|\x0103) amiaz(a|\x0103)"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 12, hour False 19)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 12) (hour False 19)   }  ruleNamedmonth12 :: Rule@@ -192,7 +192,7 @@         d2 <- parseInt m2         dom1 <- intersect (dayOfMonth d1) td         dom2 <- intersect (dayOfMonth d2) td-        tt $ interval TTime.Closed (dom1, dom2)+        Token Time <$> interval TTime.Closed dom1 dom2       _ -> Nothing   } @@ -304,7 +304,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -496,10 +496,10 @@   , pattern =     [ regex "disear(a|\x0103)|((i|\x00ee)n aceas(a|\x0103) )?sear(a|\x0103)"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleIntersectBy :: Rule@@ -583,7 +583,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -602,8 +602,8 @@   , pattern =     [ regex "primavar(a|\x0103)"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 3 20, monthDay 6 21)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 3 20) (monthDay 6 21)   }  ruleUrmatoareleNCycle :: Rule@@ -627,8 +627,8 @@   , pattern =     [ regex "toamn(a|\x0103)"     ]-  , prod = \_ -> tt $-      interval TTime.Open (monthDay 9 23, monthDay 12 21)+  , prod = \_ -> Token Time <$>+      interval TTime.Open (monthDay 9 23) (monthDay 12 21)   }  ruleDupaDuration :: Rule@@ -662,7 +662,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Closed (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -761,7 +761,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -812,7 +812,7 @@   , prod = \_ -> do       fri <- intersect (dayOfWeek 5) (hour False 18)       mon <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (fri, mon)+      Token Time <$> interval TTime.Open fri mon   }  rulePeDayofmonthNonOrdinal :: Rule@@ -1001,7 +1001,7 @@     [ regex "var(a|\x0103)"     ]   , prod = \_ ->-      tt $ interval TTime.Open (monthDay 6 21, monthDay 9 23)+      Token Time <$> interval TTime.Open (monthDay 6 21) (monthDay 9 23)   }  ruleSearaNoapte :: Rule@@ -1010,8 +1010,8 @@   , pattern =     [ regex "sear(a|\x0103)|noapte"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 18, hour False 0)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 18) (hour False 0)   }  ruleYearLatent :: Rule@@ -1034,7 +1034,7 @@     [ regex "iarn(a|\x0103)"     ]   , prod = \_ ->-      tt $ interval TTime.Open (monthDay 12 21, monthDay 3 20)+      Token Time <$> interval TTime.Open (monthDay 12 21) (monthDay 3 20)   }  ruleUltimeleNCycle :: Rule@@ -1070,8 +1070,8 @@   , pattern =     [ regex "diminea(t|\x021b)(a|\x0103)"     ]-  , prod = \_ -> tt . mkLatent . partOfDay $-      interval TTime.Open (hour False 4, hour False 12)+  , prod = \_ -> Token Time . mkLatent . partOfDay <$>+      interval TTime.Open (hour False 4) (hour False 12)   }  ruleTimeUrmatoarer :: Rule@@ -1277,8 +1277,8 @@     , dimension Time     ]   , prod = \tokens -> case tokens of-      (_:Token Time td:_) -> tt $-        interval TTime.Open (cycleNth TG.Second 0, td)+      (_:Token Time td:_) -> Token Time <$>+        interval TTime.Open (cycleNth TG.Second 0) td       _ -> Nothing   } 
Duckling/Time/SV/Rules.hs view
@@ -274,7 +274,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -296,8 +296,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleTheDayofmonthNonOrdinal :: Rule@@ -376,7 +376,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -399,7 +399,7 @@         v2 <- parseInt m2         from <- intersect (dayOfMonth v1) td         to <- intersect (dayOfMonth v2) td-        tt $ interval TTime.Closed (from, to)+        Token Time <$> interval TTime.Closed from to       _ -> Nothing   } @@ -532,7 +532,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -627,8 +627,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 14-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleLastCycle :: Rule@@ -667,8 +667,8 @@   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -831,7 +831,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -879,7 +879,7 @@   , prod = \_ ->       let from = monthDay 6 21           to = monthDay 9 23-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleBetweenDatetimeAndDatetimeInterval :: Rule@@ -893,7 +893,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } @@ -928,7 +928,7 @@     ]   , prod = \tokens -> case tokens of       (_:Token Time td:_) ->-        tt $ interval TTime.Closed (cycleNth TG.Second 0, td)+        Token Time <$> interval TTime.Closed (cycleNth TG.Second 0) td       _ -> Nothing   } @@ -938,10 +938,10 @@   , pattern =     [ regex "efter jobbet"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 17, hour False 21)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleLastNCycle :: Rule@@ -982,7 +982,7 @@       (_:Token Duration dd:_) ->         let from = cycleNth TG.Second 0             to = inDuration dd-        in tt $ interval TTime.Open (from, to)+        in Token Time <$> interval TTime.Open from to       _ -> Nothing   } @@ -1024,7 +1024,7 @@ ruleAboutTimeofday = Rule   { name = "about <time-of-day>"   , pattern =-    [ regex "(omkring|cirka|runt|ca\\.)( kl\\.| klockan)?"+    [ regex "(omkring|cirka|vid|runt|ca\\.)( kl\\.| klockan)?"     , Predicate isATimeOfDay     ]   , prod = \tokens -> case tokens of@@ -1116,7 +1116,7 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleEomendOfMonth :: Rule@@ -1266,8 +1266,8 @@   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleThisPartofday :: Rule@@ -1328,10 +1328,10 @@   , pattern =     [ regex "efter (lunch)"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 13, hour False 17)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleOnANamedday :: Rule@@ -1377,7 +1377,7 @@   , prod = \_ ->       let from = monthDay 12 21           to = monthDay 3 20-      in tt $ interval TTime.Open (from, to)+      in Token Time <$> interval TTime.Open from to   }  ruleAfterTimeofday :: Rule@@ -1411,8 +1411,8 @@   , prod = \_ ->       let from = hour False 0           to = hour False 4-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleDayofmonthOrdinal :: Rule@@ -1495,10 +1495,10 @@   , pattern =     [ regex "ikv\x00e4ll"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleYear :: Rule@@ -1601,7 +1601,7 @@     ]   , prod = \tokens -> case tokens of       (Token Time td1:_:Token Time td2:_) ->-        tt $ interval TTime.Closed (td1, td2)+        Token Time <$> interval TTime.Closed td1 td2       _ -> Nothing   } 
Duckling/Time/Types.hs view
@@ -129,7 +129,7 @@  timedata' :: TimeData timedata' = TimeData-  { timePred = EmptyPredicate+  { timePred = mkEmptyPredicate   , latent = False   , timeGrain = TG.Second   , notImmediate = False@@ -197,10 +197,15 @@ type SeriesPredicate = TimeObject -> TimeContext -> ([TimeObject], [TimeObject])  data AMPM = AM | PM-  deriving Eq+  deriving (Eq, Show) +newtype NoShow a = NoShow a++instance Show (NoShow a) where+  show _ = "??"+ data Predicate-  = SeriesPredicate SeriesPredicate+  = SeriesPredicate (NoShow SeriesPredicate)   | EmptyPredicate   | TimeDatePredicate -- invariant: at least one of them is Just     { tdSecond :: Maybe Int@@ -214,11 +219,12 @@     }   | IntersectPredicate Predicate Predicate   | TimeIntervalsPredicate TimeIntervalType Predicate Predicate+  deriving Show  {-# ANN runPredicate ("HLint: ignore Use foldr1OrError" :: String) #-} runPredicate :: Predicate -> SeriesPredicate-runPredicate EmptyPredicate = \_ _ -> ([], [])-runPredicate (SeriesPredicate p) = p+runPredicate EmptyPredicate{} = \_ _ -> ([], [])+runPredicate (SeriesPredicate (NoShow p)) = p runPredicate TimeDatePredicate{..}   -- This should not happen by construction, but if it does then   -- empty time series should be ok@@ -250,8 +256,15 @@  -- Predicate smart constructors +-- For debugging find it useful to make it:+-- mkEmptyPredicate :: HasCallStack => Predicate+-- mkEmptyPredicate = EmptyPredicate callStack+-- This way I can track where EmptyPredicates get created+mkEmptyPredicate :: Predicate+mkEmptyPredicate = EmptyPredicate+ mkSeriesPredicate :: SeriesPredicate -> Predicate-mkSeriesPredicate = SeriesPredicate+mkSeriesPredicate = SeriesPredicate . NoShow  mkSecondPredicate :: Int -> Predicate mkSecondPredicate n = emptyTimeDatePredicate { tdSecond = Just n }@@ -278,12 +291,12 @@ mkYearPredicate n = emptyTimeDatePredicate { tdYear = Just n }  mkIntersectPredicate :: Predicate -> Predicate -> Predicate-mkIntersectPredicate EmptyPredicate _ = EmptyPredicate-mkIntersectPredicate _ EmptyPredicate = EmptyPredicate+mkIntersectPredicate a@EmptyPredicate{} _ = a+mkIntersectPredicate _ a@EmptyPredicate{} = a mkIntersectPredicate   (TimeDatePredicate a1 b1 c1 d1 e1 f1 g1 h1)   (TimeDatePredicate a2 b2 c2 d2 e2 f2 g2 h2)-  = fromMaybe EmptyPredicate+  = fromMaybe mkEmptyPredicate       (TimeDatePredicate <$>         unify a1 a2 <*>         unify b1 b2 <*>@@ -303,16 +316,26 @@  mkTimeIntervalsPredicate   :: TimeIntervalType -> Predicate -> Predicate -> Predicate-mkTimeIntervalsPredicate _ EmptyPredicate _ = EmptyPredicate-mkTimeIntervalsPredicate _ _ EmptyPredicate = EmptyPredicate--- `from (from a to b) to c` and `from c to (from a to b)` don't+mkTimeIntervalsPredicate _ a@EmptyPredicate{} _ = a+mkTimeIntervalsPredicate _ _ a@EmptyPredicate{} = a+-- `from (... from a to b ...) to c` and `from c to (... from a to b ...)` don't -- really have a good interpretation, so abort early-mkTimeIntervalsPredicate _ TimeIntervalsPredicate{} _ = EmptyPredicate-mkTimeIntervalsPredicate _ _ TimeIntervalsPredicate{} = EmptyPredicate+mkTimeIntervalsPredicate _ a b+  | containsTimeIntervalsPredicate a ||+    containsTimeIntervalsPredicate b = mkEmptyPredicate+  -- this is potentially quadratic, but the sizes involved should be small mkTimeIntervalsPredicate t a b = TimeIntervalsPredicate t a b +containsTimeIntervalsPredicate :: Predicate -> Bool+containsTimeIntervalsPredicate TimeIntervalsPredicate{} = True+containsTimeIntervalsPredicate (IntersectPredicate a b) =+  containsTimeIntervalsPredicate a || containsTimeIntervalsPredicate b+containsTimeIntervalsPredicate _ = False+  -- SeriesPredicate might contain one, but we'll underapproximate for+  -- now+ isEmptyPredicate :: Predicate -> Bool-isEmptyPredicate EmptyPredicate = True+isEmptyPredicate EmptyPredicate{} = True isEmptyPredicate _ = False  -- Predicate runners
Duckling/Time/VI/Rules.hs view
@@ -243,7 +243,8 @@   , pattern =     [ regex "m(\x00f9)a? xu(\x00e2)n"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 3 20, monthDay 6 21)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 3 20) (monthDay 6 21)   }  ruleNoon :: Rule@@ -328,8 +329,8 @@   , pattern =     [ regex "(bu(\x1ed5)i )?tr(\x01b0)a"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 14)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 14)   }  ruleLastCycle :: Rule@@ -364,8 +365,8 @@   , pattern =     [ regex "(bu(\x1ed5)i )?chi(\x1ec1)u"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 12, hour False 19)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 12) (hour False 19)   }  ruleNamedmonth4 :: Rule@@ -544,7 +545,8 @@   , pattern =     [ regex "m(\x00f9)a? (\x0111)(\x00f4)ng"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 12 21, monthDay 3 20)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 12 21) (monthDay 3 20)   }  ruleSeason :: Rule@@ -553,7 +555,8 @@   , pattern =     [ regex "m(\x00f9)a? (h(\x00e8)|h(\x1ea1))"     ]-  , prod = \_ -> tt $ interval TTime.Open (monthDay 6 21, monthDay 9 23)+  , prod = \_ ->+      Token Time <$> interval TTime.Open (monthDay 6 21) (monthDay 9 23)   }  ruleDayofmonthNamedmonth2 :: Rule@@ -588,9 +591,10 @@   , pattern =     [ regex "(sau gi(\x1edd) l(\x00e0)m|sau gi(\x1edd) tan t(\x1ea7)m|l(\x00fa)c tan t(\x1ea7)m)"     ]-  , prod = \_ -> Token Time . partOfDay . notLatent <$>-      intersect (cycleNth TG.Day 0)-      (interval TTime.Open (hour False 17, hour False 21))+  , prod = \_ -> do+      td <- interval TTime.Open (hour False 17) (hour False 21)+      Token Time . partOfDay . notLatent <$>+        intersect (cycleNth TG.Day 0) td   }  ruleLastNCycle :: Rule@@ -689,7 +693,7 @@   , prod = \_ -> do       fri <- intersect (dayOfWeek 5) (hour False 18)       mon <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (fri, mon)+      Token Time <$> interval TTime.Open fri mon   }  ruleTimeofdaySngchiuti :: Rule@@ -787,8 +791,8 @@   , pattern =     [ regex "(bu(\x1ed5)i )?s(\x00e1)ng"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 4, hour False 12)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 4) (hour False 12)   }  ruleThisCycle :: Rule@@ -810,8 +814,8 @@   , pattern =     [ regex "(bu(\x1ed5)i )?(t(\x1ed1)i|(\x0111)(\x00ea)m)"     ]-  , prod = \_ -> tt . partOfDay . mkLatent $-      interval TTime.Open (hour False 18, hour False 0)+  , prod = \_ -> Token Time . partOfDay . mkLatent <$>+      interval TTime.Open (hour False 18) (hour False 0)   }  ruleAfterLunch :: Rule@@ -820,9 +824,10 @@   , pattern =     [ regex "(sau|qua) (bu(\x1ed5)i |b(\x1eef)a )?tr(\x01b0)a"     ]-  , prod = \_ -> Token Time . partOfDay . notLatent <$>-      intersect (cycleNth TG.Day 0)-      (interval TTime.Open (hour False 13, hour False 17))+  , prod = \_ -> do+      td <- interval TTime.Open (hour False 13) (hour False 17)+      Token Time . partOfDay . notLatent <$>+        intersect (cycleNth TG.Day 0) td   }  ruleSeason2 :: Rule@@ -832,7 +837,7 @@     [ regex "m(\x00f9)a? thu"     ]   , prod = \_ ->-      tt $ interval TTime.Open (monthDay 9 23, monthDay 12 21)+      Token Time <$> interval TTime.Open (monthDay 9 23) (monthDay 12 21)   }  ruleTimeNy :: Rule@@ -936,10 +941,10 @@   , pattern =     [ regex "(t(\x1ed1)i|(\x0111)(\x00ea)m)( h(\x00f4)m)? nay"     ]-  , prod = \_ ->+  , prod = \_ -> do       let today = cycleNth TG.Day 0-          evening = interval TTime.Open (hour False 18, hour False 0) in-        Token Time . partOfDay . notLatent <$> intersect today evening+      evening <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay . notLatent <$> intersect today evening   }  ruleTimezone :: Rule
Duckling/Time/ZH/Corpus.hs view
@@ -33,22 +33,32 @@              , "現在"              , "此時"              , "當前"+             , "宜家"+             , "而家"+             , "依家"              ]   , examples (datetime (2013, 2, 12, 0, 0, 0) Day)              [ "今天"+             , "今日"              ]   , examples (datetime (2013, 2, 11, 0, 0, 0) Day)              [ "昨天"+             , "昨日"+             , "尋日"              ]   , examples (datetime (2013, 2, 13, 0, 0, 0) Day)              [ "明天"+             , "明日"+             , "聽日"              ]   , examples (datetime (2013, 2, 14, 0, 0, 0) Day)              [ "后天"              , "後天"+             , "後日"              ]   , examples (datetime (2013, 2, 10, 0, 0, 0) Day)              [ "前天"+             , "前日"              ]   , examples (datetime (2013, 2, 18, 0, 0, 0) Day)              [ "星期一"@@ -121,6 +131,7 @@              , "上週日"              , "上星期天"              , "上禮拜天"+             , "上禮拜日"              ]   , examples (datetime (2013, 2, 10, 0, 0, 0) Day)              [ "周日, 二月十号"@@ -129,16 +140,20 @@              , "週日, 二月十號"              , "星期天, 二月十號"              , "禮拜天, 二月十號"+             , "禮拜日, 二月十號"              ]   , examples (datetime (2013, 10, 7, 0, 0, 0) Day)              [ "十月第一个星期一"              , "十月的第一个星期一"+             , "十月第一個星期一"+             , "十月的第一個星期一"              ]   , examples (datetime (2013, 2, 5, 0, 0, 0) Day)              [ "上周二"              , "上礼拜二"              , "上週二"              , "上禮拜二"+             , "上星期二"              ]   , examples (datetime (2013, 3, 1, 0, 0, 0) Day)              [ "三月一号"@@ -187,30 +202,43 @@   , examples (datetime (2013, 2, 19, 0, 0, 0) Day)              [ "下周二"              , "下週二"+             , "下星期二"+             , "下禮拜二"+             , "下礼拜二"              ]   , examples (datetime (2013, 2, 13, 0, 0, 0) Day)              [ "这周三"              , "这礼拜三"              , "這週三"              , "這禮拜三"+             , "今個星期三"+             , "今個礼拜三"+             , "今個禮拜三"              ]   , examples (datetime (2013, 2, 13, 0, 0, 0) Day)              [ "下周三"              , "下礼拜三"              , "下週三"              , "下禮拜三"+             , "下星期三"              ]   , examples (datetime (2013, 2, 18, 0, 0, 0) Day)              [ "这周一"              , "这礼拜一"              , "這週一"              , "這禮拜一"+             , "今個星期一"+             , "今個礼拜一"+             , "今個禮拜一"              ]   , examples (datetime (2013, 2, 12, 0, 0, 0) Day)              [ "这周二"              , "这礼拜二"              , "這週二"              , "這禮拜二"+             , "今個星期二"+             , "今個礼拜二"+             , "今個禮拜二"              ]   , examples (datetime (2013, 2, 11, 0, 0, 0) Week)              [ "这周"@@ -221,14 +249,23 @@              , "這一周"              , "這禮拜"              , "這一禮拜"+             , "今個星期"+             , "今個礼拜"+             , "今個禮拜"              ]   , examples (datetime (2013, 2, 4, 0, 0, 0) Week)              [ "上周"              , "上週"+             , "上個星期"+             , "上個礼拜"+             , "上個禮拜"              ]   , examples (datetime (2013, 2, 18, 0, 0, 0) Week)              [ "下周"              , "下週"+             , "下星期"+             , "下礼拜"+             , "下禮拜"              ]   , examples (datetime (2013, 1, 0, 0, 0, 0) Month)              [ "上月"@@ -242,6 +279,7 @@              ]   , examples (datetime (2012, 0, 0, 0, 0, 0) Year)              [ "去年"+             , "上年"              ]   , examples (datetime (2013, 0, 0, 0, 0, 0) Year)              [ "今年"@@ -250,6 +288,7 @@              ]   , examples (datetime (2014, 0, 0, 0, 0, 0) Year)              [ "明年"+             , "下年"              ]   , examples (datetimeInterval ((2013, 2, 12, 4, 29, 58), (2013, 2, 12, 4, 30, 0)) Second)              [ "上两秒"@@ -258,11 +297,15 @@              , "前二秒"              , "上兩秒"              , "前兩秒"+             , "兩秒前"+             , "兩秒之前"              ]   , examples (datetimeInterval ((2013, 2, 12, 4, 30, 1), (2013, 2, 12, 4, 30, 4)) Second)              [ "下三秒"              , "后三秒"              , "後三秒"+             , "三秒後"+             , "三秒之後"              ]   , examples (datetimeInterval ((2013, 2, 12, 4, 28, 0), (2013, 2, 12, 4, 30, 0)) Minute)              [ "上两分钟"@@ -273,12 +316,16 @@              , "上二分鐘"              , "前兩分鐘"              , "前二分鐘"+             , "兩分鐘前"+             , "兩分鐘之前"              ]   , examples (datetimeInterval ((2013, 2, 12, 4, 31, 0), (2013, 2, 12, 4, 34, 0)) Minute)              [ "下三分钟"              , "后三分钟"              , "下三分鐘"              , "後三分鐘"+             , "三分鐘後"+             , "三分鐘之後"              ]   , examples (datetimeInterval ((2013, 2, 12, 2, 0, 0), (2013, 2, 12, 4, 0, 0)) Hour)              [ "上两小时"@@ -289,35 +336,59 @@              , "上二小時"              , "前兩小時"              , "前二小時"+             , "兩小時之前"+             , "兩個鐘之前"+             , "兩小時前"+             , "兩個鐘前"              ]   , examples (datetimeInterval ((2013, 2, 12, 5, 0, 0), (2013, 2, 12, 8, 0, 0)) Hour)              [ "下三小时"              , "后三小时"              , "下三小時"              , "後三小時"+             , "三小時之後"+             , "三個鐘之後"+             , "三小時後"+             , "三個鐘後"              ]   , examples (datetimeInterval ((2013, 2, 10, 0, 0, 0), (2013, 2, 12, 0, 0, 0)) Day)              [ "上两天"              , "前两天"              , "上兩天"              , "前兩天"+             , "兩天前"+             , "兩天之前"+             , "兩日前"+             , "兩日之前"              ]   , examples (datetimeInterval ((2013, 2, 13, 0, 0, 0), (2013, 2, 16, 0, 0, 0)) Day)              [ "下三天"              , "后三天"              , "後三天"+             , "三天後"+             , "三天之後"+             , "三日後"+             , "三日之後"              ]   , examples (datetimeInterval ((2013, 1, 28, 0, 0, 0), (2013, 2, 11, 0, 0, 0)) Week)              [ "上两周"              , "上二周"              , "上兩週"              , "上二週"+             , "兩星期前"+             , "兩星期之前"+             , "兩個禮拜前"+             , "兩個禮拜之前"              ]   , examples (datetimeInterval ((2013, 2, 18, 0, 0, 0), (2013, 3, 11, 0, 0, 0)) Week)              [ "下三周"              , "下三个周"              , "下三週"              , "下三個週"+             , "三星期後"+             , "三星期之後"+             , "三個禮拜後"+             , "三個禮拜之後"              ]   , examples (datetimeInterval ((2012, 12, 0, 0, 0, 0), (2013, 2, 0, 0, 0, 0)) Month)              [ "上两个月"@@ -331,23 +402,34 @@              , "前兩個月"              , "前二個月"              , "前兩月"+             , "兩個月前"+             , "兩個月之前"              ]   , examples (datetimeInterval ((2013, 3, 0, 0, 0, 0), (2013, 6, 0, 0, 0, 0)) Month)              [ "下三个月"              , "后三个月"              , "後三個月"+             , "三個月後"+             , "三個月之後"              ]   , examples (datetimeInterval ((2011, 0, 0, 0, 0, 0), (2013, 0, 0, 0, 0, 0)) Year)              [ "前两年"              , "前兩年"+             , "兩年前"+             , "兩年之前"              ]   , examples (datetimeInterval ((2014, 0, 0, 0, 0, 0), (2017, 0, 0, 0, 0, 0)) Year)              [ "下三年"+             , "三年後"+             , "三年之後"              ]   , examples (datetime (2013, 2, 12, 15, 0, 0) Hour)              [ "三点"              , "三點"              , "3pm"+             , "下午三點"+             , "晏晝三點"+             , "下午三時"              ]   , examples (datetime (2013, 2, 12, 15, 15, 0) Minute)              [ "下午三点十五"@@ -357,12 +439,14 @@              , "3:15PM"              , "3:15p"              , "下午三點十五"+             , "晏晝三點十五"              ]   , examples (datetime (2013, 2, 12, 13, 0, 0) Minute)              [ "4pm CET"              ]   , examples (datetime (2015, 4, 14, 0, 0, 0) Day)              [ "2015年4月14号"+             , "2015年4月14號"              ]   , examples (datetime (2013, 2, 12, 20, 0, 0) Hour)              [ "今晚8点"
Duckling/Time/ZH/Rules.hs view
@@ -40,7 +40,7 @@ ruleTheDayAfterTomorrow = Rule   { name = "the day after tomorrow"   , pattern =-    [ regex "\x540e\x5929|\x5f8c\x5929"+    [ regex "\x540e\x5929|\x5f8c\x5929|\x5f8c\x65e5"     ]   , prod = \_ -> tt $ cycleNth TG.Day 2   }@@ -109,7 +109,7 @@   { name = "relative minutes after|past noon|midnight"   , pattern =     [ Predicate isMidnightOrNoon-    , regex "\x8fc7"+    , regex "\x8fc7|\x904e"     , Predicate $ isIntegerBetween 1 59     ]   , prod = \tokens -> case tokens of@@ -260,7 +260,7 @@ ruleThisDayofweek = Rule   { name = "this <day-of-week>"   , pattern =-    [ regex "\x8fd9|\x9019"+    [ regex "\x8fd9|\x9019|\x4eca(\x4e2a|\x500b)"     , Predicate isADayOfWeek     ]   , prod = \tokens -> case tokens of@@ -297,7 +297,7 @@ ruleLastTime = Rule   { name = "last <time>"   , pattern =-    [ regex "\x53bb"+    [ regex "\x53bb|\x4e0a(\x4e2a|\x500b)?"     , dimension Time     ]   , prod = \tokens -> case tokens of@@ -341,7 +341,7 @@ ruleNow = Rule   { name = "now"   , pattern =-    [ regex "\x73b0\x5728|\x6b64\x65f6|\x6b64\x523b|\x5f53\x524d|\x73fe\x5728|\x6b64\x6642|\x7576\x524d"+    [ regex "\x73b0\x5728|\x6b64\x65f6|\x6b64\x523b|\x5f53\x524d|\x73fe\x5728|\x6b64\x6642|\x7576\x524d|\x5b9c\x5bb6|\x800c\x5bb6|\x4f9d\x5bb6"     ]   , prod = \_ -> tt $ cycleNth TG.Second 0   }@@ -407,7 +407,7 @@ ruleToday = Rule   { name = "today"   , pattern =-    [ regex "\x4eca\x5929"+    [ regex "\x4eca\x5929|\x4eca\x65e5"     ]   , prod = \_ -> tt $ cycleNth TG.Day 0   }@@ -416,7 +416,7 @@ ruleThisnextDayofweek = Rule   { name = "this|next <day-of-week>"   , pattern =-    [ regex "\x4eca|\x660e|\x4e0b(\x4e2a|\x500b)?"+    [ regex "\x4eca(\x4e2a|\x500b)?|\x660e|\x4e0b(\x4e2a|\x500b)?"     , Predicate isADayOfWeek     ]   , prod = \tokens -> case tokens of@@ -429,7 +429,7 @@ ruleTheDayBeforeYesterday = Rule   { name = "the day before yesterday"   , pattern =-    [ regex "\x524d\x5929"+    [ regex "\x524d\x5929|\x524d\x65e5"     ]   , prod = \_ -> tt . cycleNth TG.Day $ - 2   }@@ -479,7 +479,7 @@   { name = "<duration> from now"   , pattern =     [ dimension Duration-    , regex "\x540e|\x5f8c"+    , regex "\x540e|\x5f8c|\x4e4b\x5f8c"     ]   , prod = \tokens -> case tokens of       (Token Duration dd:_) ->@@ -504,13 +504,13 @@ ruleAfternoon = Rule   { name = "afternoon"   , pattern =-    [ regex "\x4e0b\x5348|\x4e2d\x5348"+    [ regex "\x4e0b\x5348|\x4e2d\x5348|\x664f\x665d"     ]   , prod = \_ ->       let from = hour False 12           to = hour False 19-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNamedmonth4 :: Rule@@ -526,7 +526,7 @@ ruleMidnight = Rule   { name = "midnight"   , pattern =-    [ regex "\x5348\x591c|\x51cc\x6668"+    [ regex "\x5348\x591c|\x51cc\x6668|\x534a\x591c"     ]   , prod = \_ -> tt $ hour False 0   }@@ -622,7 +622,7 @@   { name = "<duration> ago"   , pattern =     [ dimension Duration-    , regex "\x524d"+    , regex "(\x4e4b)?\x524d"     ]   , prod = \tokens -> case tokens of       (Token Duration dd:_) ->@@ -659,6 +659,21 @@       _ -> Nothing   } +ruleNCycleLast :: Rule+ruleNCycleLast = Rule+  { name = "n <cycle> last"+  , pattern =+    [ Predicate $ isIntegerBetween 1 9999+    , dimension TimeGrain+    , regex "(\x4e4b)?\x524d"+    ]+  , prod = \tokens -> case tokens of+      (token:Token TimeGrain grain:_) -> do+        v <- getIntValue token+        tt $ cycleN True grain (- v)+      _ -> Nothing+}+ ruleIntersect :: Rule ruleIntersect = Rule   { name = "intersect"@@ -713,14 +728,14 @@   , prod = \_ -> do       from <- intersect (dayOfWeek 5) (hour False 18)       to <- intersect (dayOfWeek 1) (hour False 0)-      tt $ interval TTime.Open (from, to)+      Token Time <$> interval TTime.Open from to   }  ruleLastYear :: Rule ruleLastYear = Rule   { name = "last year"   , pattern =-    [ regex "\x53bb\x5e74"+    [ regex "\x53bb\x5e74|\x4e0a\x5e74"     ]   , prod = \_ -> tt . cycleNth TG.Year $ - 1   }@@ -781,24 +796,39 @@       _ -> Nothing   } +ruleNCycleNext :: Rule+ruleNCycleNext = Rule+  { name = "next n <cycle>"+  , pattern =+    [ Predicate $ isIntegerBetween 1 9999+    , dimension TimeGrain+    , regex "\x4e0b|(\x4e4b)?\x540e|(\x4e4b)?\x5f8c"+    ]+  , prod = \tokens -> case tokens of+      (token:Token TimeGrain grain:_) -> do+        v <- getIntValue token+        tt $ cycleN True grain v+      _ -> Nothing+  }+ ruleMorning :: Rule ruleMorning = Rule   { name = "morning"   , pattern =-    [ regex "\x65e9\x4e0a|\x65e9\x6668"+    [ regex "\x65e9\x4e0a|\x65e9\x6668|\x671d(\x982d)?\x65e9"     ]   , prod = \_ ->       let from = hour False 4           to = hour False 12-      in tt . mkLatent . partOfDay $-           interval TTime.Open (from, to)+      in Token Time . mkLatent . partOfDay <$>+           interval TTime.Open from to   }  ruleNextYear :: Rule ruleNextYear = Rule   { name = "next year"   , pattern =-    [ regex "\x660e\x5e74"+    [ regex "\x660e\x5e74|\x4e0b\x5e74"     ]   , prod = \_ -> tt $ cycleNth TG.Year 1   }@@ -807,7 +837,7 @@ ruleThisCycle = Rule   { name = "this <cycle>"   , pattern =-    [ regex "(\x8fd9|\x9019)(\x4e00)?"+    [ regex "(\x8fd9|\x9019)(\x4e00)?|\x4eca\x500b"     , dimension TimeGrain     ]   , prod = \tokens -> case tokens of@@ -820,7 +850,7 @@ ruleThisTime = Rule   { name = "this <time>"   , pattern =-    [ regex "\x4eca|\x8fd9|\x9019"+    [ regex "\x4eca(\x4e2a|\x500b)?|\x8fd9(\x4e2a)?|\x9019(\x500b)?"     , dimension Time     ]   , prod = \tokens -> case tokens of@@ -833,7 +863,7 @@ ruleYesterday = Rule   { name = "yesterday"   , pattern =-    [ regex "\x6628\x5929"+    [ regex "\x6628\x5929|\x6628\x65e5|\x5c0b\x65e5"     ]   , prod = \_ -> tt . cycleNth TG.Day $ - 1   }@@ -851,12 +881,12 @@ ruleLastNight = Rule   { name = "last night"   , pattern =-    [ regex "\x6628\x665a|\x6628\x5929\x665a\x4e0a"+    [ regex "\x6628\x665a|\x6628\x5929\x665a\x4e0a|\x5c0b\x665a"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day $ - 1-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleTimeofdayAmpm :: Rule@@ -920,7 +950,7 @@ ruleNamedday7 = Rule   { name = "named-day"   , pattern =-    [ regex "\x661f\x671f\x65e5|\x661f\x671f\x5929|\x793c\x62dc\x5929|\x5468\x65e5|\x79ae\x62dc\x5929|\x9031\x65e5"+    [ regex "\x661f\x671f\x65e5|\x661f\x671f\x5929|\x793c\x62dc\x5929|\x5468\x65e5|\x79ae\x62dc\x5929|\x9031\x65e5|\x79ae\x62dc\x65e5"     ]   , prod = \_ -> tt $ dayOfWeek 7   }@@ -958,22 +988,22 @@   , pattern =     [ regex "\x4eca\x665a|\x4eca\x5929\x665a\x4e0a"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 0-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleTomorrowNight :: Rule ruleTomorrowNight = Rule   { name = "tomorrow night"   , pattern =-    [ regex "\x660e\x665a|\x660e\x5929\x665a\x4e0a"+    [ regex "\x660e\x665a|\x660e\x5929\x665a\x4e0a|\x807d\x665a"     ]-  , prod = \_ ->+  , prod = \_ -> do       let td1 = cycleNth TG.Day 1-          td2 = interval TTime.Open (hour False 18, hour False 0)-      in Token Time . partOfDay <$> intersect td1 td2+      td2 <- interval TTime.Open (hour False 18) (hour False 0)+      Token Time . partOfDay <$> intersect td1 td2   }  ruleNamedmonth10 :: Rule@@ -1042,8 +1072,8 @@   , prod = \_ ->       let from = hour False 18           to = hour False 0-      in tt . partOfDay . mkLatent $-           interval TTime.Open (from, to)+      in Token Time . partOfDay . mkLatent <$>+           interval TTime.Open from to   }  ruleNamedday3 :: Rule@@ -1074,7 +1104,7 @@ ruleTomorrow = Rule   { name = "tomorrow"   , pattern =-    [ regex "\x660e\x5929"+    [ regex "\x660e\x5929|\x660e\x65e5|\x807d\x65e5"     ]   , prod = \_ -> tt $ cycleNth TG.Day 1   }@@ -1084,7 +1114,7 @@   { name = "<time-of-day> o'clock"   , pattern =     [ Predicate isATimeOfDay-    , regex "\x9ede|\x70b9"+    , regex "\x9ede|\x70b9|\x6642"     ]   , prod = \tokens -> case tokens of       (Token Time td:_) ->@@ -1136,6 +1166,7 @@   , ruleLaborDay   , ruleLastCycle   , ruleLastNCycle+  , ruleNCycleLast   , ruleLastNight   , ruleLastTime   , ruleLastTuesdayLastJuly@@ -1169,6 +1200,7 @@   , ruleNewYearsDay   , ruleNextCycle   , ruleNextNCycle+  , ruleNCycleNext   , ruleNextTime   , ruleNextYear   , ruleNoon
+ Duckling/TimeGrain/TR/Rules.hs view
@@ -0,0 +1,41 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.TimeGrain.TR.Rules+  ( rules+  ) where++import Data.String+import Data.Text (Text)+import Prelude++import Duckling.Dimensions.Types+import Duckling.Types+import qualified Duckling.TimeGrain.Types  as TG++grains :: [(Text, String, TG.Grain)]+grains = [ ("saniye (grain)",     "sa?n(iye)?",           TG.Second)+         , ("dakika (grain)",     "da?k(ika)?",           TG.Minute)+         , ("saat (grain)",       "sa(at)?",              TG.Hour)+         , ("gün (grain)",        "g\x00fcn",             TG.Day)+         , ("hafta (grain)",      "hafta",                TG.Week)+         , ("ay (grain)",         "ay",                   TG.Month)+         , ("çeyrek yıl (grain)", "\231eyrek y\305l",     TG.Quarter)+         , ("yıl (grain)",        "y\305l",               TG.Year)+         ]++rules :: [Rule]+rules = map go grains+  where+    go (name, regexPattern, grain) = Rule+      { name = name+      , pattern = [regex regexPattern]+      , prod = \_ -> Just $ Token TimeGrain grain+      }
Duckling/TimeGrain/ZH/Rules.hs view
@@ -23,9 +23,11 @@ grains :: [(Text, String, TG.Grain)] grains = [ ("second (grain)", "\x79d2(\x949f|\x9418)?", TG.Second)          , ("minute (grain)", "\x5206(\x949f|\x9418)?", TG.Minute)-         , ("hour (grain)", "\x5c0f\x65f6|\x5c0f\x6642", TG.Hour)-         , ("day (grain)", "\x5929", TG.Day)-         , ("week (grain)", "\x5468|\x9031|\x793c\x62dc|\x79ae\x62dc", TG.Week)+         , ("hour (grain)",+             "\x5c0f\x65f6|\x5c0f\x6642|\x9418(\x982d)?", TG.Hour)+         , ("day (grain)", "\x5929|\x65e5", TG.Day)+         , ("week (grain)",+             "\x5468|\x9031|\x793c\x62dc|\x79ae\x62dc|\x661f\x671f", TG.Week)          , ("month (grain)", "\x6708", TG.Month)          , ("year (grain)", "\x5e74", TG.Year)          ]
Duckling/Types.hs view
@@ -129,7 +129,7 @@ data Entity = Entity   { dim   :: Text   , body  :: Text-  , value :: Text+  , value :: Value   , start :: Int   , end   :: Int   } deriving (Eq, Generic, Show, NFData)@@ -138,7 +138,7 @@   toEncoding = genericToEncoding defaultOptions  toJText :: ToJSON x => x -> Text-toJText j = Text.decodeUtf8 $ LB.toStrict $ encode j+toJText = Text.decodeUtf8 . LB.toStrict . encode  -- ----------------------------------------------------------------- -- Predicates helpers
+ Duckling/Volume/TR/Corpus.hs view
@@ -0,0 +1,44 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE OverloadedStrings #-}++module Duckling.Volume.TR.Corpus+  ( corpus ) where++import Data.String+import Prelude++import Duckling.Lang+import Duckling.Resolve+import Duckling.Testing.Types+import Duckling.Volume.Types++corpus :: Corpus+corpus = (testContext {lang = TR}, allExamples)++allExamples :: [Example]+allExamples = concat+  [ examples (VolumeValue Millilitre 250)+             [ "250 mililitre"+             , "250ml"+             , "250 ml"+             ]+  , examples (VolumeValue Litre 2)+             [ "2 litre" ]+  , examples (VolumeValue Gallon 3)+             [ "3 galon"+             , "3 gal"+             ]+  , examples (VolumeValue Hectolitre 3)+             [ "3 hektolitre"+             ]+  , examples (VolumeValue Litre 0.5)+             [ "yarım litre"+             ]+  ]
+ Duckling/Volume/TR/Rules.hs view
@@ -0,0 +1,51 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++{-# LANGUAGE GADTs #-}+{-# LANGUAGE OverloadedStrings #-}++module Duckling.Volume.TR.Rules+  ( rules ) where++import Data.String+import Data.Text (Text)+import Prelude++import Duckling.Dimensions.Types+import Duckling.Types+import Duckling.Volume.Helpers+import qualified Duckling.Volume.Types as TVolume++ruleHalfLiter :: Rule+ruleHalfLiter = Rule+  { name = "half liter"+  , pattern = [ regex "yar\305m l(t|itre)" ]+  , prod = \_ -> Just . Token Volume . withUnit TVolume.Litre $ volume 0.5+  }++volumes :: [(Text, String, TVolume.Unit)]+volumes = [ ("<latent vol> ml"    , "m(l|ililitre)" , TVolume.Millilitre)+          , ("<vol> hectoliters"  , "hektolitre"    , TVolume.Hectolitre)+          , ("<vol> liters"       , "l(t|itre)"     , TVolume.Litre)+          , ("<latent vol> gallon", "gal(l?on?)?"   , TVolume.Gallon)+          ]++ruleVolumes :: [Rule]+ruleVolumes = map go volumes+  where+    go :: (Text, String, TVolume.Unit) -> Rule+    go (name, regexPattern, u) = Rule+      { name = name+      , pattern = [ dimension Volume, regex regexPattern ]+      , prod = \tokens -> case tokens of+          (Token Volume vd:_) -> Just . Token Volume $ withUnit u vd+          _ -> Nothing+      }++rules :: [Rule]+rules = ruleHalfLiter:ruleVolumes
README.md view
@@ -17,6 +17,8 @@ ``` brew install pcre ```+If that doesn't help, try running `brew doctor` and fix+the issues it finds.  ## Quickstart To compile and run the binary:@@ -79,6 +81,7 @@  `Duckling.Debug` provides a few debugging tools: ```+$ stack repl --no-load > :l Duckling.Debug > debug EN "in two minutes" [This Time] in|within|after <duration> (in two minutes)
duckling.cabal view
@@ -1,5 +1,5 @@ name:                duckling-version:             0.1.0.0+version:             0.1.1.0 synopsis:            A Haskell library for parsing text into structured data. description:   Duckling is a library for parsing text into structured data.@@ -40,6 +40,7 @@                      , Duckling.Rules                      , Duckling.Rules.Common                      , Duckling.Rules.AR+                     , Duckling.Rules.CS                      , Duckling.Rules.DA                      , Duckling.Rules.DE                      , Duckling.Rules.EN@@ -72,32 +73,33 @@                      , Duckling.Ranking.Extraction                      , Duckling.Ranking.Rank                      , Duckling.Ranking.Classifiers+                     , Duckling.Ranking.Classifiers.AR+                     , Duckling.Ranking.Classifiers.CS                      , Duckling.Ranking.Classifiers.DA                      , Duckling.Ranking.Classifiers.DE                      , Duckling.Ranking.Classifiers.EN                      , Duckling.Ranking.Classifiers.ES+                     , Duckling.Ranking.Classifiers.ET                      , Duckling.Ranking.Classifiers.FR                      , Duckling.Ranking.Classifiers.GA                      , Duckling.Ranking.Classifiers.HE                      , Duckling.Ranking.Classifiers.HR+                     , Duckling.Ranking.Classifiers.ID                      , Duckling.Ranking.Classifiers.IT+                     , Duckling.Ranking.Classifiers.JA                      , Duckling.Ranking.Classifiers.KO+                     , Duckling.Ranking.Classifiers.MY                      , Duckling.Ranking.Classifiers.NB+                     , Duckling.Ranking.Classifiers.NL                      , Duckling.Ranking.Classifiers.PL                      , Duckling.Ranking.Classifiers.PT                      , Duckling.Ranking.Classifiers.RO-                     , Duckling.Ranking.Classifiers.SV-                     , Duckling.Ranking.Classifiers.ZH-                     , Duckling.Ranking.Classifiers.AR-                     , Duckling.Ranking.Classifiers.ET-                     , Duckling.Ranking.Classifiers.ID-                     , Duckling.Ranking.Classifiers.JA-                     , Duckling.Ranking.Classifiers.MY-                     , Duckling.Ranking.Classifiers.NL                      , Duckling.Ranking.Classifiers.RU+                     , Duckling.Ranking.Classifiers.SV                      , Duckling.Ranking.Classifiers.TR                      , Duckling.Ranking.Classifiers.UK                      , Duckling.Ranking.Classifiers.VI+                     , Duckling.Ranking.Classifiers.ZH    -- ------------------------------------------------------------------   -- Dimensions@@ -105,6 +107,7 @@                      , Duckling.Dimensions.Common                      , Duckling.Dimensions.Types                      , Duckling.Dimensions.AR+                     , Duckling.Dimensions.CS                      , Duckling.Dimensions.DA                      , Duckling.Dimensions.DE                      , Duckling.Dimensions.EN@@ -161,6 +164,8 @@                      , Duckling.AmountOfMoney.Types                       -- Distance+                     , Duckling.Distance.CS.Corpus+                     , Duckling.Distance.CS.Rules                      , Duckling.Distance.EN.Corpus                      , Duckling.Distance.EN.Rules                      , Duckling.Distance.ES.Corpus@@ -179,6 +184,8 @@                      , Duckling.Distance.NL.Rules                      , Duckling.Distance.RO.Corpus                      , Duckling.Distance.RO.Rules+                     , Duckling.Distance.TR.Corpus+                     , Duckling.Distance.TR.Rules                      , Duckling.Distance.Helpers                      , Duckling.Distance.Rules                      , Duckling.Distance.Types@@ -208,6 +215,8 @@                      , Duckling.Duration.ZH.Corpus                      , Duckling.Duration.RO.Corpus                      , Duckling.Duration.RO.Rules+                     , Duckling.Duration.TR.Corpus+                     , Duckling.Duration.TR.Rules                      , Duckling.Duration.Helpers                      , Duckling.Duration.Rules                      , Duckling.Duration.Types@@ -226,6 +235,8 @@                      -- Numeral                      , Duckling.Numeral.AR.Corpus                      , Duckling.Numeral.AR.Rules+                     , Duckling.Numeral.CS.Corpus+                     , Duckling.Numeral.CS.Rules                      , Duckling.Numeral.DA.Corpus                      , Duckling.Numeral.DA.Rules                      , Duckling.Numeral.DE.Corpus@@ -379,6 +390,8 @@                      , Duckling.Temperature.PT.Rules                      , Duckling.Temperature.RO.Corpus                      , Duckling.Temperature.RO.Rules+                     , Duckling.Temperature.TR.Corpus+                     , Duckling.Temperature.TR.Rules                      , Duckling.Temperature.ZH.Corpus                      , Duckling.Temperature.ZH.Rules                      , Duckling.Temperature.Helpers@@ -443,6 +456,7 @@                      , Duckling.TimeGrain.PT.Rules                      , Duckling.TimeGrain.RO.Rules                      , Duckling.TimeGrain.SV.Rules+                     , Duckling.TimeGrain.TR.Rules                      , Duckling.TimeGrain.VI.Rules                      , Duckling.TimeGrain.ZH.Rules                      , Duckling.TimeGrain.Types@@ -474,6 +488,8 @@                      , Duckling.Volume.NL.Rules                      , Duckling.Volume.RO.Corpus                      , Duckling.Volume.RO.Rules+                     , Duckling.Volume.TR.Corpus+                     , Duckling.Volume.TR.Rules                      , Duckling.Volume.Helpers                      , Duckling.Volume.Rules                      , Duckling.Volume.Types@@ -496,7 +512,6 @@                      , unordered-containers  >= 0.2.7.2 && < 0.3   default-language:    Haskell2010   default-extensions:  OverloadedStrings-                     , RebindableSyntax  test-suite duckling-test   type:                exitcode-stdio-1.0@@ -536,6 +551,7 @@                      , Duckling.AmountOfMoney.Tests                       -- Distance+                     , Duckling.Distance.CS.Tests                      , Duckling.Distance.EN.Tests                      , Duckling.Distance.ES.Tests                      , Duckling.Distance.FR.Tests@@ -545,6 +561,7 @@                      , Duckling.Distance.NL.Tests                      , Duckling.Distance.PT.Tests                      , Duckling.Distance.RO.Tests+                     , Duckling.Distance.TR.Tests                      , Duckling.Distance.Tests                       -- Duration@@ -558,6 +575,7 @@                      , Duckling.Duration.PT.Tests                      , Duckling.Duration.RO.Tests                      , Duckling.Duration.SV.Tests+                     , Duckling.Duration.TR.Tests                      , Duckling.Duration.ZH.Tests                      , Duckling.Duration.Tests @@ -569,6 +587,7 @@                       -- Numeral                      , Duckling.Numeral.AR.Tests+                     , Duckling.Numeral.CS.Tests                      , Duckling.Numeral.DA.Tests                      , Duckling.Numeral.DE.Tests                      , Duckling.Numeral.EN.Tests@@ -646,8 +665,9 @@                      , Duckling.Temperature.JA.Tests                      , Duckling.Temperature.KO.Tests                      , Duckling.Temperature.PT.Tests-                     , Duckling.Temperature.ZH.Tests                      , Duckling.Temperature.RO.Tests+                     , Duckling.Temperature.TR.Tests+                     , Duckling.Temperature.ZH.Tests                      , Duckling.Temperature.Tests                       -- Time@@ -684,6 +704,7 @@                      , Duckling.Volume.PT.Tests                      , Duckling.Volume.NL.Tests                      , Duckling.Volume.RO.Tests+                     , Duckling.Volume.TR.Tests                      , Duckling.Volume.Tests    ghc-options:         -threaded -rtsopts -with-rtsopts=-N
exe/Duckling/Ranking/Generate.hs view
@@ -69,6 +69,7 @@     -- | The training set (corpus)     trainSet = case lang of       AR -> (testContext, [])+      CS -> (testContext, [])       DA -> DATime.corpus       DE -> DETime.corpus       EN -> ENTime.corpus
exe/ExampleMain.hs view
@@ -8,23 +8,25 @@  {-# LANGUAGE OverloadedStrings #-} -import Prelude import Control.Applicative import Control.Arrow ((***))+import Control.Monad (unless) import Control.Monad.IO.Class import Data.Aeson import Data.ByteString (ByteString)-import qualified Data.ByteString.Lazy as LBS import Data.HashMap.Strict (HashMap)-import qualified Data.HashMap.Strict as HashMap import Data.Maybe import Data.Text (Text)-import qualified Data.Text as Text-import qualified Data.Text.Encoding as Text import Data.Time.LocalTime.TimeZone.Series import Data.String+import Prelude+import System.Directory import TextShow import Text.Read (readMaybe)+import qualified Data.ByteString.Lazy as LBS+import qualified Data.HashMap.Strict as HashMap+import qualified Data.Text as Text+import qualified Data.Text.Encoding as Text  import Snap.Core import Snap.Http.Server@@ -32,8 +34,20 @@ import Duckling.Core import Duckling.Data.TimeZone +createIfMissing :: FilePath -> IO ()+createIfMissing f = do+  exists <- doesFileExist f+  unless exists $ writeFile f ""++setupLogs :: IO ()+setupLogs = do+  createDirectoryIfMissing False "log"+  createIfMissing "log/error.log"+  createIfMissing "log/access.log"+ main :: IO () main = do+  setupLogs   tzs <- loadTimeZoneSeries "/usr/share/zoneinfo/"   quickHttpServe $     ifTop (writeBS "quack!") <|>
tests/Duckling/Api/Tests.hs view
@@ -43,7 +43,7 @@     (Entity dim body value start end:_) -> do       assertEqual "dim" "number" dim       assertEqual "body" "42" body-      assertEqual "value" val value+      assertEqual "value" val (toJText value)       assertEqual "start" 4 start       assertEqual "end" 6 end   where
+ tests/Duckling/Distance/CS/Tests.hs view
@@ -0,0 +1,22 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Distance.CS.Tests+  ( tests ) where++import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Distance.CS.Corpus+import Duckling.Testing.Asserts++tests :: TestTree+tests = testGroup "CS Tests"+  [ makeCorpusTest [This Distance] corpus+  ]
+ tests/Duckling/Distance/TR/Tests.hs view
@@ -0,0 +1,22 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Distance.TR.Tests+  ( tests ) where++import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Distance.TR.Corpus+import Duckling.Testing.Asserts++tests :: TestTree+tests = testGroup "TR Tests"+  [ makeCorpusTest [This Distance] corpus+  ]
tests/Duckling/Distance/Tests.hs view
@@ -12,6 +12,7 @@ import Data.String import Test.Tasty +import qualified Duckling.Distance.CS.Tests as CS import qualified Duckling.Distance.EN.Tests as EN import qualified Duckling.Distance.ES.Tests as ES import qualified Duckling.Distance.FR.Tests as FR@@ -21,10 +22,12 @@ import qualified Duckling.Distance.NL.Tests as NL import qualified Duckling.Distance.PT.Tests as PT import qualified Duckling.Distance.RO.Tests as RO+import qualified Duckling.Distance.TR.Tests as TR  tests :: TestTree tests = testGroup "Distance Tests"-  [ EN.tests+  [ CS.tests+  , EN.tests   , ES.tests   , FR.tests   , GA.tests@@ -33,4 +36,5 @@   , NL.tests   , PT.tests   , RO.tests+  , TR.tests   ]
+ tests/Duckling/Duration/TR/Tests.hs view
@@ -0,0 +1,24 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Duration.TR.Tests+  ( tests+  ) where++import Prelude+import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Duration.TR.Corpus+import Duckling.Testing.Asserts++tests :: TestTree+tests = testGroup "TR Tests"+  [ makeCorpusTest [This Duration] corpus+  ]
tests/Duckling/Duration/Tests.hs view
@@ -24,6 +24,7 @@ import qualified Duckling.Duration.PT.Tests as PT import qualified Duckling.Duration.RO.Tests as RO import qualified Duckling.Duration.SV.Tests as SV+import qualified Duckling.Duration.TR.Tests as TR import qualified Duckling.Duration.ZH.Tests as ZH  tests :: TestTree@@ -38,5 +39,6 @@   , PT.tests   , RO.tests   , SV.tests+  , TR.tests   , ZH.tests   ]
+ tests/Duckling/Numeral/CS/Tests.hs view
@@ -0,0 +1,23 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Numeral.CS.Tests+  ( tests ) where++import Prelude+import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Numeral.CS.Corpus+import Duckling.Testing.Asserts++tests :: TestTree+tests = testGroup "CS Tests"+  [ makeCorpusTest [This Numeral] corpus+  ]
tests/Duckling/Numeral/Tests.hs view
@@ -13,6 +13,7 @@ import Test.Tasty  import qualified Duckling.Numeral.AR.Tests as AR+import qualified Duckling.Numeral.CS.Tests as CS import qualified Duckling.Numeral.DA.Tests as DA import qualified Duckling.Numeral.DE.Tests as DE import qualified Duckling.Numeral.EN.Tests as EN@@ -42,6 +43,7 @@ tests :: TestTree tests = testGroup "Numeral Tests"   [ AR.tests+  , CS.tests   , DA.tests   , DE.tests   , EN.tests
tests/Duckling/Ordinal/DE/Tests.hs view
@@ -20,4 +20,5 @@ tests :: TestTree tests = testGroup "DE Tests"   [ makeCorpusTest [This Ordinal] corpus+  , makeNegativeCorpusTest [This Ordinal] negativeCorpus   ]
+ tests/Duckling/Temperature/TR/Tests.hs view
@@ -0,0 +1,24 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Temperature.TR.Tests+  ( tests+  ) where++import Prelude+import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Temperature.TR.Corpus+import Duckling.Testing.Asserts++tests :: TestTree+tests = testGroup "TR Tests"+  [ makeCorpusTest [This Temperature] corpus+  ]
tests/Duckling/Temperature/Tests.hs view
@@ -22,6 +22,7 @@ import qualified Duckling.Temperature.KO.Tests as KO import qualified Duckling.Temperature.PT.Tests as PT import qualified Duckling.Temperature.RO.Tests as RO+import qualified Duckling.Temperature.TR.Tests as TR import qualified Duckling.Temperature.ZH.Tests as ZH  tests :: TestTree@@ -36,5 +37,6 @@   , KO.tests   , PT.tests   , RO.tests+  , TR.tests   , ZH.tests   ]
+ tests/Duckling/Volume/TR/Tests.hs view
@@ -0,0 +1,24 @@+-- Copyright (c) 2016-present, Facebook, Inc.+-- All rights reserved.+--+-- This source code is licensed under the BSD-style license found in the+-- LICENSE file in the root directory of this source tree. An additional grant+-- of patent rights can be found in the PATENTS file in the same directory.+++module Duckling.Volume.TR.Tests+  ( tests+  ) where++import Prelude+import Data.String+import Test.Tasty++import Duckling.Dimensions.Types+import Duckling.Testing.Asserts+import Duckling.Volume.TR.Corpus++tests :: TestTree+tests = testGroup "TR Tests"+  [ makeCorpusTest [This Volume] corpus+  ]
tests/Duckling/Volume/Tests.hs view
@@ -22,6 +22,7 @@ import qualified Duckling.Volume.NL.Tests as NL import qualified Duckling.Volume.PT.Tests as PT import qualified Duckling.Volume.RO.Tests as RO+import qualified Duckling.Volume.TR.Tests as TR  tests :: TestTree tests = testGroup "Volume Tests"@@ -35,4 +36,5 @@   , NL.tests   , PT.tests   , RO.tests+  , TR.tests   ]