2017-03-08 21:33:55 +03:00
|
|
|
-- 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 NoRebindableSyntax #-}
|
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
|
|
|
|
module Duckling.Time.RO.Rules
|
|
|
|
( rules ) where
|
|
|
|
|
2017-08-18 01:11:38 +03:00
|
|
|
import Data.Text (Text)
|
2017-03-08 21:33:55 +03:00
|
|
|
import Prelude
|
|
|
|
|
|
|
|
import Duckling.Dimensions.Types
|
2017-03-16 23:42:15 +03:00
|
|
|
import Duckling.Numeral.Helpers (parseInt)
|
2017-03-08 21:33:55 +03:00
|
|
|
import Duckling.Regex.Types
|
|
|
|
import Duckling.Time.Helpers
|
|
|
|
import Duckling.Time.Types (TimeData (..))
|
2017-10-06 21:39:11 +03:00
|
|
|
import Duckling.Types
|
2018-03-02 01:22:27 +03:00
|
|
|
import qualified Data.Text as Text
|
2017-03-08 21:33:55 +03:00
|
|
|
import qualified Duckling.Time.Types as TTime
|
|
|
|
import qualified Duckling.TimeGrain.Types as TG
|
|
|
|
|
|
|
|
ruleAcum :: Rule
|
|
|
|
ruleAcum = Rule
|
|
|
|
{ name = "acum"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(chiar)? ?acum|imediat"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ cycleNth TG.Second 0
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleDupamiaza :: Rule
|
|
|
|
ruleDupamiaza = Rule
|
|
|
|
{ name = "dupamiaza"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "dupamiaz(a|ă)|dup(a|ă) amiaz(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
|
|
|
interval TTime.Open (hour False 12) (hour False 19)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleValentinesDay :: Rule
|
|
|
|
ruleValentinesDay = Rule
|
|
|
|
{ name = "valentine's day"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "sf\\.?((a|â)ntul)? Valentin"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 2 14
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleSinceTimeofday :: Rule
|
|
|
|
ruleSinceTimeofday = Rule
|
|
|
|
{ name = "since <time-of-day>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "de|din"
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ withDirection TTime.After td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleNewYearsDay :: Rule
|
|
|
|
ruleNewYearsDay = Rule
|
|
|
|
{ name = "new year's day"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(siua de )? an(ul)? nou"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 1 1
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleOrdinalTrimestruYear :: Rule
|
|
|
|
ruleOrdinalTrimestruYear = Rule
|
|
|
|
{ name = "<ordinal> trimestru <year>"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Ordinal
|
|
|
|
, Predicate $ isGrain TG.Quarter
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_:Token Time td:_) -> do
|
|
|
|
n <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ cycleNthAfter False TG.Quarter (n - 1) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleInNamedmonth :: Rule
|
|
|
|
ruleInNamedmonth = Rule
|
|
|
|
{ name = "in <named-month>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(i|î)n"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isAMonth
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:x:_) -> Just x
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleLastCycleOfTime :: Rule
|
|
|
|
ruleLastCycleOfTime = Rule
|
|
|
|
{ name = "last <cycle> of <time>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ultim(ul|a)"
|
|
|
|
, dimension TimeGrain
|
|
|
|
, regex "din"
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token TimeGrain grain:_:Token Time td:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ cycleLastOf grain td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleIntroNamedday :: Rule
|
|
|
|
ruleIntroNamedday = Rule
|
|
|
|
{ name = "intr-o <named-day>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "((i|î)n(tr)?(\\-?o)?)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isADayOfWeek
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:x:_) -> Just x
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleMonthDdddInterval :: Rule
|
|
|
|
ruleMonthDdddInterval = Rule
|
|
|
|
{ name = "<month> dd-dd (interval)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isAMonth
|
|
|
|
, regex "(3[01]|[12]\\d|0?[1-9])"
|
|
|
|
, regex "\\-"
|
|
|
|
, regex "(3[01]|[12]\\d|0?[1-9])"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:
|
|
|
|
Token RegexMatch (GroupMatch (m1:_)):
|
|
|
|
_:
|
|
|
|
Token RegexMatch (GroupMatch (m2:_)):
|
|
|
|
_) -> do
|
|
|
|
d1 <- parseInt m1
|
|
|
|
d2 <- parseInt m2
|
2017-04-18 19:54:32 +03:00
|
|
|
dom1 <- intersect (dayOfMonth d1) td
|
|
|
|
dom2 <- intersect (dayOfMonth d2) td
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Closed dom1 dom2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleInDuration :: Rule
|
|
|
|
ruleInDuration = Rule
|
|
|
|
{ name = "in <duration>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(i|î)n"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Duration
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Duration dd:_) -> tt $ inDuration dd
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleIeri :: Rule
|
|
|
|
ruleIeri = Rule
|
|
|
|
{ name = "ieri"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ieri"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt . cycleNth TG.Day $ - 1
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleCycleAcesta :: Rule
|
|
|
|
ruleCycleAcesta = Rule
|
|
|
|
{ name = "<cycle> acesta"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "aceasta|acest|(a|ă)sta"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension TimeGrain
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token TimeGrain grain:_) -> tt $ cycleNth grain 0
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleYearLatent2 :: Rule
|
|
|
|
ruleYearLatent2 = Rule
|
|
|
|
{ name = "year (latent)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate $ isIntegerBetween 2101 10000
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . mkLatent $ year v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleAzi :: Rule
|
|
|
|
ruleAzi = Rule
|
|
|
|
{ name = "azi"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "a(st(a|ă))?zi"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ cycleNth TG.Day 0
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleNoon :: Rule
|
|
|
|
ruleNoon = Rule
|
|
|
|
{ name = "noon"
|
|
|
|
, pattern =
|
|
|
|
[ regex "noon"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ hour False 12
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimeTrecuta :: Rule
|
|
|
|
ruleTimeTrecuta = Rule
|
|
|
|
{ name = "<time> trecut[aă]?"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Time
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(trecut(a|ă)?)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ predNth (-1) False td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleThisnextDayofweek :: Rule
|
|
|
|
ruleThisnextDayofweek = Rule
|
|
|
|
{ name = "this|next <day-of-week>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isADayOfWeek
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "aceasta|(a|ă)sta|urm(a|ă)toare"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(Token Time td:_) -> tt $ predNth 0 True td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
|
|
|
|
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
|
|
|
{ name = "between <time-of-day> and <time-of-day> (interval)"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(i|î)ntre"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isATimeOfDay
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(s|ș)i"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isATimeOfDay
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td1:_:Token Time td2:_) ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Closed td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleUrmatoareaCycle :: Rule
|
|
|
|
ruleUrmatoareaCycle = Rule
|
|
|
|
{ name = "urmatoarea <cycle>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(urm(a|ă)to(area|rul)|viito(are|r))"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension TimeGrain
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token TimeGrain grain:_) -> tt $ cycleNth grain 1
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleCycleAcesta2 :: Rule
|
|
|
|
ruleCycleAcesta2 = Rule
|
|
|
|
{ name = "<cycle> acesta"
|
|
|
|
, pattern =
|
|
|
|
[ dimension TimeGrain
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "aceasta|acest|(a|ă)sta|curent(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(Token TimeGrain grain:_) -> tt $ cycleNth grain 0
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleCraciun :: Rule
|
|
|
|
ruleCraciun = Rule
|
|
|
|
{ name = "craciun"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(ziua de )?cr(a|ă)ciun"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 12 25
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleTrimestruNumeralYear :: Rule
|
|
|
|
ruleTrimestruNumeralYear = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "trimestru <number> <year>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate $ isGrain TG.Quarter
|
2017-03-14 23:19:13 +03:00
|
|
|
, dimension Numeral
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:token:Token Time td:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ cycleNthAfter False TG.Quarter (v - 1) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDdmm :: Rule
|
|
|
|
ruleDdmm = Rule
|
|
|
|
{ name = "dd/mm"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(3[01]|[12]\\d|0?[1-9])/(0?[1-9]|1[0-2])"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (dd:mm:_)):_) -> do
|
|
|
|
m <- parseInt mm
|
|
|
|
d <- parseInt dd
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ monthDay m d
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleLaTimeofday :: Rule
|
|
|
|
ruleLaTimeofday = Rule
|
|
|
|
{ name = "la <time-of-day>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "la|@ (ora)?"
|
|
|
|
, Predicate isATimeOfDay
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ notLatent td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleBlackFriday :: Rule
|
|
|
|
ruleBlackFriday = Rule
|
|
|
|
{ name = "black friday"
|
|
|
|
, pattern =
|
|
|
|
[ regex "black frid?day"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ nthDOWOfMonth 4 5 11
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleChristmasEve :: Rule
|
|
|
|
ruleChristmasEve = Rule
|
|
|
|
{ name = "christmas eve"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "ajun(ul)? (de )?cr(a|ă)ciun"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 12 24
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
rulePentruDuration :: Rule
|
|
|
|
rulePentruDuration = Rule
|
|
|
|
{ name = "pentru <duration>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "pentru"
|
|
|
|
, dimension Duration
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Duration dd:_) -> tt $ inDuration dd
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHourofdayIntegerAsRelativeMinutes :: Rule
|
|
|
|
ruleHourofdayIntegerAsRelativeMinutes = Rule
|
|
|
|
{ name = "<hour-of-day> <integer> (as relative minutes)"
|
|
|
|
, pattern =
|
2017-10-06 21:39:11 +03:00
|
|
|
[ Predicate $ and . sequence [isNotLatent, isAnHourOfDay]
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate $ isIntegerBetween 1 59
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:
|
|
|
|
token:
|
|
|
|
_) -> do
|
|
|
|
n <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ hourMinute is12H hours n
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHourofdaySfert :: Rule
|
|
|
|
ruleHourofdaySfert = Rule
|
|
|
|
{ name = "<hour-of-day> sfert"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isAnHourOfDay
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "((s|ș)i )?(un )?sfert"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:
|
2017-04-10 22:23:53 +03:00
|
|
|
_) -> tt $ hourMinute is12H hours 15
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHourofdayJumatate :: Rule
|
|
|
|
ruleHourofdayJumatate = Rule
|
|
|
|
{ name = "<hour-of-day> sfert"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isAnHourOfDay
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "((s|ș)i )?jum(a|ă)tate|jumate"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:
|
2017-04-10 22:23:53 +03:00
|
|
|
_) -> tt $ hourMinute is12H hours 30
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDiseara :: Rule
|
|
|
|
ruleDiseara = Rule
|
|
|
|
{ name = "diseara"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "disear(a|ă)|((i|î)n aceas(a|ă) )?sear(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> do
|
2017-03-08 21:33:55 +03:00
|
|
|
let td1 = cycleNth TG.Day 0
|
2017-05-11 01:41:26 +03:00
|
|
|
td2 <- interval TTime.Open (hour False 18) (hour False 0)
|
|
|
|
Token Time . partOfDay <$> intersect td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleIntersectBy :: Rule
|
|
|
|
ruleIntersectBy = Rule
|
|
|
|
{ name = "intersect by \",\""
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isNotLatent
|
|
|
|
, regex ","
|
|
|
|
, Predicate isNotLatent
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td1:_:Token Time td2:_) ->
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time <$> intersect td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleDayofmonthNumeral :: Rule
|
|
|
|
ruleDayofmonthNumeral = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "<day-of-month> (number)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . mkLatent $ dayOfMonth v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleNthTimeAfterTime :: Rule
|
|
|
|
ruleNthTimeAfterTime = Rule
|
|
|
|
{ name = "nth <time> after <time>"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Ordinal
|
|
|
|
, dimension Time
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "dup(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:Token Time td1:_:Token Time td2:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ predNthAfter (v - 1) td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleMmdd :: Rule
|
|
|
|
ruleMmdd = Rule
|
|
|
|
{ name = "mm/dd"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(0?[1-9]|1[0-2])/(3[01]|[12]\\d|0?[1-9])"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (mm:dd:_)):_) -> do
|
|
|
|
m <- parseInt mm
|
|
|
|
d <- parseInt dd
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ monthDay m d
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimeofdayLatent :: Rule
|
|
|
|
ruleTimeofdayLatent = Rule
|
|
|
|
{ name = "time-of-day (latent)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate $ isIntegerBetween 0 23
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . mkLatent $ hour True v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleFromTimeofdayTimeofdayInterval :: Rule
|
|
|
|
ruleFromTimeofdayTimeofdayInterval = Rule
|
|
|
|
{ name = "from <time-of-day> - <time-of-day> (interval)"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(dup(a|ă)|(i|î)ncep(a|â)nd cu)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isATimeOfDay
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(dar |(s|ș)i )?((i|î)nainte|p(a|â)n(a|ă) la( de)?)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isATimeOfDay
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td1:_:Token Time td2:_) ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Closed td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleSeason3 :: Rule
|
|
|
|
ruleSeason3 = Rule
|
|
|
|
{ name = "season"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "primavar(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> Token Time <$>
|
|
|
|
interval TTime.Open (monthDay 3 20) (monthDay 6 21)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleUrmatoareleNCycle :: Rule
|
|
|
|
ruleUrmatoareleNCycle = Rule
|
|
|
|
{ name = "urmatoarele n <cycle>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "urm(a|ă)to(arele|rii|area)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate $ isIntegerBetween 1 9999
|
|
|
|
, dimension TimeGrain
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:token:Token TimeGrain grain:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ cycleN True grain v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleSeason :: Rule
|
|
|
|
ruleSeason = Rule
|
|
|
|
{ name = "season"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "toamn(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> Token Time <$>
|
|
|
|
interval TTime.Open (monthDay 9 23) (monthDay 12 21)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleDupaDuration :: Rule
|
|
|
|
ruleDupaDuration = Rule
|
|
|
|
{ name = "dupa <duration>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "dup(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Duration
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Duration dd:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . withDirection TTime.After $ inDuration dd
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleNewYearsEve :: Rule
|
|
|
|
ruleNewYearsEve = Rule
|
|
|
|
{ name = "new year's eve"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(ajun(ul)? )?(de )?an(ul)? nou"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 12 31
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleByTheEndOfTime :: Rule
|
|
|
|
ruleByTheEndOfTime = Rule
|
|
|
|
{ name = "by the end of <time>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "p(a|î)n(a|ă) ((i|î)n|la)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td:_) ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Closed (cycleNth TG.Second 0) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleNameddayPeDayofmonthNumeral :: Rule
|
|
|
|
ruleNameddayPeDayofmonthNumeral = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "<named-day> pe <day-of-month> (number)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isADayOfWeek
|
|
|
|
, regex "pe"
|
|
|
|
, Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:_:token:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDayofmonthNonOrdinalNamedmonth :: Rule
|
|
|
|
ruleDayofmonthNonOrdinalNamedmonth = Rule
|
|
|
|
{ name = "<day-of-month> (non ordinal) <named-month>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
, Predicate isAMonth
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleIntersect :: Rule
|
|
|
|
ruleIntersect = Rule
|
|
|
|
{ name = "intersect"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isNotLatent
|
|
|
|
, Predicate isNotLatent
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td1:Token Time td2:_) ->
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time <$> intersect td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleAboutTimeofday :: Rule
|
|
|
|
ruleAboutTimeofday = Rule
|
|
|
|
{ name = "about <time-of-day>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(cam|aproximativ|(i|î)n jur de)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isATimeOfDay
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ notLatent td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleUntilTimeofday :: Rule
|
|
|
|
ruleUntilTimeofday = Rule
|
|
|
|
{ name = "until <time-of-day>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "p(a|î)n(a|ă) ((i|î)n|la)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ withDirection TTime.Before td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDayofmonthnumberNamedmonth :: Rule
|
|
|
|
ruleDayofmonthnumberNamedmonth = Rule
|
|
|
|
{ name = "<day-of-month>(number) <named-month>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
, Predicate isAMonth
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleIntreDatetimeSiDatetimeInterval :: Rule
|
|
|
|
ruleIntreDatetimeSiDatetimeInterval = Rule
|
|
|
|
{ name = "intre <datetime> si <datetime> (interval)"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "(i|î)nre"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(s|ș)i"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td1:_:Token Time td2:_) ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Closed td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleNthTimeOfTime :: Rule
|
|
|
|
ruleNthTimeOfTime = Rule
|
|
|
|
{ name = "nth <time> of <time>"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Ordinal
|
|
|
|
, dimension Time
|
|
|
|
, regex "din"
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:Token Time td1:_:Token Time td2:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time . predNth (v - 1) False <$> intersect td2 td1
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimePartofday :: Rule
|
|
|
|
ruleTimePartofday = Rule
|
|
|
|
{ name = "<time> <part-of-day>"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Time
|
|
|
|
, Predicate isAPartOfDay
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td1:Token Time td2:_) ->
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time <$> intersect td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleWeekend :: Rule
|
|
|
|
ruleWeekend = Rule
|
|
|
|
{ name = "week-end"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(week(\\s|\\-)?end|wkend)"
|
|
|
|
]
|
2017-08-22 20:16:17 +03:00
|
|
|
, prod = \_ -> tt weekend
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
rulePeDayofmonthNonOrdinal :: Rule
|
|
|
|
rulePeDayofmonthNonOrdinal = Rule
|
|
|
|
{ name = "pe <day-of-month> (non ordinal)"
|
|
|
|
, pattern =
|
|
|
|
[ regex "pe"
|
|
|
|
, Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . mkLatent $ dayOfMonth v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimeAceastaacestaasta :: Rule
|
|
|
|
ruleTimeAceastaacestaasta = Rule
|
|
|
|
{ name = "<time> (aceasta|acesta|[aă]sta)"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Time
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "aceasta|(a|ă)sta|urm(a|ă)toare"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ predNth 0 False td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleEomendOfMonth :: Rule
|
|
|
|
ruleEomendOfMonth = Rule
|
|
|
|
{ name = "EOM|End of month"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "sf(a|â)r(s|ș)itul lunii"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ cycleNth TG.Month 1
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
rulePartofdayAsta :: Rule
|
|
|
|
rulePartofdayAsta = Rule
|
|
|
|
{ name = "<part-of-day> asta"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isAPartOfDay
|
|
|
|
, regex "asta"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:_) ->
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time . partOfDay <$> intersect (cycleNth TG.Day 0) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleUltimaCycle :: Rule
|
|
|
|
ruleUltimaCycle = Rule
|
|
|
|
{ name = "ultima <cycle>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ultim(a|ul)"
|
|
|
|
, dimension TimeGrain
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token TimeGrain grain:_) -> tt . cycleNth grain $ - 1
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleCycleUrmatoare :: Rule
|
|
|
|
ruleCycleUrmatoare = Rule
|
|
|
|
{ name = "<cycle> urmatoare"
|
|
|
|
, pattern =
|
|
|
|
[ dimension TimeGrain
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(urm(a|ă)to(are|r)|viito(are|r))"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token TimeGrain grain:_) -> tt $ cycleNth grain 1
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleTheDayofmonthNumeral :: Rule
|
|
|
|
ruleTheDayofmonthNumeral = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "the <day-of-month> (number)"
|
|
|
|
, pattern =
|
|
|
|
[ regex "pe"
|
|
|
|
, Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ dayOfMonth v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleYyyymmdd :: Rule
|
|
|
|
ruleYyyymmdd = Rule
|
|
|
|
{ name = "yyyy-mm-dd"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(\\d{2,4})-(0?[1-9]|1[0-2])-(3[01]|[12]\\d|0?[1-9])"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (yy:mm:dd:_)):_) -> do
|
|
|
|
y <- parseInt yy
|
|
|
|
m <- parseInt mm
|
|
|
|
d <- parseInt dd
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ yearMonthDay y m d
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleCycleTrecut :: Rule
|
|
|
|
ruleCycleTrecut = Rule
|
|
|
|
{ name = "<cycle> trecut"
|
|
|
|
, pattern =
|
|
|
|
[ dimension TimeGrain
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "trecut(a|ă)?"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token TimeGrain grain:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . cycleNth grain $ - 1
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleDayofmonthNumeralOfNamedmonth :: Rule
|
|
|
|
ruleDayofmonthNumeralOfNamedmonth = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "<day-of-month> (number) of <named-month>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
, regex "din"
|
|
|
|
, Predicate isAMonth
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDurationInainteDeTime :: Rule
|
|
|
|
ruleDurationInainteDeTime = Rule
|
|
|
|
{ name = "<duration> inainte de <time>"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Duration
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(i|î)nainte de"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Duration dd:_:Token Time td:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ durationBefore dd td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDayofmonthNonOrdinalOfNamedmonth :: Rule
|
|
|
|
ruleDayofmonthNonOrdinalOfNamedmonth = Rule
|
|
|
|
{ name = "<day-of-month> (non ordinal) of <named-month>"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
, regex "din"
|
|
|
|
, Predicate isAMonth
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDurationInUrma :: Rule
|
|
|
|
ruleDurationInUrma = Rule
|
|
|
|
{ name = "<duration> in urma"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Duration
|
2017-09-07 22:33:31 +03:00
|
|
|
, regex "(i|î)n urm(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(Token Duration dd:_) -> tt $ durationAgo dd
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDurationDeAcum :: Rule
|
|
|
|
ruleDurationDeAcum = Rule
|
|
|
|
{ name = "<duration> de acum"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Duration
|
|
|
|
, regex "de (acum|azi)"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(Token Duration dd:_) -> tt $ inDuration dd
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleSezonAnotimp :: Rule
|
|
|
|
ruleSezonAnotimp = Rule
|
|
|
|
{ name = "sezon anotimp"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "var(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \_ ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Open (monthDay 6 21) (monthDay 9 23)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleSearaNoapte :: Rule
|
|
|
|
ruleSearaNoapte = Rule
|
|
|
|
{ name = "sear[aă] noapte"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "sear(a|ă)|noapte"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
|
|
|
interval TTime.Open (hour False 18) (hour False 0)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleYearLatent :: Rule
|
|
|
|
ruleYearLatent = Rule
|
|
|
|
{ name = "year (latent)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate $ isIntegerBetween (- 10000) 999
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . mkLatent $ year v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleSeason2 :: Rule
|
|
|
|
ruleSeason2 = Rule
|
|
|
|
{ name = "season"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "iarn(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
|
|
|
, prod = \_ ->
|
2017-05-11 01:41:26 +03:00
|
|
|
Token Time <$> interval TTime.Open (monthDay 12 21) (monthDay 3 20)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleUltimeleNCycle :: Rule
|
|
|
|
ruleUltimeleNCycle = Rule
|
|
|
|
{ name = "ultimele n <cycle>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ultim(ele|ii|a)"
|
|
|
|
, Predicate $ isIntegerBetween 1 9999
|
|
|
|
, dimension TimeGrain
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:token:Token TimeGrain grain:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ cycleN True grain (- v)
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleAfterTimeofday :: Rule
|
|
|
|
ruleAfterTimeofday = Rule
|
|
|
|
{ name = "after <time-of-day>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "dup(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ withDirection TTime.After td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDimineata :: Rule
|
|
|
|
ruleDimineata = Rule
|
|
|
|
{ name = "diminea[tț][aă]"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "diminea(t|ț)(a|ă)"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-05-11 01:41:26 +03:00
|
|
|
, prod = \_ -> Token Time . mkLatent . partOfDay <$>
|
|
|
|
interval TTime.Open (hour False 4) (hour False 12)
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimeUrmatoarer :: Rule
|
|
|
|
ruleTimeUrmatoarer = Rule
|
|
|
|
{ name = "<time> urm[aă]to(are|r)"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "urm(a|ă)to(are|r)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, Predicate isNotLatent
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(_:Token Time td:_) -> tt $ predNth 0 True td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimeofdayFix :: Rule
|
|
|
|
ruleTimeofdayFix = Rule
|
|
|
|
{ name = "<time-of-day> fix"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isATimeOfDay
|
|
|
|
, regex "(fix|exact)"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-04-10 22:23:53 +03:00
|
|
|
(Token Time td:_) -> tt $ notLatent td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHhmm :: Rule
|
|
|
|
ruleHhmm = Rule
|
|
|
|
{ name = "hh:mm"
|
|
|
|
, pattern =
|
|
|
|
[ regex "((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (hh:mm:_)):_) -> do
|
|
|
|
h <- parseInt hh
|
|
|
|
m <- parseInt mm
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ hourMinute True h m
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleMaine :: Rule
|
|
|
|
ruleMaine = Rule
|
|
|
|
{ name = "maine"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "m(a|â)ine"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ cycleNth TG.Day 1
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleTimezone :: Rule
|
|
|
|
ruleTimezone = Rule
|
|
|
|
{ name = "<time> timezone"
|
|
|
|
, pattern =
|
2017-10-06 21:39:11 +03:00
|
|
|
[ Predicate $ and . sequence [isNotLatent, isATimeOfDay]
|
2017-03-08 21:33:55 +03:00
|
|
|
, regex "\\b(YEKT|YEKST|YAKT|YAKST|WITA|WIT|WIB|WGT|WGST|WFT|WET|WEST|WAT|WAST|VUT|VLAT|VLAST|VET|UZT|UYT|UYST|UTC|ULAT|TVT|TMT|TLT|TKT|TJT|TFT|TAHT|SST|SRT|SGT|SCT|SBT|SAST|SAMT|RET|PYT|PYST|PWT|PST|PONT|PMST|PMDT|PKT|PHT|PHOT|PGT|PETT|PETST|PET|PDT|OMST|OMSST|NZST|NZDT|NUT|NST|NPT|NOVT|NOVST|NFT|NDT|NCT|MYT|MVT|MUT|MST|MSK|MSD|MMT|MHT|MDT|MAWT|MART|MAGT|MAGST|LINT|LHST|LHDT|KUYT|KST|KRAT|KRAST|KGT|JST|IST|IRST|IRKT|IRKST|IRDT|IOT|IDT|ICT|HOVT|HKT|GYT|GST|GMT|GILT|GFT|GET|GAMT|GALT|FNT|FKT|FKST|FJT|FJST|EST|EGT|EGST|EET|EEST|EDT|ECT|EAT|EAST|EASST|DAVT|ChST|CXT|CVT|CST|COT|CLT|CLST|CKT|CHAST|CHADT|CET|CEST|CDT|CCT|CAT|CAST|BTT|BST|BRT|BRST|BOT|BNT|AZT|AZST|AZOT|AZOST|AWST|AWDT|AST|ART|AQTT|ANAT|ANAST|AMT|AMST|ALMT|AKST|AKDT|AFT|AEST|AEDT|ADT|ACST|ACDT)\\b"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:
|
|
|
|
Token RegexMatch (GroupMatch (tz:_)):
|
2018-03-02 01:22:27 +03:00
|
|
|
_) -> Token Time <$> inTimezone (Text.toUpper tz) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleYear :: Rule
|
|
|
|
ruleYear = Rule
|
|
|
|
{ name = "year"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate $ isIntegerBetween 1000 2100
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
v <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ year v
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHalloweenDay :: Rule
|
|
|
|
ruleHalloweenDay = Rule
|
|
|
|
{ name = "halloween day"
|
|
|
|
, pattern =
|
|
|
|
[ regex "hall?owe?en"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ monthDay 10 31
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleNamedmonthDayofmonthNonOrdinal :: Rule
|
|
|
|
ruleNamedmonthDayofmonthNonOrdinal = Rule
|
|
|
|
{ name = "<named-month> <day-of-month> (non ordinal)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isAMonth
|
|
|
|
, Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:token:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
rulePeDate :: Rule
|
|
|
|
rulePeDate = Rule
|
|
|
|
{ name = "pe <date>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "pe"
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:x:_) -> Just x
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDayofmonthnumberNamedmonthYear :: Rule
|
|
|
|
ruleDayofmonthnumberNamedmonthYear = Rule
|
|
|
|
{ name = "<day-of-month>(number) <named-month> year"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isDOMInteger
|
|
|
|
, Predicate isAMonth
|
|
|
|
, regex "(\\d{2,4})"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:
|
|
|
|
Token Time td:
|
|
|
|
Token RegexMatch (GroupMatch (match:_)):
|
|
|
|
_) -> do
|
|
|
|
v <- parseInt match
|
|
|
|
dom <- intersectDOM td token
|
2017-04-18 19:54:32 +03:00
|
|
|
Token Time <$> intersect dom (year v)
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleAbsorptionOfAfterNamedDay :: Rule
|
|
|
|
ruleAbsorptionOfAfterNamedDay = Rule
|
|
|
|
{ name = "absorption of , after named day"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isADayOfWeek
|
|
|
|
, regex ","
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(x:_) -> Just x
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleLastDayofweekOfTime :: Rule
|
|
|
|
ruleLastDayofweekOfTime = Rule
|
|
|
|
{ name = "last <day-of-week> of <time>"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ultima"
|
|
|
|
, Predicate isADayOfWeek
|
|
|
|
, regex "din"
|
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(_:Token Time td1:_:Token Time td2:_) ->
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ predLastOf td1 td2
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleOrdinalTrimestru :: Rule
|
|
|
|
ruleOrdinalTrimestru = Rule
|
|
|
|
{ name = "<ordinal> trimestru"
|
|
|
|
, pattern =
|
|
|
|
[ dimension Ordinal
|
|
|
|
, Predicate $ isGrain TG.Quarter
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(token:_) -> do
|
|
|
|
n <- getIntValue token
|
2017-04-10 22:23:53 +03:00
|
|
|
tt . cycleNthAfter True TG.Quarter (n - 1) $
|
2017-03-08 21:33:55 +03:00
|
|
|
cycleNth TG.Year 0
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleByTime :: Rule
|
|
|
|
ruleByTime = Rule
|
|
|
|
{ name = "by <time>"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "p(a|â)n(a|ă) (la|(i|î)n)"
|
2017-03-08 21:33:55 +03:00
|
|
|
, dimension Time
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
2017-05-11 01:41:26 +03:00
|
|
|
(_:Token Time td:_) -> Token Time <$>
|
|
|
|
interval TTime.Open (cycleNth TG.Second 0) td
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleDdmmyyyy :: Rule
|
|
|
|
ruleDdmmyyyy = Rule
|
|
|
|
{ name = "dd/mm/yyyy"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(3[01]|[12]\\d|0?[1-9])[-/](0?[1-9]|1[0-2])[/-](\\d{2,4})"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (dd:mm:yy:_)):_) -> do
|
|
|
|
y <- parseInt yy
|
|
|
|
m <- parseInt mm
|
|
|
|
d <- parseInt dd
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ yearMonthDay y m d
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleMmddyyyy :: Rule
|
|
|
|
ruleMmddyyyy = Rule
|
|
|
|
{ name = "mm/dd/yyyy"
|
|
|
|
, pattern =
|
|
|
|
[ regex "(0?[1-9]|1[0-2])[/-](3[01]|[12]\\d|0?[1-9])[-/](\\d{2,4})"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (mm:dd:yy:_)):_) -> do
|
|
|
|
y <- parseInt yy
|
|
|
|
m <- parseInt mm
|
|
|
|
d <- parseInt dd
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ yearMonthDay y m d
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleEoyendOfYear :: Rule
|
|
|
|
ruleEoyendOfYear = Rule
|
|
|
|
{ name = "EOY|End of year"
|
|
|
|
, pattern =
|
2017-09-07 22:33:31 +03:00
|
|
|
[ regex "sf(a|â)r(s|ș)itul anului"
|
2017-03-08 21:33:55 +03:00
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ cycleNth TG.Year 1
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ruleMothersDay :: Rule
|
|
|
|
ruleMothersDay = Rule
|
|
|
|
{ name = "Mother's Day"
|
|
|
|
, pattern =
|
|
|
|
[ regex "ziua (mamei|memeii)"
|
|
|
|
]
|
2017-04-10 22:23:53 +03:00
|
|
|
, prod = \_ -> tt $ nthDOWOfMonth 1 7 5
|
2017-03-08 21:33:55 +03:00
|
|
|
}
|
|
|
|
|
2017-03-16 23:42:15 +03:00
|
|
|
ruleNameddayDayofmonthNumeral :: Rule
|
|
|
|
ruleNameddayDayofmonthNumeral = Rule
|
2017-03-08 21:33:55 +03:00
|
|
|
{ name = "<named-day> <day-of-month> (number)"
|
|
|
|
, pattern =
|
|
|
|
[ Predicate isADayOfWeek
|
|
|
|
, Predicate isDOMInteger
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token Time td:token:_) -> Token Time <$> intersectDOM td token
|
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
|
|
|
ruleHhmmss :: Rule
|
|
|
|
ruleHhmmss = Rule
|
|
|
|
{ name = "hh:mm:ss"
|
|
|
|
, pattern =
|
|
|
|
[ regex "((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)[:.]([0-5]\\d)"
|
|
|
|
]
|
|
|
|
, prod = \tokens -> case tokens of
|
|
|
|
(Token RegexMatch (GroupMatch (hh:mm:ss:_)):_) -> do
|
|
|
|
h <- parseInt hh
|
|
|
|
m <- parseInt mm
|
|
|
|
s <- parseInt ss
|
2017-04-10 22:23:53 +03:00
|
|
|
tt $ hourMinuteSecond True h m s
|
2017-03-08 21:33:55 +03:00
|
|
|
_ -> Nothing
|
|
|
|
}
|
|
|
|
|
2017-11-09 01:39:29 +03:00
|
|
|
ruleDaysOfWeek :: [Rule]
|
|
|
|
ruleDaysOfWeek = mkRuleDaysOfWeek
|
2017-09-09 20:40:04 +03:00
|
|
|
[ ( "luni" , "lu(n(ea|i)?)?" )
|
|
|
|
, ( "marti" , "ma(r((t|ț)(ea|i))?)?" )
|
|
|
|
, ( "miercuri" , "mi(e(rcur(ea|i))?)?" )
|
|
|
|
, ( "joi" , "jo(ia?)?" )
|
|
|
|
, ( "vineri" , "vi(n(er(ea|i))?)?" )
|
|
|
|
, ( "sambata" , "s(a|â)mb(a|ă)t(a|ă)|s(a|â)m" )
|
|
|
|
, ( "duminica" , "du(m(inic(a|ă))?)?" )
|
2017-08-18 01:11:38 +03:00
|
|
|
]
|
|
|
|
|
2017-11-09 01:39:29 +03:00
|
|
|
ruleMonths :: [Rule]
|
|
|
|
ruleMonths = mkRuleMonths
|
2017-08-18 01:11:38 +03:00
|
|
|
[ ( "ianuarie" , "ian(uarie)?" )
|
|
|
|
, ( "februarie" , "feb(ruarie)?" )
|
|
|
|
, ( "martie" , "martie|mar" )
|
|
|
|
, ( "aprilie" , "apr(ilie)?" )
|
|
|
|
, ( "mai" , "mai" )
|
|
|
|
, ( "iunie" , "iun(ie)?" )
|
|
|
|
, ( "iulie" , "iul(ie)?" )
|
|
|
|
, ( "august" , "aug(ust)?" )
|
|
|
|
, ( "septembrie" , "sept(embrie)?" )
|
|
|
|
, ( "octombrie" , "oct(ombrie)?" )
|
|
|
|
, ( "noiembrie" , "noi(embrie)?" )
|
|
|
|
, ( "decembrie" , "dec(embrie)?" )
|
|
|
|
]
|
|
|
|
|
2017-03-08 21:33:55 +03:00
|
|
|
rules :: [Rule]
|
|
|
|
rules =
|
|
|
|
[ ruleAboutTimeofday
|
|
|
|
, ruleAbsorptionOfAfterNamedDay
|
|
|
|
, ruleAcum
|
|
|
|
, ruleAfterTimeofday
|
|
|
|
, ruleAzi
|
|
|
|
, ruleBetweenTimeofdayAndTimeofdayInterval
|
|
|
|
, ruleBlackFriday
|
|
|
|
, ruleByTheEndOfTime
|
|
|
|
, ruleByTime
|
|
|
|
, ruleChristmasEve
|
|
|
|
, ruleCraciun
|
|
|
|
, ruleCycleAcesta
|
|
|
|
, ruleCycleAcesta2
|
|
|
|
, ruleCycleTrecut
|
|
|
|
, ruleCycleUrmatoare
|
|
|
|
, ruleDayofmonthNonOrdinalNamedmonth
|
|
|
|
, ruleDayofmonthNonOrdinalOfNamedmonth
|
2017-03-16 23:42:15 +03:00
|
|
|
, ruleDayofmonthNumeral
|
|
|
|
, ruleDayofmonthNumeralOfNamedmonth
|
2017-03-08 21:33:55 +03:00
|
|
|
, ruleDayofmonthnumberNamedmonth
|
|
|
|
, ruleDayofmonthnumberNamedmonthYear
|
|
|
|
, ruleDdmm
|
|
|
|
, ruleDdmmyyyy
|
|
|
|
, ruleDimineata
|
|
|
|
, ruleDiseara
|
|
|
|
, ruleDupaDuration
|
|
|
|
, ruleDupamiaza
|
|
|
|
, ruleDurationDeAcum
|
|
|
|
, ruleDurationInUrma
|
|
|
|
, ruleDurationInainteDeTime
|
|
|
|
, ruleEomendOfMonth
|
|
|
|
, ruleEoyendOfYear
|
|
|
|
, ruleFromTimeofdayTimeofdayInterval
|
|
|
|
, ruleHalloweenDay
|
|
|
|
, ruleHhmm
|
|
|
|
, ruleHhmmss
|
|
|
|
, ruleHourofdayIntegerAsRelativeMinutes
|
|
|
|
, ruleHourofdayJumatate
|
|
|
|
, ruleHourofdaySfert
|
|
|
|
, ruleIeri
|
|
|
|
, ruleInDuration
|
|
|
|
, ruleInNamedmonth
|
|
|
|
, ruleIntersect
|
|
|
|
, ruleIntersectBy
|
|
|
|
, ruleIntreDatetimeSiDatetimeInterval
|
|
|
|
, ruleIntroNamedday
|
|
|
|
, ruleLaTimeofday
|
|
|
|
, ruleLastCycleOfTime
|
|
|
|
, ruleLastDayofweekOfTime
|
|
|
|
, ruleMaine
|
|
|
|
, ruleMmdd
|
|
|
|
, ruleMmddyyyy
|
|
|
|
, ruleMonthDdddInterval
|
|
|
|
, ruleMothersDay
|
2017-03-16 23:42:15 +03:00
|
|
|
, ruleNameddayDayofmonthNumeral
|
|
|
|
, ruleNameddayPeDayofmonthNumeral
|
2017-03-08 21:33:55 +03:00
|
|
|
, ruleNamedmonthDayofmonthNonOrdinal
|
|
|
|
, ruleNewYearsDay
|
|
|
|
, ruleNewYearsEve
|
|
|
|
, ruleNoon
|
|
|
|
, ruleNthTimeAfterTime
|
|
|
|
, ruleNthTimeOfTime
|
|
|
|
, ruleOrdinalTrimestru
|
|
|
|
, ruleOrdinalTrimestruYear
|
|
|
|
, rulePartofdayAsta
|
|
|
|
, rulePeDate
|
|
|
|
, rulePeDayofmonthNonOrdinal
|
|
|
|
, rulePentruDuration
|
|
|
|
, ruleSearaNoapte
|
|
|
|
, ruleSeason
|
|
|
|
, ruleSeason2
|
|
|
|
, ruleSeason3
|
|
|
|
, ruleSezonAnotimp
|
|
|
|
, ruleSinceTimeofday
|
2017-03-16 23:42:15 +03:00
|
|
|
, ruleTheDayofmonthNumeral
|
2017-03-08 21:33:55 +03:00
|
|
|
, ruleThisnextDayofweek
|
|
|
|
, ruleTimeAceastaacestaasta
|
|
|
|
, ruleTimePartofday
|
|
|
|
, ruleTimezone
|
|
|
|
, ruleTimeTrecuta
|
|
|
|
, ruleTimeUrmatoarer
|
|
|
|
, ruleTimeofdayFix
|
|
|
|
, ruleTimeofdayLatent
|
2017-03-16 23:42:15 +03:00
|
|
|
, ruleTrimestruNumeralYear
|
2017-03-08 21:33:55 +03:00
|
|
|
, ruleUltimaCycle
|
|
|
|
, ruleUltimeleNCycle
|
|
|
|
, ruleUntilTimeofday
|
|
|
|
, ruleUrmatoareaCycle
|
|
|
|
, ruleUrmatoareleNCycle
|
|
|
|
, ruleValentinesDay
|
|
|
|
, ruleWeekend
|
|
|
|
, ruleYear
|
|
|
|
, ruleYearLatent
|
|
|
|
, ruleYearLatent2
|
|
|
|
, ruleYyyymmdd
|
|
|
|
]
|
2017-08-18 01:11:38 +03:00
|
|
|
++ ruleDaysOfWeek
|
|
|
|
++ ruleMonths
|