{-# LANGUAGE GADTs #-}
{-# LANGUAGE NoRebindableSyntax #-}
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Time.PL.Rules
( rules
) where
import Prelude
import qualified Data.Text as Text
import Duckling.Dimensions.Types
import Duckling.Duration.Helpers (isGrain)
import Duckling.Numeral.Helpers (parseInt)
import Duckling.Ordinal.Types (OrdinalData(..))
import Duckling.Regex.Types
import Duckling.Time.Helpers
import Duckling.Time.Types (TimeData(..))
import Duckling.Time.Computed
import Duckling.Types
import qualified Duckling.Ordinal.Types as TOrdinal
import qualified Duckling.Time.Types as TTime
import qualified Duckling.TimeGrain.Types as TG
ruleOrdinalCycleTime :: Rule
ruleOrdinalCycleTime :: Rule
ruleOrdinalCycleTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> <cycle> <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
TimeGrain a
grain:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True a
Grain
grain (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDaysOfWeek :: [Rule]
ruleDaysOfWeek :: [Rule]
ruleDaysOfWeek = [(Text, String)] -> [Rule]
mkRuleDaysOfWeek
[ ( Text
"Monday" , String
"poniedzia(l|ł)(ek|ku|kowi|kiem|kowy)|pon\\.?" )
, ( Text
"Tuesday" , String
"wtorek|wtorku|wtorkowi|wtorkiem|wtr?\\.?" )
, ( Text
"Wednesday" , String
"(Ś|ś|s)rod(a|ą|y|e|ę|zie|owy|o)|(s|ś|Ś)ro?\\.?" )
, ( Text
"Thursday" , String
"czwartek|czwartku|czwartkowi|czwartkiem|czwr?\\.?" )
, ( Text
"Friday" , String
"piątek|piatek|piątku|piatku|piątkowi|piatkowi|piątkiem|piatkiem|pi(ą|a)tkowy|pia\\.?" )
, ( Text
"Saturday" , String
"sobota|soboty|sobocie|sobotę|sobote|sobotą|sobota|sobocie|soboto|sob\\.?" )
, ( Text
"Sunday" , String
"niedziel(a|i|ę|e|ą|o)|n(ie)?dz?\\.?" )
]
ruleMonths :: [Rule]
ruleMonths :: [Rule]
ruleMonths = [(Text, String)] -> [Rule]
mkRuleMonths
[ ( Text
"January" , String
"stycz(eń|en|nia|niowi|niem|niu)|sty(cz)?\\.?" )
, ( Text
"February" , String
"lu(ty|tego|temu|t?\\.?)" )
, ( Text
"March" , String
"mar(zec|ca|cowi|cem|cu|z?\\.?)" )
, ( Text
"April" , String
"kwie(cień|cien|tnia|tniowi|tniem|tniu|t?\\.?)" )
, ( Text
"May" , String
"maj(a|owi|em|u)?" )
, ( Text
"June" , String
"czerw(iec|ca|cowi|cem|cu)|czer?\\.?" )
, ( Text
"July" , String
"lip(iec|ca|cowi|cem|cu)|lip\\.?" )
, ( Text
"August" , String
"sierp(ie(n|ń)|ni(a|owi|em|u))|sierp\\.?|sier\\.?|sie\\.?" )
, ( Text
"September" , String
"wrze(s|ś)(ie(ń|n)|ni(a|owi|em|u))|wrz\\.?|wrze\\.?" )
, ( Text
"October" , String
"pa(z|ź)dziernik(a|owi|iem|u)?|paź\\.?|paz\\.?" )
, ( Text
"November" , String
"listopad(a|owi|em|zie)?|lis\\.?|list\\.?" )
, ( Text
"December" , String
"grudz(ień|ien)|grudn(ia|iowi|iem|niu)|gru\\.?|grud\\.?" )
]
ruleRelativeMinutesTotillbeforeIntegerHourofday :: Rule
ruleRelativeMinutesTotillbeforeIntegerHourofday :: Rule
ruleRelativeMinutesTotillbeforeIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"relative minutes to|till|before <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1 Int
59
, String -> PatternItem
regex String
"do|przed"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:Token
_:Token Dimension a
Time a
td:[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> TimeData -> Maybe TimeData
minutesBefore Int
n a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleRelativeMinutesAfterpastIntegerHourofday :: Rule
ruleRelativeMinutesAfterpastIntegerHourofday :: Rule
ruleRelativeMinutesAfterpastIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"relative minutes after|past <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1 Int
59
, String -> PatternItem
regex String
"po"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:
Token
_:
Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
n
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHourofdayIntegerAsRelativeMinutes :: Rule
ruleHourofdayIntegerAsRelativeMinutes :: Rule
ruleHourofdayIntegerAsRelativeMinutes = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<hour-of-day> <integer> (as relative minutes)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isAnHourOfDay]
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1 Int
59
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
Token
token:
[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
n
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleQuarterTotillbeforeIntegerHourofday :: Rule
ruleQuarterTotillbeforeIntegerHourofday :: Rule
ruleQuarterTotillbeforeIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"quarter to|till|before <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kwadrans(ie|owi|em|a)? *(do|przed)"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> TimeData -> Maybe TimeData
minutesBefore Int
15 a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleQuarterAfterpastIntegerHourofday :: Rule
ruleQuarterAfterpastIntegerHourofday :: Rule
ruleQuarterAfterpastIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"quarter after|past <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kwadrans(ie|owi|em|a)? *po"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:
Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
15
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHourofdayQuarter :: Rule
ruleHourofdayQuarter :: Rule
ruleHourofdayQuarter = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<hour-of-day> quarter (as relative minutes)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
, String -> PatternItem
regex String
"kwadrans(ie|owi|em|a)?"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
15
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHalfTotillbeforeIntegerHourofday :: Rule
ruleHalfTotillbeforeIntegerHourofday :: Rule
ruleHalfTotillbeforeIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"half to|till|before <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"p(o|ó)(l|ł) *(do|przed)"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Int -> TimeData -> Maybe TimeData
minutesBefore Int
30 a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHalfAfterpastIntegerHourofday :: Rule
ruleHalfAfterpastIntegerHourofday :: Rule
ruleHalfAfterpastIntegerHourofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"half after|past <integer> (hour-of-day)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"p(o|ó)(l|ł) *po"
, Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:
Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
30
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHourofdayHalf :: Rule
ruleHourofdayHalf :: Rule
ruleHourofdayHalf = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<hour-of-day> half (as relative minutes)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isAnHourOfDay
, String -> PatternItem
regex String
"p(o|ó)(l|ł)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
hours Int
30
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleLastTime :: Rule
ruleLastTime :: Rule
ruleLastTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?|(po ?)?przedni(ego|ch|emu|e|mi|m|a)?"
, Predicate -> PatternItem
Predicate Predicate
isOkWithThisNext
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth (-Int
1) Bool
False a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDatetimeDatetimeInterval :: Rule
ruleDatetimeDatetimeInterval :: Rule
ruleDatetimeDatetimeInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<datetime> - <datetime> (interval)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isNotLatent
, String -> PatternItem
regex String
"\\-|(p|d)o|a(ż|z) (p|d)o"
, Predicate -> PatternItem
Predicate Predicate
isNotLatent
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleCycleAfterTime :: Rule
ruleCycleAfterTime :: Rule
ruleCycleAfterTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<cycle> after <time>"
, pattern :: Pattern
pattern =
[ Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"po"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False a
Grain
grain Int
1 a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleInDuration :: Rule
ruleInDuration :: Rule
ruleInDuration = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"in <duration>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(w( ?(prze)?ciągu)?|za) ?(jeszcze)?|przez"
, Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Duration a
dd:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData
inDuration a
DurationData
dd
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNow :: Rule
ruleNow :: Rule
ruleNow = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"now"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(w)? ?(tym|tej)? ?(teraz|momencie|chwili|momeńcie)"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt TimeData
now
}
ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime :: Rule
ruleLastCycleOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <cycle> of <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"w(e)?|z(e)?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> TimeData -> TimeData
cycleLastOf a
Grain
grain a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleFromDatetimeDatetimeInterval :: Rule
ruleFromDatetimeDatetimeInterval :: Rule
ruleFromDatetimeDatetimeInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"from <datetime> - <datetime> (interval)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"od|p(o|ó)(z|ź)niej ni(z|ż)"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"\\-|do|po|aż do|az do|aż po|az po|ale przed"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOrdinalAsHour :: Rule
ruleOrdinalAsHour :: Rule
ruleOrdinalAsHour = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> (as hour)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isOrdinalBetween Int
1 Int
24
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal OrdinalData{TOrdinal.value = v}:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> TimeData
hour Bool
True Int
v
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleMonthDdddInterval :: Rule
ruleMonthDdddInterval :: Rule
ruleMonthDdddInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<month> dd-dd (interval)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isAMonth
, String -> PatternItem
regex String
"(3[01]|[12]\\d|0?[1-9])"
, String -> PatternItem
regex String
"\\-|do|po|aż do|az do|aż po|az po"
, String -> PatternItem
regex String
"(3[01]|[12]\\d|0?[1-9])"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
( Token Dimension a
Time a
td
:Token Dimension a
RegexMatch (GroupMatch (d1:_))
:Token
_
:Token Dimension a
RegexMatch (GroupMatch (d2:_))
:[Token]
_) -> do
Int
dd1 <- Text -> Maybe Int
parseInt Text
d1
Int
dd2 <- Text -> Maybe Int
parseInt Text
d2
TimeData
dom1 <- TimeData -> TimeData -> Maybe TimeData
intersect (Int -> TimeData
dayOfMonth Int
dd1) a
TimeData
td
TimeData
dom2 <- TimeData -> TimeData -> Maybe TimeData
intersect (Int -> TimeData
dayOfMonth Int
dd2) a
TimeData
td
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed TimeData
dom1 TimeData
dom2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleYearLatent2 :: Rule
ruleYearLatent2 :: Rule
ruleYearLatent2 = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"year (latent)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
2101 Int
10000
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> TimeData
year Int
n
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeAfterNext :: Rule
ruleTimeAfterNext :: Rule
ruleTimeAfterNext = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time> after next"
, pattern :: Pattern
pattern =
[ Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"po kolejnym|po nast(e|ę)pn(ym|y|ego|emu|(a|ą)|ej|e)|po przysz(l|ł)(ym|y|ego|emu|(a|ą)|ej)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth Int
1 Bool
True a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTheIdesOfNamedmonth :: Rule
ruleTheIdesOfNamedmonth :: Rule
ruleTheIdesOfNamedmonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"the ides of <named-month>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"the ides? of"
, Predicate -> PatternItem
Predicate Predicate
isAMonth
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time td :: a
td@TimeData {TTime.form = Just (TTime.Month m)}:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TimeData -> TimeData -> Maybe TimeData
intersect (Int -> TimeData
dayOfMonth (Int -> TimeData) -> Int -> TimeData
forall a b. (a -> b) -> a -> b
$ if Int -> [Int] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
elem Int
m [Int
3, Int
5, Int
7, Int
10] then Int
15 else Int
13) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNoon :: Rule
ruleNoon :: Rule
ruleNoon = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"noon"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"po(l|ł)udni(em|e|a|u)"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> TimeData
hour Bool
False Int
12
}
ruleToday :: Rule
ruleToday :: Rule
ruleToday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"today"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"dzisiejsz[yaą]|dzisiaj|dzi[śs]|w ten dzień|w ten dzien|w obecny dzień|w obecny dzien|obecnego dnia"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt TimeData
today
}
ruleThisnextDayofweek :: Rule
ruleThisnextDayofweek :: Rule
ruleThisnextDayofweek = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"this|next <day-of-week>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kolejn(ym|y|ego|emu|e)|nast(e|ę)pn(ym|y|ego|emu|e|(a|ą)|ej|e)"
, Predicate -> PatternItem
Predicate Predicate
isADayOfWeek
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth Int
0 Bool
True a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
ruleBetweenTimeofdayAndTimeofdayInterval :: Rule
ruleBetweenTimeofdayAndTimeofdayInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"between <time-of-day> and <time-of-day> (interval)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(po|po )?miedzy|między"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"a|i"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNextCycle :: Rule
ruleNextCycle :: Rule
ruleNextCycle = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"next <cycle>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kolejn(ym|y|ego|emu|(a|ą)|ej|e)|nast(e|ę)pn(ym|y|ego|emu|(a|ą)|ej|e)|przysz(l|ł)(ego|emu|ym|(a|ą)|ej|ych|i|ymi|y|e)|za"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth a
Grain
grain Int
1
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTheCycleOfTime :: Rule
ruleTheCycleOfTime :: Rule
ruleTheCycleOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"the <cycle> of <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"the"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"of"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True a
Grain
grain Int
0 a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeofdayApproximately :: Rule
ruleTimeofdayApproximately :: Rule
ruleTimeofdayApproximately = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> approximately"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"o?ko(l|ł)o|mniej wi(e|ę)cej"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOnDate :: Rule
ruleOnDate :: Rule
ruleOnDate = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"on <date>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"we?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token
x:[Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just Token
x
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleLastDayofweekTime :: Rule
ruleLastDayofweekTime :: Rule
ruleLastDayofweekTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <day-of-week> <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?"
, Predicate -> PatternItem
Predicate Predicate
isADayOfWeek
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token Dimension a
Time a
td2:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData -> TimeData
predLastOf a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDurationFromNow :: Rule
ruleDurationFromNow :: Rule
ruleDurationFromNow = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<duration> from now"
, pattern :: Pattern
pattern =
[ Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
, String -> PatternItem
regex String
"od (dzi(s|ś)|teraz)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Duration a
dd:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData
inDuration a
DurationData
dd
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleLunch :: Rule
ruleLunch :: Rule
ruleLunch = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"lunch"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(na )?la?u?nc(z|h)|obiad"
]
, prod :: Production
prod = \[Token]
_ ->
let from :: TimeData
from = Bool -> Int -> TimeData
hour Bool
False Int
12
to :: TimeData
to = Bool -> Int -> TimeData
hour Bool
False Int
14
in Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> TimeData)
-> (TimeData -> TimeData) -> TimeData -> TimeData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
partOfDay (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
from TimeData
to
}
ruleAfternoon :: Rule
ruleAfternoon :: Rule
ruleAfternoon = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"afternoon"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"po(l|ł)udni(em|e|a|u)"
]
, prod :: Production
prod = \[Token]
_ ->
let from :: TimeData
from = Bool -> Int -> TimeData
hour Bool
False Int
12
to :: TimeData
to = Bool -> Int -> TimeData
hour Bool
False Int
19
in Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> TimeData)
-> (TimeData -> TimeData) -> TimeData -> TimeData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
partOfDay (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
from TimeData
to
}
ruleEveningnight :: Rule
ruleEveningnight :: Rule
ruleEveningnight = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"evening|night"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"wiecz[oó]r(em|owi|ze|a|u)?|nocą?"
]
, prod :: Production
prod = \[Token]
_ ->
let from :: TimeData
from = Bool -> Int -> TimeData
hour Bool
False Int
18
to :: TimeData
to = Bool -> Int -> TimeData
hour Bool
False Int
0
in Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> TimeData)
-> (TimeData -> TimeData) -> TimeData -> TimeData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
partOfDay (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
from TimeData
to
}
ruleLastCycle :: Rule
ruleLastCycle :: Rule
ruleLastCycle = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <cycle>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej|e)?|(po ?)?przedni(ego|ch|emu|mi|m|e|(a|ą)|ej)?"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (Int -> TimeData) -> Int -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Grain -> Int -> TimeData
cycleNth a
Grain
grain (Int -> Maybe Token) -> Int -> Maybe Token
forall a b. (a -> b) -> a -> b
$ - Int
1
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHourofdayHourofdayInterval :: Rule
ruleHourofdayHourofdayInterval :: Rule
ruleHourofdayHourofdayInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<hour-of-day> - <hour-of-day> (interval)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"-|do|aż po|po"
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isATimeOfDay]
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeBeforeLast :: Rule
ruleTimeBeforeLast :: Rule
ruleTimeBeforeLast = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time> before last"
, pattern :: Pattern
pattern =
[ Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"przed ?ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth (-Int
2) Bool
False a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNamedmonthDayofmonthOrdinal :: Rule
ruleNamedmonthDayofmonthOrdinal :: Rule
ruleNamedmonthDayofmonthOrdinal = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<named-month> <day-of-month> (ordinal)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isAMonth
, Predicate -> PatternItem
Predicate Predicate
isDOMOrdinal
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:Token
token:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleInduringThePartofday :: Rule
ruleInduringThePartofday :: Rule
ruleInduringThePartofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"in|during the <part-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(w|na) ?(czas(ie)?)"
, Predicate -> PatternItem
Predicate Predicate
isAPartOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthordinalNamedmonth :: Rule
ruleDayofmonthordinalNamedmonth :: Rule
ruleDayofmonthordinalNamedmonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month>(ordinal) <named-month>"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMOrdinal
, Predicate -> PatternItem
Predicate Predicate
isAMonth
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleIntersectBy :: Rule
ruleIntersectBy :: Rule
ruleIntersectBy = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"intersect by \",\""
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isNotLatent
, String -> PatternItem
regex String
","
, Predicate -> PatternItem
Predicate Predicate
isNotLatent
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNthTimeAfterTime :: Rule
ruleNthTimeAfterTime :: Rule
ruleNthTimeAfterTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"nth <time> after <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"po"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> TimeData -> TimeData -> TimeData
predNthAfter (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleMmdd :: Rule
ruleMmdd :: Rule
ruleMmdd = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"mm/dd"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(0?[1-9]|1[0-2])/(3[01]|[12]\\d|0?[1-9])"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (mm:dd:_)):[Token]
_) -> do
Int
m <- Text -> Maybe Int
parseInt Text
mm
Int
d <- Text -> Maybe Int
parseInt Text
dd
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Int -> TimeData
monthDay Int
m Int
d
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleAfterDuration :: Rule
ruleAfterDuration :: Rule
ruleAfterDuration = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"after <duration>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"po"
, Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Duration a
dd:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
notLatent (TimeData -> TimeData)
-> (TimeData -> TimeData) -> TimeData -> TimeData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. IntervalDirection -> TimeData -> TimeData
withDirection IntervalDirection
TTime.After (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData
inDuration a
DurationData
dd
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthOrdinalOfNamedmonth :: Rule
ruleDayofmonthOrdinalOfNamedmonth :: Rule
ruleDayofmonthOrdinalOfNamedmonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month> (ordinal) of <named-month>"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMOrdinal
, String -> PatternItem
regex String
"of|in"
, Predicate -> PatternItem
Predicate Predicate
isAMonth
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleFromTimeofdayTimeofdayInterval :: Rule
ruleFromTimeofdayTimeofdayInterval :: Rule
ruleFromTimeofdayTimeofdayInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"from <time-of-day> - <time-of-day> (interval)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(niż|niz|od)"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"((but )?before)|\\-|do|po|aż do|az do|aż po|az po"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleExactlyTimeofday :: Rule
ruleExactlyTimeofday :: Rule
ruleExactlyTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"exactly <time-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(r(o|ó)wno|dok(l|ł)adnie)( o)?"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleIntegerLatentTimeofday :: Rule
ruleIntegerLatentTimeofday :: Rule
ruleIntegerLatentTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<integer> (latent time-of-day)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
0 Int
23
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:[Token]
_) -> do
Int
v <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> TimeData
hour Bool
True Int
v
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleBetweenDatetimeAndDatetimeInterval :: Rule
ruleBetweenDatetimeAndDatetimeInterval :: Rule
ruleBetweenDatetimeAndDatetimeInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"between <datetime> and <datetime> (interval)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(po|po )?mi(e|ę)dzy"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"a|i"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDurationAgo :: Rule
ruleDurationAgo :: Rule
ruleDurationAgo = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<duration> ago"
, pattern :: Pattern
pattern =
[ Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
, String -> PatternItem
regex String
"temu"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Duration a
dd:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData
durationAgo a
DurationData
dd
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleByTheEndOfTime :: Rule
ruleByTheEndOfTime :: Rule
ruleByTheEndOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"by the end of <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"do (ko[ńn]ca )?(tego)?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed TimeData
now a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayBeforeYesterdaySingleWord :: Rule
ruleDayBeforeYesterdaySingleWord :: Rule
ruleDayBeforeYesterdaySingleWord = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"day-before-yesterday (single-word)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"przedwczoraj"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth Grain
TG.Day (-Int
2)
}
ruleLastNCycle :: Rule
ruleLastNCycle :: Rule
ruleLastNCycle = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last n <cycle>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej|e)?|(po ?)?przedni(ego|ch|emu|mi|m|e|(a|ą)|ej)?"
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1 Int
9999
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token
token:Token Dimension a
TimeGrain a
grain:[Token]
_) -> do
Int
v <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData
cycleN Bool
True a
Grain
grain (- Int
v)
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeofdaySharp :: Rule
ruleTimeofdaySharp :: Rule
ruleTimeofdaySharp = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> sharp"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"r(o|ó)wno|dok(l|ł)adnie"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleWithinDuration :: Rule
ruleWithinDuration :: Rule
ruleWithinDuration = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"within <duration>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(w )?ci(a|ą)gu|zakresie|obrębie|obrebie"
, Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Duration a
dd:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
now (DurationData -> TimeData
inDuration a
DurationData
dd)
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeofdayRano :: Rule
ruleTimeofdayRano :: Rule
ruleTimeofdayRano = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> rano"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"(z )?ran(o|a|u|em)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> TimeData -> TimeData
timeOfDayAMPM Bool
True a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthNonOrdinalNamedmonth :: Rule
ruleDayofmonthNonOrdinalNamedmonth :: Rule
ruleDayofmonthNonOrdinalNamedmonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month> (non ordinal) <named-month>"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMInteger
, Predicate -> PatternItem
Predicate Predicate
isAMonth
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleIntersect :: Rule
ruleIntersect :: Rule
ruleIntersect = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"intersect"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isNotLatent
, Predicate -> PatternItem
Predicate Predicate
isNotLatent
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token Dimension a
Time a
td2:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleAboutTimeofday :: Rule
ruleAboutTimeofday :: Rule
ruleAboutTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"about <time-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"o?ko(l|ł)o|mniej wi(e|ę)cej|tak o"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleUntilTimeofday :: Rule
ruleUntilTimeofday :: Rule
ruleUntilTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"until <time-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(a(ż|z) )?do|przed"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
notLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ IntervalDirection -> TimeData -> TimeData
withDirection IntervalDirection
TTime.Before a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleAtTimeofday :: Rule
ruleAtTimeofday :: Rule
ruleAtTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"at <time-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"o|na|@"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNthTimeOfTime :: Rule
ruleNthTimeOfTime :: Rule
ruleNthTimeOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"nth <time> of <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, String -> PatternItem
regex String
"w(e)?|z(e)?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Int -> Bool -> TimeData -> TimeData
predNth (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) Bool
False (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td2 a
TimeData
td1
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimePartofday :: Rule
ruleTimePartofday :: Rule
ruleTimePartofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time> <part-of-day>"
, pattern :: Pattern
pattern =
[ Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, Predicate -> PatternItem
Predicate Predicate
isAPartOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleWeekend :: Rule
ruleWeekend :: Rule
ruleWeekend = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"week-end"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"((wek|week|wik)(\\s|-)?end|wkend)"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
mkOkForThisNext TimeData
weekend
}
ruleEomendOfMonth :: Rule
ruleEomendOfMonth :: Rule
ruleEomendOfMonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"EOM|End of month"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(na |w )?(koniec|ko(n|ń)ca|ko(n|ń)cu|ko(n|ń)cowi|ko(n|ń)cem|ko(n|ń)c(o|ó)wke) (miesi(a|ą)ca|msc)"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth Grain
TG.Month Int
1
}
ruleNextTime :: Rule
ruleNextTime :: Rule
ruleNextTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"next <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kolejn(ym|y|ego|emu|(a|ą)|ej|e)|nast(e|ę)pn(ym|y|ego|emu|e|(a|ą)|ej|e)|przysz(l|ł)(ego|emu|ym|(a|ą)|ej|ych|i|ymi|y|e)"
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isOkWithThisNext]
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth Int
0 Bool
True a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayaftertomorrowSingleword :: Rule
ruleDayaftertomorrowSingleword :: Rule
ruleDayaftertomorrowSingleword = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"day-after-tomorrow (single-word)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(po ?jutr(o|ze))"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth Grain
TG.Day Int
2
}
ruleOrdinalQuarterYear :: Rule
ruleOrdinalQuarterYear :: Rule
ruleOrdinalQuarterYear = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> quarter <year>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Grain -> Predicate
isGrain Grain
TG.Quarter
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Quarter (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleYyyymmdd :: Rule
ruleYyyymmdd :: Rule
ruleYyyymmdd = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"yyyy-mm-dd"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(\\d{2,4})-(0?[1-9]|1[0-2])-(3[01]|[12]\\d|0?[1-9])"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (yy:mm:dd:_)):[Token]
_) -> do
Int
y <- Text -> Maybe Int
parseInt Text
yy
Int
m <- Text -> Maybe Int
parseInt Text
mm
Int
d <- Text -> Maybe Int
parseInt Text
dd
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> TimeData
yearMonthDay Int
y Int
m Int
d
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTheOrdinalCycleAfterTime :: Rule
ruleTheOrdinalCycleAfterTime :: Rule
ruleTheOrdinalCycleAfterTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"the <ordinal> <cycle> after <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"the"
, Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"after"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Ordinal a
od:Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True a
Grain
grain (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleIntersectByOfFromS :: Rule
ruleIntersectByOfFromS :: Rule
ruleIntersectByOfFromS = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"intersect by \"of\", \"from\", \"'s\""
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isNotLatent
, String -> PatternItem
regex String
"z"
, Predicate -> PatternItem
Predicate Predicate
isNotLatent
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNextNCycle :: Rule
ruleNextNCycle :: Rule
ruleNextNCycle = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"next n <cycle>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"kolejn(ym|y|ego|emu|(a|ą)|ej|e)|nast(e|ę)pn(ym|y|ego|emu|(a|ą)|ej|e)"
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1 Int
9999
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token
token:Token Dimension a
TimeGrain a
grain:[Token]
_) -> do
Int
v <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData
cycleN Bool
True a
Grain
grain Int
v
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleMorning :: Rule
ruleMorning :: Rule
ruleMorning = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"morning"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"rano|poran(ek|ku|ka)|z rana|(s|ś)witem"
]
, prod :: Production
prod = \[Token]
_ ->
let from :: TimeData
from = Bool -> Int -> TimeData
hour Bool
False Int
4
to :: TimeData
to = Bool -> Int -> TimeData
hour Bool
False Int
12
in Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> TimeData)
-> (TimeData -> TimeData) -> TimeData -> TimeData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
partOfDay (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
from TimeData
to
}
ruleThisPartofday :: Rule
ruleThisPartofday :: Rule
ruleThisPartofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"this <part-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ten|tego|ta|to"
, Predicate -> PatternItem
Predicate Predicate
isAPartOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
partOfDay (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect TimeData
today a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleThisCycle :: Rule
ruleThisCycle :: Rule
ruleThisCycle = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"this <cycle>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"te(mu|n|go|j)|tym|t(a|ą)|nadchodz(a|ą)c(ym|y|ego|emu|(a|ą)|ej)|obecn(ym|y|emu|ego|nym|(a|ą)|ej)"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth a
Grain
grain Int
0
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleThisTime :: Rule
ruleThisTime :: Rule
ruleThisTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"this <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"te(mu|n|go|j)|ta|to|tym|nadchodz(a|ą)c(ym|y|ego|emu|(a|ą)|ej)"
, Predicate -> PatternItem
Predicate Predicate
isOkWithThisNext
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Bool -> TimeData -> TimeData
predNth Int
0 Bool
False a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDurationHence :: Rule
ruleDurationHence :: Rule
ruleDurationHence = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<duration> hence"
, pattern :: Pattern
pattern =
[ Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
, String -> PatternItem
regex String
"p(o|ó)(z|ź)niej|potem"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Duration a
dd:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData
inDuration a
DurationData
dd
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthNonOrdinalOfNamedmonth :: Rule
ruleDayofmonthNonOrdinalOfNamedmonth :: Rule
ruleDayofmonthNonOrdinalOfNamedmonth = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month> (non ordinal) of <named-month>"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMInteger
, String -> PatternItem
regex String
"of|in"
, Predicate -> PatternItem
Predicate Predicate
isAMonth
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNthTimeTime :: Rule
ruleNthTimeTime :: Rule
ruleNthTimeTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"nth <time> <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
Time a
td1:Token Dimension a
Time a
td2:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> (TimeData -> TimeData) -> TimeData -> Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Int -> Bool -> TimeData -> TimeData
predNth (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) Bool
False (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect a
TimeData
td2 a
TimeData
td1
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeofdayPopoudniuwieczoremwNocy :: Rule
ruleTimeofdayPopoudniuwieczoremwNocy :: Rule
ruleTimeofdayPopoudniuwieczoremwNocy = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> popołudniu/wieczorem/w nocy"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"(w )?noc(y|(a|ą))|(po ?)?po(l|ł)udni(em|e|a|u)|wiecz(o|ó)r(i|u|a|owi|em|rze)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> TimeData -> TimeData
timeOfDayAMPM Bool
False a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOnANamedday :: Rule
ruleOnANamedday :: Rule
ruleOnANamedday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"on a named-day"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"we?"
, Predicate -> PatternItem
Predicate Predicate
isADayOfWeek
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token
x:[Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just Token
x
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleYearLatent :: Rule
ruleYearLatent :: Rule
ruleYearLatent = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"year (latent)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween (- Int
10000) Int
999
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> TimeData
year Int
n
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleYesterday :: Rule
ruleYesterday :: Rule
ruleYesterday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"yesterday"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"wczoraj(szym|szy)?|wczrj|wczor"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (Int -> TimeData) -> Int -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Grain -> Int -> TimeData
cycleNth Grain
TG.Day (Int -> Maybe Token) -> Int -> Maybe Token
forall a b. (a -> b) -> a -> b
$ - Int
1
}
ruleAfterTimeofday :: Rule
ruleAfterTimeofday :: Rule
ruleAfterTimeofday = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"after <time-of-day>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"po"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ IntervalDirection -> TimeData -> TimeData
withDirection IntervalDirection
TTime.After a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthOrdinal :: Rule
ruleDayofmonthOrdinal :: Rule
ruleDayofmonthOrdinal = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month> (ordinal)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMOrdinal
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal OrdinalData{TOrdinal.value = v}:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> TimeData
dayOfMonth Int
v
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOrdinalCycleAfterTime :: Rule
ruleOrdinalCycleAfterTime :: Rule
ruleOrdinalCycleAfterTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> <cycle> after <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"after"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True a
Grain
grain (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOrdinalCycleOfTime :: Rule
ruleOrdinalCycleOfTime :: Rule
ruleOrdinalCycleOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> <cycle> of <time>"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"w(e)?|z(e)?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Ordinal a
od:Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True a
Grain
grain (OrdinalData -> Int
TOrdinal.value a
OrdinalData
od Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHhmm :: Rule
ruleHhmm :: Rule
ruleHhmm = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"hh:mm"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (hh:mm:_)):[Token]
_) -> do
Int
h <- Text -> Maybe Int
parseInt Text
hh
Int
m <- Text -> Maybe Int
parseInt Text
mm
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
h Int
m
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleFromHourofdayHourofdayInterval :: Rule
ruleFromHourofdayHourofdayInterval :: Rule
ruleFromHourofdayHourofdayInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"from <hour-of-day> - <hour-of-day> (interval)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"od"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"-|to|th?ru|through|until"
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isATimeOfDay]
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleYear :: Rule
ruleYear :: Rule
ruleYear = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"year"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Predicate
isIntegerBetween Int
1000 Int
2100
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> TimeData
year Int
n
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleNamedmonthDayofmonthNonOrdinal :: Rule
ruleNamedmonthDayofmonthNonOrdinal :: Rule
ruleNamedmonthDayofmonthNonOrdinal = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<named-month> <day-of-month> (non ordinal)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isAMonth
, Predicate -> PatternItem
Predicate Predicate
isDOMInteger
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:Token
token:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHhmmMilitary :: Rule
ruleHhmmMilitary :: Rule
ruleHhmmMilitary = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"hhmm (military)"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"((?:[01]?\\d)|(?:2[0-3]))([0-5]\\d)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (hh:mm:_)):[Token]
_) -> do
Int
h <- Text -> Maybe Int
parseInt Text
hh
Int
m <- Text -> Maybe Int
parseInt Text
mm
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TimeData -> TimeData
mkLatent (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
False Int
h Int
m
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleAbsorptionOfAfterNamedDay :: Rule
ruleAbsorptionOfAfterNamedDay :: Rule
ruleAbsorptionOfAfterNamedDay = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"absorption of , after named day"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isADayOfWeek
, String -> PatternItem
regex String
","
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
x:[Token]
_) -> Token -> Maybe Token
forall a. a -> Maybe a
Just Token
x
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleLastDayofweekOfTime :: Rule
ruleLastDayofweekOfTime :: Rule
ruleLastDayofweekOfTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <day-of-week> of <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?"
, Predicate -> PatternItem
Predicate Predicate
isADayOfWeek
, String -> PatternItem
regex String
"w(e)?|z(e)?"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData -> TimeData
predLastOf a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleLastCycleTime :: Rule
ruleLastCycleTime :: Rule
ruleLastCycleTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"last <cycle> <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"ostatni(ego|ch|emu|mi|m|(a|ą)|ej)?"
, Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
TimeGrain a
grain:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> TimeData -> TimeData
cycleLastOf a
Grain
grain a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleByTime :: Rule
ruleByTime :: Rule
ruleByTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"by <time>"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(a(z|ż) )?do"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
_:Token Dimension a
Time a
td:[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Open TimeData
now a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHhmmMilitaryAmpm :: Rule
ruleHhmmMilitaryAmpm :: Rule
ruleHhmmMilitaryAmpm = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"hhmm (military) am|pm"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"((?:1[012]|0?\\d))([0-5]\\d)"
, String -> PatternItem
regex String
"([ap])\\.?m?\\.?"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (hh:mm:_)):
Token Dimension a
RegexMatch (GroupMatch (ap:_)):
[Token]
_) -> do
Int
h <- Text -> Maybe Int
parseInt Text
hh
Int
m <- Text -> Maybe Int
parseInt Text
mm
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> TimeData -> TimeData
timeOfDayAMPM (Text -> Text
Text.toLower Text
ap Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
== Text
"a") (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> TimeData
hourMinute Bool
True Int
h Int
m
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleCycleBeforeTime :: Rule
ruleCycleBeforeTime :: Rule
ruleCycleBeforeTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<cycle> before <time>"
, pattern :: Pattern
pattern =
[ Dimension Grain -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension Grain
TimeGrain
, String -> PatternItem
regex String
"przed"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
TimeGrain a
grain:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False a
Grain
grain (-Int
1) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimeofdayTimeofdayInterval :: Rule
ruleTimeofdayTimeofdayInterval :: Rule
ruleTimeofdayTimeofdayInterval = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> - <time-of-day> (interval)"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isATimeOfDay]
, String -> PatternItem
regex String
"\\-|:|do|po|aż do|az do|aż po|az po"
, Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td1:Token
_:Token Dimension a
Time a
td2:[Token]
_) ->
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeIntervalType -> TimeData -> TimeData -> Maybe TimeData
interval TimeIntervalType
TTime.Closed a
TimeData
td1 a
TimeData
td2
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDurationAfterTime :: Rule
ruleDurationAfterTime :: Rule
ruleDurationAfterTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<duration> after <time>"
, pattern :: Pattern
pattern =
[ Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
, String -> PatternItem
regex String
"po"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Duration a
dd:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData -> TimeData
durationAfter a
DurationData
dd a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleOrdinalQuarter :: Rule
ruleOrdinalQuarter :: Rule
ruleOrdinalQuarter = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<ordinal> quarter"
, pattern :: Pattern
pattern =
[ Dimension OrdinalData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension OrdinalData
Ordinal
, Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ Grain -> Predicate
isGrain Grain
TG.Quarter
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:[Token]
_) -> do
Int
n <- Token -> Maybe Int
getIntValue Token
token
TimeData -> Maybe Token
tt (TimeData -> Maybe Token)
-> (TimeData -> TimeData) -> TimeData -> Maybe Token
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
True Grain
TG.Quarter (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1) (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$
Grain -> Int -> TimeData
cycleNth Grain
TG.Year Int
0
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDurationBeforeTime :: Rule
ruleDurationBeforeTime :: Rule
ruleDurationBeforeTime = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<duration> before <time>"
, pattern :: Pattern
pattern =
[ Dimension DurationData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension DurationData
Duration
, String -> PatternItem
regex String
"do|przed"
, Dimension TimeData -> PatternItem
forall a. Typeable a => Dimension a -> PatternItem
dimension Dimension TimeData
Time
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Duration a
dd:Token
_:Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ DurationData -> TimeData -> TimeData
durationBefore a
DurationData
dd a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleMmddyyyy :: Rule
ruleMmddyyyy :: Rule
ruleMmddyyyy = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"mm/dd/yyyy"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(0?[1-9]|1[0-2])[/-](3[01]|[12]\\d|0?[1-9])[-/](\\d{2,4})"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (mm:dd:yy:_)):[Token]
_) -> do
Int
y <- Text -> Maybe Int
parseInt Text
yy
Int
m <- Text -> Maybe Int
parseInt Text
mm
Int
d <- Text -> Maybe Int
parseInt Text
dd
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> TimeData
yearMonthDay Int
y Int
m Int
d
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleEoyendOfYear :: Rule
ruleEoyendOfYear :: Rule
ruleEoyendOfYear = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"EOY|End of year"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"(na |w )?(koniec|ko(n|ń)ca|ko(n|ń)cu|ko(n|ń)cowi|ko(n|ń)cem|ko(n|ń)c(o|ó)wke) (rok(u|owi|iem))"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth Grain
TG.Year Int
1
}
ruleTomorrow :: Rule
ruleTomorrow :: Rule
ruleTomorrow = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"tomorrow"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"jutr(o|a|u|em|ze(jszy|jsza)?)|jtr|jutr"
]
, prod :: Production
prod = \[Token]
_ -> TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Grain -> Int -> TimeData
cycleNth Grain
TG.Day Int
1
}
ruleTimeofdayOclock :: Rule
ruleTimeofdayOclock :: Rule
ruleTimeofdayOclock = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time-of-day> o'clock"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isATimeOfDay
, String -> PatternItem
regex String
"godzina"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:[Token]
_) ->
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ TimeData -> TimeData
notLatent a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleDayofmonthordinalNamedmonthYear :: Rule
ruleDayofmonthordinalNamedmonthYear :: Rule
ruleDayofmonthordinalNamedmonthYear = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<day-of-month>(ordinal) <named-month> year"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate Predicate
isDOMOrdinal
, Predicate -> PatternItem
Predicate Predicate
isAMonth
, String -> PatternItem
regex String
"(\\d{2,4})"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token
token:
Token Dimension a
Time a
td:
Token Dimension a
RegexMatch (GroupMatch (match:_)):
[Token]
_) -> do
Int
y <- Text -> Maybe Int
parseInt Text
match
TimeData
dom <- TimeData -> Token -> Maybe TimeData
intersectDOM a
TimeData
td Token
token
Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TimeData -> TimeData -> Maybe TimeData
intersect TimeData
dom (Int -> TimeData
year Int
y)
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHhmmss :: Rule
ruleHhmmss :: Rule
ruleHhmmss = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"hh:mm:ss"
, pattern :: Pattern
pattern =
[ String -> PatternItem
regex String
"((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)[:.]([0-5]\\d)"
]
, prod :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
RegexMatch (GroupMatch (hh:mm:ss:_)):[Token]
_) -> do
Int
h <- Text -> Maybe Int
parseInt Text
hh
Int
m <- Text -> Maybe Int
parseInt Text
mm
Int
s <- Text -> Maybe Int
parseInt Text
ss
TimeData -> Maybe Token
tt (TimeData -> Maybe Token) -> TimeData -> Maybe Token
forall a b. (a -> b) -> a -> b
$ Bool -> Int -> Int -> Int -> TimeData
hourMinuteSecond Bool
True Int
h Int
m Int
s
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleTimezone :: Rule
ruleTimezone :: Rule
ruleTimezone = Rule :: Text -> Pattern -> Production -> Rule
Rule
{ name :: Text
name = Text
"<time> timezone"
, pattern :: Pattern
pattern =
[ Predicate -> PatternItem
Predicate (Predicate -> PatternItem) -> Predicate -> PatternItem
forall a b. (a -> b) -> a -> b
$ [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ([Bool] -> Bool) -> (Token -> [Bool]) -> Predicate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Predicate] -> Token -> [Bool]
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
sequence [Predicate
isNotLatent, Predicate
isATimeOfDay]
, String -> PatternItem
regex String
"\\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 :: Production
prod = \[Token]
tokens -> case [Token]
tokens of
(Token Dimension a
Time a
td:
Token Dimension a
RegexMatch (GroupMatch (tz:_)):
[Token]
_) -> Dimension TimeData -> TimeData -> Token
forall a.
(Resolve a, Eq a, Hashable a, Show a, NFData a) =>
Dimension a -> a -> Token
Token Dimension TimeData
Time (TimeData -> Token) -> Maybe TimeData -> Maybe Token
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> TimeData -> Maybe TimeData
inTimezone (Text -> Text
Text.toUpper Text
tz) a
TimeData
td
[Token]
_ -> Maybe Token
forall a. Maybe a
Nothing
}
ruleHolidays :: [Rule]
ruleHolidays :: [Rule]
ruleHolidays =
[(Text, String, TimeData)] -> [Rule]
mkRuleHolidays
[ ( Text
"New Year's Day", String
"nowy rok", Int -> Int -> TimeData
monthDay Int
1 Int
1)
, ( Text
"Three Kings' Day", String
"((ś|s)wi(e|ę)to)? ?trzech kr(o|ó)li", Int -> Int -> TimeData
monthDay Int
1 Int
6)
, ( Text
"Valentine's Day", String
"walentynki", Int -> Int -> TimeData
monthDay Int
2 Int
14)
, ( Text
"Women's Day", String
"dzie(n|ń) kobiet", Int -> Int -> TimeData
monthDay Int
3 Int
8)
, ( Text
"Labour Day", String
"(s|ś)wi(e|ę)to pracy", Int -> Int -> TimeData
monthDay Int
5 Int
1)
, ( Text
"Constitution Day"
, String
"(ś|s)wi(e|ę)to konstytucj(i|a) ?((trzeciego|3) maja)?"
, Int -> Int -> TimeData
monthDay Int
5 Int
3
)
, ( Text
"Mother's Day", String
"dzie(n|ń) ma(my|tki|m)", Int -> Int -> TimeData
monthDay Int
5 Int
26)
, ( Text
"Father's Day", String
"dzie(n|ń) (taty|ojca)", Int -> Int -> TimeData
monthDay Int
6 Int
23)
, ( Text
"Assumption Day"
, String
"(ś|s)wi(e|ę)to wojska polskiego|wniebowzi(e|ę)cie naj(s|ś)wi(e|ę)tszej maryi panny"
, Int -> Int -> TimeData
monthDay Int
8 Int
15
)
, ( Text
"Halloween Day", String
"hall?owe?en( day)?", Int -> Int -> TimeData
monthDay Int
10 Int
31)
, ( Text
"All Saints' Day"
, String
"((ś|s)wi(e|ę)to)? ?wszystkich (s|ś)wi(e|ę)tych"
, Int -> Int -> TimeData
monthDay Int
11 Int
1
)
, ( Text
"Polish Independence Day"
, String
"(s|ś)wi(e|ę)t(a|o) niepodleg(l|ł)o(s|ś)ci|(ś|s)w\\.? niepodleg(l|ł)o(s|ś)ci"
, Int -> Int -> TimeData
monthDay Int
11 Int
11
)
, ( Text
"Saint Nicholas Day", String
"mikołajki", Int -> Int -> TimeData
monthDay Int
12 Int
6)
, ( Text
"Christmas Eve"
, String
"(wigilia|wigilii|wigili(e|ę)|wigili(a|ą)|wigilio) ?(bo(z|ż)ego narodzenia)?"
, Int -> Int -> TimeData
monthDay Int
12 Int
24
)
, ( Text
"Christmas"
, String
"((Ś|ś|s)wi(e|ę)ta)? ?bo(z|ż)(ym|ego|e) narodzeni(e|a|u)"
, Int -> Int -> TimeData
monthDay Int
12 Int
25
)
, ( Text
"St Stephen's Day"
, String
"drugi dzie(n|ń) (s|ś)wi(a|ą)t bo(z|ż)ego narodzenia"
, Int -> Int -> TimeData
monthDay Int
12 Int
26
)
, ( Text
"New Year's Eve", String
"sylwester", Int -> Int -> TimeData
monthDay Int
12 Int
31)
, ( Text
"Thanksgiving Day"
, String
"((s|ś)wiet(a|o)|(dzie(n|ń)))? ?dzi(e|ę)kczynieni(e|a)"
, Int -> Int -> Int -> TimeData
nthDOWOfMonth Int
4 Int
4 Int
11
)
]
ruleComputedHolidays :: [Rule]
ruleComputedHolidays :: [Rule]
ruleComputedHolidays =
[(Text, String, TimeData)] -> [Rule]
mkRuleHolidays
[ ( Text
"Ash Wednesday"
, String
"popielec"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day (-Int
46) TimeData
easterSunday
)
, ( Text
"Palm Sunday"
, String
"niedziela palmowa"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day (-Int
7) TimeData
easterSunday
)
, ( Text
"Good Friday"
, String
"wielki pi(a|ą)tek"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day (-Int
2) TimeData
easterSunday
)
, ( Text
"Holy Saturday"
, String
"wielka sobota"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day (-Int
1) TimeData
easterSunday
)
, ( Text
"Easter Sunday", String
"wielkanoc|niedziela wielkanocna", TimeData
easterSunday)
, ( Text
"Easter Monday"
, String
"poniedzia(l|ł)ek wielkanocny"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day Int
1 TimeData
easterSunday
)
, ( Text
"Pentecost"
, String
"zielone (s|ś)wi(a|ą)tki|zes(l|ł)anie ducha (ś|s)wi(e|ę)tego"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day Int
49 TimeData
easterSunday
)
, ( Text
"Corpus Christi"
, String
"bo(z|ż)e cia(l|ł)o"
, Bool -> Grain -> Int -> TimeData -> TimeData
cycleNthAfter Bool
False Grain
TG.Day Int
60 TimeData
easterSunday
)
]
ruleSeasons :: [Rule]
ruleSeasons :: [Rule]
ruleSeasons =
[(Text, String, TimeData, TimeData)] -> [Rule]
mkRuleSeasons
[ (Text
"lato", String
"lato|lata|latu|latem|lecie", Int -> Int -> TimeData
monthDay Int
6 Int
21, Int -> Int -> TimeData
monthDay Int
9 Int
23)
, ( Text
"jesień"
, String
"jesień|jesien|jesieni|jesienią|jesienia"
, Int -> Int -> TimeData
monthDay Int
9 Int
23
, Int -> Int -> TimeData
monthDay Int
12 Int
21
)
, ( Text
"zima"
, String
"zima|zimy|zimie|zimę|zime|zimą|zima|zimie|zimo"
, Int -> Int -> TimeData
monthDay Int
12 Int
21
, Int -> Int -> TimeData
monthDay Int
3 Int
20
)
, ( Text
"wiosna"
, String
"wiosna|wiosny|wiośnie|wiosnie|wiosnę|wiosne|wiosną|wiosna|wiośnie|wiosnie|wiosno"
, Int -> Int -> TimeData
monthDay Int
3 Int
20
, Int -> Int -> TimeData
monthDay Int
6 Int
21
)
]
rules :: [Rule]
rules :: [Rule]
rules =
[ Rule
ruleAboutTimeofday
, Rule
ruleAbsorptionOfAfterNamedDay
, Rule
ruleAfterDuration
, Rule
ruleAfterTimeofday
, Rule
ruleAfternoon
, Rule
ruleAtTimeofday
, Rule
ruleBetweenDatetimeAndDatetimeInterval
, Rule
ruleBetweenTimeofdayAndTimeofdayInterval
, Rule
ruleByTheEndOfTime
, Rule
ruleByTime
, Rule
ruleCycleAfterTime
, Rule
ruleCycleBeforeTime
, Rule
ruleDatetimeDatetimeInterval
, Rule
ruleDayaftertomorrowSingleword
, Rule
ruleDayBeforeYesterdaySingleWord
, Rule
ruleDayofmonthNonOrdinalNamedmonth
, Rule
ruleDayofmonthNonOrdinalOfNamedmonth
, Rule
ruleDayofmonthOrdinal
, Rule
ruleDayofmonthOrdinalOfNamedmonth
, Rule
ruleDayofmonthordinalNamedmonth
, Rule
ruleDayofmonthordinalNamedmonthYear
, Rule
ruleDurationAfterTime
, Rule
ruleDurationAgo
, Rule
ruleDurationBeforeTime
, Rule
ruleDurationFromNow
, Rule
ruleDurationHence
, Rule
ruleEomendOfMonth
, Rule
ruleEoyendOfYear
, Rule
ruleEveningnight
, Rule
ruleExactlyTimeofday
, Rule
ruleFromDatetimeDatetimeInterval
, Rule
ruleFromHourofdayHourofdayInterval
, Rule
ruleFromTimeofdayTimeofdayInterval
, Rule
ruleHhmm
, Rule
ruleHhmmMilitary
, Rule
ruleHhmmMilitaryAmpm
, Rule
ruleHhmmss
, Rule
ruleHourofdayHourofdayInterval
, Rule
ruleHourofdayIntegerAsRelativeMinutes
, Rule
ruleHourofdayQuarter
, Rule
ruleHourofdayHalf
, Rule
ruleInDuration
, Rule
ruleInduringThePartofday
, Rule
ruleIntegerLatentTimeofday
, Rule
ruleIntersect
, Rule
ruleIntersectBy
, Rule
ruleIntersectByOfFromS
, Rule
ruleLastCycle
, Rule
ruleLastCycleOfTime
, Rule
ruleLastCycleTime
, Rule
ruleLastDayofweekOfTime
, Rule
ruleLastDayofweekTime
, Rule
ruleLastNCycle
, Rule
ruleLastTime
, Rule
ruleLunch
, Rule
ruleMmdd
, Rule
ruleMmddyyyy
, Rule
ruleMonthDdddInterval
, Rule
ruleMorning
, Rule
ruleNamedmonthDayofmonthNonOrdinal
, Rule
ruleNamedmonthDayofmonthOrdinal
, Rule
ruleNextCycle
, Rule
ruleNextNCycle
, Rule
ruleNextTime
, Rule
ruleNoon
, Rule
ruleNow
, Rule
ruleNthTimeAfterTime
, Rule
ruleNthTimeOfTime
, Rule
ruleNthTimeTime
, Rule
ruleOnANamedday
, Rule
ruleOnDate
, Rule
ruleOrdinalAsHour
, Rule
ruleOrdinalCycleAfterTime
, Rule
ruleOrdinalCycleOfTime
, Rule
ruleOrdinalCycleTime
, Rule
ruleOrdinalQuarter
, Rule
ruleOrdinalQuarterYear
, Rule
ruleRelativeMinutesAfterpastIntegerHourofday
, Rule
ruleQuarterAfterpastIntegerHourofday
, Rule
ruleHalfAfterpastIntegerHourofday
, Rule
ruleRelativeMinutesTotillbeforeIntegerHourofday
, Rule
ruleQuarterTotillbeforeIntegerHourofday
, Rule
ruleHalfTotillbeforeIntegerHourofday
, Rule
ruleTheCycleOfTime
, Rule
ruleTheIdesOfNamedmonth
, Rule
ruleTheOrdinalCycleAfterTime
, Rule
ruleThisCycle
, Rule
ruleThisPartofday
, Rule
ruleThisTime
, Rule
ruleThisnextDayofweek
, Rule
ruleTimeAfterNext
, Rule
ruleTimeBeforeLast
, Rule
ruleTimePartofday
, Rule
ruleTimeofdayApproximately
, Rule
ruleTimeofdayOclock
, Rule
ruleTimeofdayPopoudniuwieczoremwNocy
, Rule
ruleTimeofdayRano
, Rule
ruleTimeofdaySharp
, Rule
ruleTimeofdayTimeofdayInterval
, Rule
ruleToday
, Rule
ruleTomorrow
, Rule
ruleUntilTimeofday
, Rule
ruleWeekend
, Rule
ruleWithinDuration
, Rule
ruleYear
, Rule
ruleYearLatent
, Rule
ruleYearLatent2
, Rule
ruleYesterday
, Rule
ruleYyyymmdd
, Rule
ruleTimezone
]
[Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ [Rule]
ruleDaysOfWeek
[Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ [Rule]
ruleMonths
[Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ [Rule]
ruleHolidays
[Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ [Rule]
ruleSeasons
[Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ [Rule]
ruleComputedHolidays