module Duckling.Time.HE.Rules
( rules ) where
import Data.Maybe
import Data.String
import Data.Text (Text)
import Prelude
import qualified Data.Text as Text
import Duckling.Dimensions.Types
import Duckling.Numeral.Helpers (parseInt)
import Duckling.Numeral.Types (NumeralData (..))
import Duckling.Ordinal.Types (OrdinalData (..))
import Duckling.Regex.Types
import Duckling.Time.Helpers
import Duckling.Time.Types (TimeData (..))
import Duckling.Types
import qualified Duckling.Numeral.Types as TNumeral
import qualified Duckling.Ordinal.Types as TOrdinal
import qualified Duckling.TimeGrain.Types as TG
import qualified Duckling.Time.Types as TTime
ruleNextDayofweek :: Rule
ruleNextDayofweek = Rule
{ name = "next <day-of-week>"
, pattern =
[ Predicate isADayOfWeek
, regex "(\x05d4\x05d1\x05d0(\x05d4)?)"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth 1 True td
_ -> Nothing
}
ruleNamedday :: Rule
ruleNamedday = Rule
{ name = "ב <named-day>"
, pattern =
[ regex "\x05d1"
, Predicate isADayOfWeek
]
, prod = \tokens -> case tokens of
(_:x:_) -> Just x
_ -> Nothing
}
ruleAtHourTimeofday :: Rule
ruleAtHourTimeofday = Rule
{ name = "at hour <time-of-day>"
, pattern =
[ regex "\x05d1\x05e9\x05e2\x05d4"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) ->
tt $ notLatent td
_ -> Nothing
}
ruleNamedmonth12 :: Rule
ruleNamedmonth12 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d3\x05e6\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 12
}
ruleHourofdayAndInteger :: Rule
ruleHourofdayAndInteger = Rule
{ name = "<hour-of-day> and <integer>"
, pattern =
[ Predicate isAnHourOfDay
, regex "\x05d5"
, 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
tt $ hourMinute is12H hours n
_ -> Nothing
}
ruleHourofdayAndQuarter :: Rule
ruleHourofdayAndQuarter = Rule
{ name = "<hour-of-day> and quarter"
, pattern =
[ Predicate isAnHourOfDay
, regex "\x05d5"
, regex "\x05e8\x05d1\x05e2(\x05d9)?"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
tt $ hourMinute is12H hours 15
_ -> Nothing
}
ruleHourofdayAndHalf :: Rule
ruleHourofdayAndHalf = Rule
{ name = "<hour-of-day> and half"
, pattern =
[ Predicate isAnHourOfDay
, regex "\x05d5"
, regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
tt $ hourMinute is12H hours 30
_ -> Nothing
}
ruleHourofdayInteger :: Rule
ruleHourofdayInteger = Rule
{ name = "<hour-of-day> <integer>"
, pattern =
[ Predicate isAnHourOfDay
, 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
tt $ hourMinute is12H hours n
_ -> Nothing
}
ruleHourofdayQuarter :: Rule
ruleHourofdayQuarter = Rule
{ name = "<hour-of-day> quarter"
, pattern =
[ Predicate isAnHourOfDay
, regex "\x05e8\x05d1\x05e2(\x05d9)?"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
tt $ hourMinute is12H hours 15
_ -> Nothing
}
ruleHourofdayHalf :: Rule
ruleHourofdayHalf = Rule
{ name = "<hour-of-day> half"
, pattern =
[ Predicate isAnHourOfDay
, regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) is12H)}:_) ->
tt $ hourMinute is12H hours 30
_ -> Nothing
}
ruleIntegerTotillbeforeIntegerHourofday :: Rule
ruleIntegerTotillbeforeIntegerHourofday = Rule
{ name = "<integer> to|till|before <integer> (hour-of-day)"
, pattern =
[ Predicate $ isIntegerBetween 1 59
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(token:_:Token Time td:_) -> do
n <- getIntValue token
t <- minutesBefore n td
tt t
_ -> Nothing
}
ruleQuarterTotillbeforeIntegerHourofday :: Rule
ruleQuarterTotillbeforeIntegerHourofday = Rule
{ name = "quarter to|till|before <integer> (hour-of-day)"
, pattern =
[ regex "\x05e8\x05d1\x05e2(\x05d9)?"
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(_:_:Token Time td:_) -> Token Time <$> minutesBefore 15 td
_ -> Nothing
}
ruleHalfTotillbeforeIntegerHourofday :: Rule
ruleHalfTotillbeforeIntegerHourofday = Rule
{ name = "half to|till|before <integer> (hour-of-day)"
, pattern =
[ regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
, regex "\x05dc\x05e4\x05e0\x05d9|\x05dc"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(_:_:Token Time td:_) -> Token Time <$> minutesBefore 30 td
_ -> Nothing
}
ruleIntegerAfterpastIntegerHourofday :: Rule
ruleIntegerAfterpastIntegerHourofday = Rule
{ name = "integer after|past <integer> (hour-of-day)"
, pattern =
[ Predicate $ isIntegerBetween 1 59
, regex "\x05d0\x05d7\x05e8\x05d9"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(token:_:Token Time td:_) -> do
n <- getIntValue token
t <- minutesAfter n td
tt t
_ -> Nothing
}
ruleQuarterAfterpastIntegerHourofday :: Rule
ruleQuarterAfterpastIntegerHourofday = Rule
{ name = "quarter after|past <integer> (hour-of-day)"
, pattern =
[ regex "\x05e8\x05d1\x05e2(\x05d9)?"
, regex "\x05d0\x05d7\x05e8\x05d9"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(_:_:Token Time td:_) -> Token Time <$> minutesAfter 15 td
_ -> Nothing
}
ruleHalfAfterpastIntegerHourofday :: Rule
ruleHalfAfterpastIntegerHourofday = Rule
{ name = "half after|past <integer> (hour-of-day)"
, pattern =
[ regex "\x05d7\x05e6\x05d9|\x05de\x05d7\x05e6\x05d9\x05ea"
, regex "\x05d0\x05d7\x05e8\x05d9"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) -> Token Time <$> minutesAfter 30 td
_ -> Nothing
}
ruleNamedday2 :: Rule
ruleNamedday2 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05e0\x05d9"
]
, prod = \_ -> tt $ dayOfWeek 1
}
ruleSinceTimeofday :: Rule
ruleSinceTimeofday = Rule
{ name = "since <time-of-day>"
, pattern =
[ regex "\x05de"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) -> tt $ withDirection TTime.After td
_ -> Nothing
}
ruleLastTime :: Rule
ruleLastTime = Rule
{ name = "last <time>"
, pattern =
[ dimension Time
, regex "\x05e9\x05e2\x05d1\x05e8|(\x05d4)?\x05e7\x05d5\x05d3\x05dd|(\x05d4)?\x05d0\x05d7\x05e8\x05d5\x05df"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth (1) False td
_ -> Nothing
}
ruleNamedday6 :: Rule
ruleNamedday6 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05d9\x05e9\x05d9"
]
, prod = \_ -> tt $ dayOfWeek 5
}
ruleDatetimeDatetimeInterval :: Rule
ruleDatetimeDatetimeInterval = Rule
{ name = "<datetime> - <datetime> (interval)"
, pattern =
[ Predicate isNotLatent
, regex "\\-|\x05e2(\x05d3)?"
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
tt $ interval TTime.Closed (td1, td2)
_ -> Nothing
}
ruleNamedmonth7 :: Rule
ruleNamedmonth7 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d9\x05d5\x05dc\x05d9"
]
, prod = \_ -> tt $ month 7
}
ruleTheDayofmonthNonOrdinal :: Rule
ruleTheDayofmonthNonOrdinal = Rule
{ name = "the <day-of-month> (non ordinal)"
, pattern =
[ regex "\x05d4/S"
, Predicate isDOMInteger
]
, prod = \tokens -> case tokens of
(_:token:_) -> do
n <- getIntValue token
tt . mkLatent $ dayOfMonth n
_ -> Nothing
}
ruleCycleAfterTime :: Rule
ruleCycleAfterTime = Rule
{ name = "<cycle> after <time>"
, pattern =
[ dimension TimeGrain
, regex "\x05d0\x05d7\x05e8\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter False grain 1 td
_ -> Nothing
}
ruleInDuration :: Rule
ruleInDuration = Rule
{ name = "in <duration>"
, pattern =
[ regex "\x05d1\x05e2\x05d5\x05d3"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:Token Duration dd:_) -> tt $ inDuration dd
_ -> Nothing
}
ruleInNamedmonth :: Rule
ruleInNamedmonth = Rule
{ name = "in <named-month>"
, pattern =
[ regex "\x05d1"
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(_:x:_) -> Just x
_ -> Nothing
}
ruleNow :: Rule
ruleNow = Rule
{ name = "now"
, pattern =
[ regex "\x05e2\x05db\x05e9\x05d9\x05d5|\x05de\x05d9\x05d9\x05d3"
]
, prod = \_ -> tt $ cycleNth TG.Second 0
}
ruleCurrentDayofweek :: Rule
ruleCurrentDayofweek = Rule
{ name = "current <day-of-week>"
, pattern =
[ Predicate isADayOfWeek
, regex "(\x05d4\x05d6\x05d4|\x05d4\x05d6\x05d0\x05ea|\x05d4\x05e7\x05e8\x05d5\x05d1(\x05d4)?)"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth 0 True td
_ -> Nothing
}
ruleFromDatetimeDatetimeInterval :: Rule
ruleFromDatetimeDatetimeInterval = Rule
{ name = "from <datetime> - <datetime> (interval)"
, pattern =
[ regex "\x05de|\x05de\x05e9\x05e2\x05d4"
, dimension Time
, regex "\\-|\x05e2\x05d3"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ interval TTime.Closed (td1, td2)
_ -> Nothing
}
ruleNamedday4 :: Rule
ruleNamedday4 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e8\x05d1\x05d9\x05e2\x05d9"
]
, prod = \_ -> tt $ dayOfWeek 3
}
ruleTheCycleAfterTime :: Rule
ruleTheCycleAfterTime = Rule
{ name = "the <cycle> after <time>"
, pattern =
[ regex "\x05d4"
, dimension TimeGrain
, regex "\x05d0\x05d7\x05e8\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter False grain 1 td
_ -> Nothing
}
ruleTheCycleBeforeTime :: Rule
ruleTheCycleBeforeTime = Rule
{ name = "the <cycle> before <time>"
, pattern =
[ regex "\x05d4"
, dimension TimeGrain
, regex "\x05dc\x05e4\x05e0\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter False grain (1) td
_ -> Nothing
}
ruleLastDayofweek :: Rule
ruleLastDayofweek = Rule
{ name = "last <day-of-week>"
, pattern =
[ Predicate isADayOfWeek
, regex "(\x05e9\x05e2\x05d1\x05e8(\x05d4)?|\x05d4\x05e7\x05d5\x05d3\x05de\x05ea|\x05d4\x05e7\x05d5\x05d3\x05dd)"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth 0 True td
_ -> Nothing
}
ruleTheIdesOfNamedmonth :: Rule
ruleTheIdesOfNamedmonth = Rule
{ name = "the ides of <named-month>"
, pattern =
[ regex "\x05d1\x05d0\x05de\x05e6\x05e2"
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(_:Token Time td@TimeData {TTime.form = Just (TTime.Month m)}:_) ->
Token Time <$>
intersect td (dayOfMonth $ if elem m [3, 5, 7, 10] then 15 else 13)
_ -> Nothing
}
ruleNoon :: Rule
ruleNoon = Rule
{ name = "noon"
, pattern =
[ regex "(\x05d1)?\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"
]
, prod = \_ -> tt $ hour False 12
}
ruleToday :: Rule
ruleToday = Rule
{ name = "today"
, pattern =
[ regex "\x05d4\x05d9\x05d5\x05dd"
]
, prod = \_ -> tt $ cycleNth TG.Day 0
}
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
ruleBetweenTimeofdayAndTimeofdayInterval = Rule
{ name = "between <time-of-day> and <time-of-day> (interval)"
, pattern =
[ regex "\x05d1\x05d9\x05df"
, Predicate isATimeOfDay
, regex "\x05dc"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ interval TTime.Closed (td1, td2)
_ -> Nothing
}
ruleNextCycle :: Rule
ruleNextCycle = Rule
{ name = "next <cycle>"
, pattern =
[ dimension TimeGrain
, regex "\x05d4\x05d1\x05d0(\x05d4)?"
]
, prod = \tokens -> case tokens of
(Token TimeGrain grain:_) -> tt $ cycleNth grain 1
_ -> Nothing
}
ruleNamedmonth :: Rule
ruleNamedmonth = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d9\x05e0\x05d5\x05d0\x05e8"
]
, prod = \_ -> tt $ month 1
}
ruleNamedmonth3 :: Rule
ruleNamedmonth3 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05de\x05e8\x05e5"
]
, prod = \_ -> tt $ month 3
}
ruleForDuration :: Rule
ruleForDuration = Rule
{ name = "for <duration>"
, pattern =
[ regex "\x05ea\x05d5\x05da"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:Token Duration dd:_) ->
tt $ inDuration dd
_ -> Nothing
}
ruleDurationFromNow :: Rule
ruleDurationFromNow = Rule
{ name = "<duration> from now"
, pattern =
[ dimension Duration
, regex "\x05de\x05e2\x05db\x05e9\x05d9\x05d5"
]
, prod = \tokens -> case tokens of
(Token Duration dd:_) ->
tt $ inDuration dd
_ -> Nothing
}
ruleLunch :: Rule
ruleLunch = Rule
{ name = "lunch"
, pattern =
[ regex "(\x05d1)?\x05e6\x05d4\x05e8\x05d9\x05d9\x05dd"
]
, prod = \_ -> tt . partOfDay . mkLatent $
interval TTime.Open (hour False 12, hour False 14)
}
ruleLastCycle :: Rule
ruleLastCycle = Rule
{ name = "last <cycle>"
, pattern =
[ dimension TimeGrain
, regex "\x05d4\x05d0\x05d7\x05e8\x05d5\x05df|\x05d4\x05d0\x05d7\x05e8\x05d5\x05e0\x05d4|\x05e9\x05e2\x05d1\x05e8|\x05e9\x05e2\x05d1\x05e8\x05d4"
]
, prod = \tokens -> case tokens of
(Token TimeGrain grain:_) ->
tt . cycleNth grain $ 1
_ -> Nothing
}
ruleAfternoon :: Rule
ruleAfternoon = Rule
{ name = "afternoon"
, 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)
}
ruleNamedmonth4 :: Rule
ruleNamedmonth4 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d0\x05e4\x05e8\x05d9\x05dc"
]
, prod = \_ -> tt $ month 4
}
ruleNamedmonthDayofmonthOrdinal :: Rule
ruleNamedmonthDayofmonthOrdinal = Rule
{ name = "<named-month> <day-of-month> (ordinal)"
, pattern =
[ Predicate isAMonth
, Predicate isDOMOrdinal
]
, prod = \tokens -> case tokens of
(Token Time td:token:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
}
ruleNamedday5 :: Rule
ruleNamedday5 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05d7\x05de\x05d9\x05e9\x05d9"
]
, prod = \_ -> tt $ dayOfWeek 4
}
ruleDayofmonthordinalNamedmonth :: Rule
ruleDayofmonthordinalNamedmonth = Rule
{ name = "<day-of-month>(ordinal) <named-month>"
, pattern =
[ Predicate isDOMOrdinal
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
}
ruleIntersectBy :: Rule
ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) -> Token Time <$> intersect td1 td2
_ -> Nothing
}
ruleNthTimeAfterTime :: Rule
ruleNthTimeAfterTime = Rule
{ name = "nth <time> after <time>"
, pattern =
[ dimension Ordinal
, dimension Time
, regex "\x05d0\x05d7\x05e8\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token Time td1:_:Token Time td2:_) ->
tt $ predNthAfter (TOrdinal.value od 1) td1 td2
_ -> 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
tt $ monthDay m d
_ -> Nothing
}
ruleAfterDuration :: Rule
ruleAfterDuration = Rule
{ name = "after <duration>"
, pattern =
[ regex "\x05d0\x05d7\x05e8\x05d9"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:Token Duration dd:_) -> tt . withDirection TTime.After $ inDuration dd
_ -> Nothing
}
ruleTimeofdayLatent :: Rule
ruleTimeofdayLatent = Rule
{ name = "time-of-day (latent)"
, pattern =
[ Predicate $ isIntegerBetween 0 23
]
, prod = \tokens -> case tokens of
(token:_) -> do
n <- getIntValue token
tt . mkLatent $ hour True n
_ -> Nothing
}
ruleDayofmonthOrdinalOfNamedmonth :: Rule
ruleDayofmonthOrdinalOfNamedmonth = Rule
{ name = "<day-of-month> (ordinal) of <named-month>"
, pattern =
[ Predicate isDOMOrdinal
, regex "\x05e9\x05dc|\x05d1|\x05dc"
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
}
ruleNamedmonth2 :: Rule
ruleNamedmonth2 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e4\x05d1\x05e8\x05d5\x05d0\x05e8"
]
, prod = \_ -> tt $ month 2
}
ruleThisEvening :: Rule
ruleThisEvening = Rule
{ name = "this evening"
, 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
}
ruleBetweenDatetimeAndDatetimeInterval :: Rule
ruleBetweenDatetimeAndDatetimeInterval = Rule
{ name = "between <datetime> and <datetime> (interval)"
, pattern =
[ regex "\x05d1\x05d9\x05df"
, dimension Time
, regex "\x05dc"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) ->
tt $ interval TTime.Closed (td1, td2)
_ -> Nothing
}
ruleEndOfYear :: Rule
ruleEndOfYear = Rule
{ name = "End of year"
, pattern =
[ regex "\x05e1\x05d5\x05e3 (\x05d4)?\x05e9\x05e0\x05d4"
]
, prod = \_ -> tt $ cycleNth TG.Year 1
}
ruleDurationAgo :: Rule
ruleDurationAgo = Rule
{ name = "<duration> ago"
, pattern =
[ regex "\x05dc\x05e4\x05e0\x05d9"
, dimension Duration
]
, prod = \tokens -> case tokens of
(_:Token Duration dd:_) ->
tt $ durationAgo dd
_ -> Nothing
}
ruleLastNCycle :: Rule
ruleLastNCycle = Rule
{ name = "last n <cycle>"
, pattern =
[ Predicate $ isIntegerBetween 1 9999
, dimension TimeGrain
, regex "\x05d0\x05d7\x05e8\x05d5\x05df|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d5\x05ea|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d4|\x05d0\x05d7\x05e8\x05d5\x05e0\x05d9\x05dd"
]
, prod = \tokens -> case tokens of
(token:Token TimeGrain grain:_) -> do
v <- getIntValue token
tt . cycleN True grain $ v
_ -> Nothing
}
ruleMidnighteodendOfDay :: Rule
ruleMidnighteodendOfDay = Rule
{ name = "midnight|EOD|end of day"
, pattern =
[ regex "(\x05d1)?\x05d7\x05e6\x05d5\x05ea"
]
, prod = \_ -> tt $ hour False 0
}
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:_) -> Token Time <$> intersect td1 td2
_ -> Nothing
}
ruleUntilTimeofday :: Rule
ruleUntilTimeofday = Rule
{ name = "until <time-of-day>"
, pattern =
[ regex "\x05e2\x05d3"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) ->
tt $ withDirection TTime.Before td
_ -> Nothing
}
ruleAtTimeofday :: Rule
ruleAtTimeofday = Rule
{ name = "at <time-of-day>"
, pattern =
[ regex "\x05d1"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) -> tt $ notLatent td
_ -> Nothing
}
ruleNamedmonth6 :: Rule
ruleNamedmonth6 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d9\x05d5\x05e0\x05d9"
]
, prod = \_ -> tt $ month 6
}
ruleNthTimeOfTime :: Rule
ruleNthTimeOfTime = Rule
{ name = "nth <time> of <time>"
, pattern =
[ dimension Time
, dimension Ordinal
, regex "\x05e9\x05dc|\x05d1"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Time td1:Token Ordinal od:_:Token Time td2:_) -> Token Time .
predNth (TOrdinal.value od 1) False <$> intersect td2 td1
_ -> Nothing
}
ruleNamedmonth8 :: Rule
ruleNamedmonth8 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d0\x05d5\x05d2\x05d5\x05e1\x05d8"
]
, prod = \_ -> tt $ month 8
}
ruleTimePartofday :: Rule
ruleTimePartofday = Rule
{ name = "<time> <part-of-day>"
, pattern =
[ dimension Time
, Predicate isAPartOfDay
]
, prod = \tokens -> case tokens of
(Token Time td:Token Time pod:_) -> Token Time <$> intersect pod td
_ -> Nothing
}
ruleWeekend :: Rule
ruleWeekend = Rule
{ name = "week-end"
, pattern =
[ regex "(\x05e1\x05d5\x05e4\x05f4\x05e9|\x05e1\x05d5\x05e3 \x05d4\x05e9\x05d1\x05d5\x05e2)"
]
, prod = \_ -> do
fri <- intersect (dayOfWeek 5) (hour False 18)
mon <- intersect (dayOfWeek 1) (hour False 0)
tt $ interval TTime.Open (fri, mon)
}
ruleNameddayDayofmonthOrdinal :: Rule
ruleNameddayDayofmonthOrdinal = Rule
{ name = "<named-day> <day-of-month> (ordinal)"
, pattern =
[ Predicate isADayOfWeek
, Predicate isDOMOrdinal
]
, prod = \tokens -> case tokens of
(Token Time td:token:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
}
ruleDate :: Rule
ruleDate = Rule
{ name = "ב <date>"
, pattern =
[ regex "\x05d1"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:x:_) -> Just x
_ -> Nothing
}
ruleNextTime :: Rule
ruleNextTime = Rule
{ name = "next <time>"
, pattern =
[ Predicate isNotLatent
, regex "\x05d4\x05d1\x05d0(\x05d4)?"
]
, prod = \tokens -> case tokens of
(Token Time td:_) -> tt $ predNth 0 True td
_ -> Nothing
}
ruleOrdinalQuarterYear :: Rule
ruleOrdinalQuarterYear = Rule
{ name = "<ordinal> quarter <year>"
, pattern =
[ dimension Ordinal
, Predicate $ isGrain TG.Quarter
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:_:Token Time td:_) ->
tt $ cycleNthAfter False TG.Quarter (TOrdinal.value od 1) td
_ -> 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
tt $ yearMonthDay y m d
_ -> Nothing
}
ruleTheOrdinalCycleAfterTime :: Rule
ruleTheOrdinalCycleAfterTime = Rule
{ name = "the <ordinal> <cycle> after <time>"
, pattern =
[ regex "\x05d4"
, dimension Ordinal
, dimension TimeGrain
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od 1) td
_ -> Nothing
}
ruleNextNCycle :: Rule
ruleNextNCycle = Rule
{ name = "next n <cycle>"
, pattern =
[ Predicate $ isIntegerBetween 1 9999
, dimension TimeGrain
, regex "\x05d4\x05d1\x05d0|\x05d4\x05d1\x05d0\x05d4|\x05d4\x05d1\x05d0\x05d9\x05dd|\x05d4\x05d1\x05d0\x05d5\x05ea"
]
, 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 "(\x05d1)?\x05d1\x05d5\x05e7\x05e8"
]
, prod = \_ -> tt . partOfDay . mkLatent $
interval TTime.Open (hour False 4, hour False 12)
}
ruleThisCycle :: Rule
ruleThisCycle = Rule
{ name = "this <cycle>"
, pattern =
[ dimension TimeGrain
, regex "\x05d4\x05e7\x05e8\x05d5(\x05d1)?\x05d4|\x05d4\x05d6\x05d4|\x05d4\x05d6\x05d0\x05ea"
]
, prod = \tokens -> case tokens of
(Token TimeGrain grain:_) ->
tt $ cycleNth grain 0
_ -> Nothing
}
ruleThisTime :: Rule
ruleThisTime = Rule
{ name = "this <time>"
, pattern =
[ dimension Time
, regex "\x05d4\x05e7\x05e8\x05d5\x05d1|\x05d4\x05d6\x05d4"
]
, prod = \tokens -> case tokens of
(Token Time td:_) ->
tt $ predNth 0 False td
_ -> Nothing
}
ruleDayofmonthNonOrdinalOfNamedmonth :: Rule
ruleDayofmonthNonOrdinalOfNamedmonth = Rule
{ name = "<day-of-month> (non ordinal) of <named-month>"
, pattern =
[ Predicate isDOMInteger
, regex "\x05e9\x05dc|\x05d1|\x05dc"
, Predicate isAMonth
]
, prod = \tokens -> case tokens of
(token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
_ -> Nothing
}
ruleEndOfMonth :: Rule
ruleEndOfMonth = Rule
{ name = "End of month"
, pattern =
[ regex "\x05e1\x05d5\x05e3 (\x05d4)?\x05d7\x05d5\x05d3\x05e9"
]
, prod = \_ -> tt $ cycleNth TG.Month 1
}
ruleYesterday :: Rule
ruleYesterday = Rule
{ name = "yesterday"
, pattern =
[ regex "(\x05d0\x05ea\x05de\x05d5\x05dc|\x05d0\x05de\x05e9)"
]
, prod = \_ -> tt . cycleNth TG.Day $ 1
}
ruleAfterTimeofday :: Rule
ruleAfterTimeofday = Rule
{ name = "after <time-of-day>"
, pattern =
[ regex "\x05d0\x05d7\x05e8\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td:_) -> tt $ withDirection TTime.After td
_ -> Nothing
}
ruleDayofmonthOrdinal :: Rule
ruleDayofmonthOrdinal = Rule
{ name = "<day-of-month> (ordinal)"
, pattern =
[ Predicate isDOMOrdinal
]
, prod = \tokens -> case tokens of
(token:_) -> do
n <- getIntValue token
tt . mkLatent $ dayOfMonth n
_ -> Nothing
}
ruleTimeofdayAmpm :: Rule
ruleTimeofdayAmpm = Rule
{ name = "<time-of-day> am|pm"
, pattern =
[ Predicate isATimeOfDay
, regex "(in the )?([ap])(\\s|\\.)?m?\\.?"
]
, prod = \tokens -> case tokens of
(Token Time td:Token RegexMatch (GroupMatch (_:ap:_)):_) ->
tt . timeOfDayAMPM td $ Text.toLower ap == "a"
_ -> Nothing
}
ruleOrdinalCycleAfterTime :: Rule
ruleOrdinalCycleAfterTime = Rule
{ name = "<ordinal> <cycle> after <time>"
, pattern =
[ dimension Ordinal
, dimension TimeGrain
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter True grain (TOrdinal.value od 1) td
_ -> Nothing
}
ruleNamedmonth5 :: Rule
ruleNamedmonth5 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05de\x05d0\x05d9"
]
, prod = \_ -> tt $ month 5
}
ruleNamedday7 :: Rule
ruleNamedday7 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05d1\x05ea"
]
, prod = \_ -> tt $ dayOfWeek 6
}
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
tt $ hourMinute True h m
_ -> Nothing
}
ruleTimeOfPartofday :: Rule
ruleTimeOfPartofday = Rule
{ name = "<time> of <part-of-day>"
, pattern =
[ dimension Time
, regex "\x05d1"
, Predicate isAPartOfDay
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) -> Token Time <$> intersect td1 td2
_ -> Nothing
}
ruleYear :: Rule
ruleYear = Rule
{ name = "year"
, pattern =
[ Predicate $ isIntegerBetween 1000 2100
]
, prod = \tokens -> case tokens of
(token:_) -> do
n <- getIntValue token
tt $ year n
_ -> Nothing
}
ruleNamedmonth10 :: Rule
ruleNamedmonth10 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05d0\x05d5\x05e7\x05d8\x05d5\x05d1\x05e8"
]
, prod = \_ -> tt $ month 10
}
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
}
ruleNamedday8 :: Rule
ruleNamedday8 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e8\x05d0\x05e9\x05d5\x05df"
]
, prod = \_ -> tt $ dayOfWeek 7
}
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 =
[ Predicate isADayOfWeek
, regex "\x05d4\x05d0\x05d7\x05e8\x05d5\x05df \x05e9\x05dc"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
tt $ predLastOf td1 td2
_ -> Nothing
}
ruleHhmmMilitaryAmpm :: Rule
ruleHhmmMilitaryAmpm = Rule
{ name = "hhmm (military) am|pm"
, pattern =
[ regex "((?:1[012]|0?\\d))([0-5]\\d)"
, regex "([ap])\\.?m?\\.?"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:_)):Token RegexMatch (GroupMatch (ap:_)):_) -> do
h <- parseInt hh
m <- parseInt mm
tt . timeOfDayAMPM (hourMinute True h m) $
Text.toLower ap == "a"
_ -> Nothing
}
ruleCycleBeforeTime :: Rule
ruleCycleBeforeTime = Rule
{ name = "<cycle> before <time>"
, pattern =
[ dimension TimeGrain
, regex "\x05dc\x05e4\x05e0\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token TimeGrain grain:_:Token Time td:_) ->
tt $ cycleNthAfter False grain (1) td
_ -> Nothing
}
ruleNamedmonth11 :: Rule
ruleNamedmonth11 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e0\x05d5\x05d1\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 11
}
ruleDurationAfterTime :: Rule
ruleDurationAfterTime = Rule
{ name = "<duration> after <time>"
, pattern =
[ dimension Duration
, regex "\x05d0\x05d7\x05e8\x05d9|\x05dc\x05d0\x05d7\x05e8"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Duration dd:_:Token Time td:_) ->
tt $ durationAfter dd td
_ -> Nothing
}
ruleEveningnight :: Rule
ruleEveningnight = Rule
{ name = "evening|night"
, pattern =
[ regex "(\x05d1)?\x05e2\x05e8\x05d1"
]
, prod = \_ -> tt . partOfDay . mkLatent $
interval TTime.Open (hour False 18, hour False 0)
}
ruleOrdinalQuarter :: Rule
ruleOrdinalQuarter = Rule
{ name = "<ordinal> quarter"
, pattern =
[ dimension Ordinal
, Predicate $ isGrain TG.Quarter
]
, prod = \tokens -> case tokens of
(token:_) -> do
n <- getIntValue token
tt . cycleNthAfter True TG.Quarter (n 1) $
cycleNth TG.Year 0
_ -> Nothing
}
ruleNamedday3 :: Rule
ruleNamedday3 = Rule
{ name = "named-day"
, pattern =
[ regex "(\x05d9\x05d5\x05dd )?\x05e9\x05dc\x05d9\x05e9\x05d9"
]
, prod = \_ -> tt $ dayOfWeek 2
}
ruleTheDayofmonthOrdinal :: Rule
ruleTheDayofmonthOrdinal = Rule
{ name = "the <day-of-month> (ordinal)"
, pattern =
[ regex "\x05d4"
, Predicate isDOMOrdinal
]
, prod = \tokens -> case tokens of
(_:
Token Ordinal (OrdinalData {TOrdinal.value = v}):
_) -> tt $ dayOfMonth v
_ -> Nothing
}
ruleDurationBeforeTime :: Rule
ruleDurationBeforeTime = Rule
{ name = "<duration> before <time>"
, pattern =
[ dimension Duration
, regex "\x05dc\x05e4\x05e0\x05d9"
, dimension Time
]
, prod = \tokens -> case tokens of
(Token Duration dd:_:Token Time td:_) ->
tt $ durationBefore dd td
_ -> Nothing
}
rulePartofdayOfTime :: Rule
rulePartofdayOfTime = Rule
{ name = "<part-of-day> of <time>"
, pattern =
[ regex "\x05d1"
, Predicate isAPartOfDay
, regex "\x05e9\x05dc"
, dimension Time
]
, prod = \tokens -> case tokens of
(_:Token Time td1:_:Token Time td2:_) -> Token Time <$> intersect td1 td2
_ -> 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
tt $ yearMonthDay y m d
_ -> Nothing
}
ruleTomorrow :: Rule
ruleTomorrow = Rule
{ name = "tomorrow"
, pattern =
[ regex "(\x05de\x05d7\x05e8|\x05dc\x05de\x05d7\x05e8\x05ea)"
]
, prod = \_ -> tt $ cycleNth TG.Day 1
}
ruleTimeofdayOclock :: Rule
ruleTimeofdayOclock = Rule
{ name = "<time-of-day> o'clock"
, pattern =
[ Predicate isATimeOfDay
, regex "o.?clock"
]
, prod = \tokens -> case tokens of
(Token Time td:_) -> tt $ notLatent td
_ -> Nothing
}
ruleNamedmonth9 :: Rule
ruleNamedmonth9 = Rule
{ name = "named-month"
, pattern =
[ regex "\x05e1\x05e4\x05d8\x05de\x05d1\x05e8"
]
, prod = \_ -> tt $ month 9
}
ruleDayofmonthordinalNamedmonthYear :: Rule
ruleDayofmonthordinalNamedmonthYear = Rule
{ name = "<day-of-month>(ordinal) <named-month> year"
, pattern =
[ Predicate isDOMOrdinal
, Predicate isAMonth
, regex "(\\d{2,4})"
]
, prod = \tokens -> case tokens of
(token:Token Time td:Token RegexMatch (GroupMatch (match:_)):_) -> do
intVal <- parseInt match
dom <- intersectDOM td token
Token Time <$> intersect dom (year intVal)
_ -> 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
tt $ hourMinuteSecond True h m s
_ -> Nothing
}
rules :: [Rule]
rules =
[ ruleAbsorptionOfAfterNamedDay
, ruleAfterDuration
, ruleAfterTimeofday
, ruleAfternoon
, ruleAtHourTimeofday
, ruleAtTimeofday
, ruleBetweenDatetimeAndDatetimeInterval
, ruleBetweenTimeofdayAndTimeofdayInterval
, ruleCurrentDayofweek
, ruleCycleAfterTime
, ruleCycleBeforeTime
, ruleDate
, ruleDatetimeDatetimeInterval
, ruleDayofmonthNonOrdinalNamedmonth
, ruleDayofmonthNonOrdinalOfNamedmonth
, ruleDayofmonthOrdinal
, ruleDayofmonthOrdinalOfNamedmonth
, ruleDayofmonthordinalNamedmonth
, ruleDayofmonthordinalNamedmonthYear
, ruleDurationAfterTime
, ruleDurationAgo
, ruleDurationBeforeTime
, ruleDurationFromNow
, ruleEndOfMonth
, ruleEndOfYear
, ruleEveningnight
, ruleForDuration
, ruleFromDatetimeDatetimeInterval
, ruleHhmm
, ruleHhmmMilitaryAmpm
, ruleHhmmss
, ruleHourofdayAndInteger
, ruleHourofdayAndQuarter
, ruleHourofdayAndHalf
, ruleHourofdayInteger
, ruleHourofdayQuarter
, ruleHourofdayHalf
, ruleInDuration
, ruleInNamedmonth
, ruleIntersect
, ruleIntersectBy
, ruleLastCycle
, ruleLastDayofweek
, ruleLastDayofweekOfTime
, ruleLastNCycle
, ruleLastTime
, ruleLunch
, ruleMidnighteodendOfDay
, ruleMmdd
, ruleMmddyyyy
, ruleMorning
, ruleNamedday
, ruleNamedday2
, ruleNamedday3
, ruleNamedday4
, ruleNamedday5
, ruleNamedday6
, ruleNamedday7
, ruleNamedday8
, ruleNameddayDayofmonthOrdinal
, ruleNamedmonth
, ruleNamedmonth10
, ruleNamedmonth11
, ruleNamedmonth12
, ruleNamedmonth2
, ruleNamedmonth3
, ruleNamedmonth4
, ruleNamedmonth5
, ruleNamedmonth6
, ruleNamedmonth7
, ruleNamedmonth8
, ruleNamedmonth9
, ruleNamedmonthDayofmonthNonOrdinal
, ruleNamedmonthDayofmonthOrdinal
, ruleNextCycle
, ruleNextDayofweek
, ruleNextNCycle
, ruleNextTime
, ruleNoon
, ruleNow
, ruleNthTimeAfterTime
, ruleNthTimeOfTime
, ruleOrdinalCycleAfterTime
, ruleOrdinalQuarter
, ruleOrdinalQuarterYear
, rulePartofdayOfTime
, ruleIntegerAfterpastIntegerHourofday
, ruleQuarterAfterpastIntegerHourofday
, ruleHalfAfterpastIntegerHourofday
, ruleIntegerTotillbeforeIntegerHourofday
, ruleQuarterTotillbeforeIntegerHourofday
, ruleHalfTotillbeforeIntegerHourofday
, ruleSinceTimeofday
, ruleTheCycleAfterTime
, ruleTheCycleBeforeTime
, ruleTheDayofmonthNonOrdinal
, ruleTheDayofmonthOrdinal
, ruleTheIdesOfNamedmonth
, ruleTheOrdinalCycleAfterTime
, ruleThisCycle
, ruleThisEvening
, ruleThisTime
, ruleTimeOfPartofday
, ruleTimePartofday
, ruleTimeofdayAmpm
, ruleTimeofdayLatent
, ruleTimeofdayOclock
, ruleToday
, ruleTomorrow
, ruleUntilTimeofday
, ruleWeekend
, ruleYear
, ruleYesterday
, ruleYyyymmdd
]