mirror of
https://github.com/facebook/duckling.git
synced 2024-12-01 16:26:20 +03:00
Type for Closed/Open intervals
Summary: This makes the code easier to read. I'm not attached to naming, but this is standard terminology from topology. Reviewed By: JonCoens, patapizza Differential Revision: D4848740 fbshipit-source-id: 79c2c20
This commit is contained in:
parent
b3ca32104d
commit
f46539ced2
@ -202,7 +202,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -224,7 +224,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTheDayofmonthNonOrdinal :: Rule
|
||||
@ -303,7 +304,7 @@ ruleFromDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -372,7 +373,7 @@ ruleMonthDdddInterval = Rule
|
||||
v2 <- parseInt m2
|
||||
let from = intersect (td, dayOfMonth v1)
|
||||
to = intersect (td, dayOfMonth v2)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -419,7 +420,8 @@ ruleSeason4 = Rule
|
||||
, pattern =
|
||||
[ regex "for\x00e5r"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (monthDay 3 20, monthDay 6 21)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (monthDay 3 20, monthDay 6 21)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -514,7 +516,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -608,7 +610,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -646,7 +649,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -851,7 +855,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -899,7 +903,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -911,7 +915,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleBetweenDatetimeAndDatetimeInterval :: Rule
|
||||
@ -925,7 +929,7 @@ ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -960,7 +964,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) -> Just . Token Time $
|
||||
interval True (cycleNth TG.Second 0, td)
|
||||
interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -972,7 +976,7 @@ ruleAfterWork = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 17, hour False 21)
|
||||
td2 = interval TTime.Open (hour False 17, hour False 21)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1012,7 +1016,7 @@ ruleWithinDuration = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Duration dd:_) -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1144,7 +1148,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAboutDuration :: Rule
|
||||
@ -1297,7 +1301,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1373,7 +1378,7 @@ ruleAfterLunch = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 13, hour False 17)
|
||||
td2 = interval TTime.Open (hour False 13, hour False 17)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1420,7 +1425,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1454,7 +1459,8 @@ ruleNight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 0
|
||||
to = hour False 4
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofmonthOrdinal :: Rule
|
||||
@ -1539,7 +1545,7 @@ ruleTonight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1661,7 +1667,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -207,7 +207,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTheDayofmonthNonOrdinal :: Rule
|
||||
@ -272,7 +273,7 @@ ruleFromDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -341,7 +342,7 @@ ruleMonthDdddInterval = Rule
|
||||
v2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth v1, td)
|
||||
to = intersect (dayOfMonth v2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -402,7 +403,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -487,7 +488,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -568,7 +569,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -593,7 +595,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -798,7 +801,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -832,7 +835,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -844,7 +847,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSchweizerBundesfeiertag :: Rule
|
||||
@ -867,7 +870,7 @@ ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -902,7 +905,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) -> Just . Token Time $
|
||||
interval True (td, cycleNth TG.Second 0)
|
||||
interval TTime.Closed (td, cycleNth TG.Second 0)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -914,7 +917,7 @@ ruleAfterWork = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 17, hour False 21)
|
||||
td2 = interval TTime.Open (hour False 17, hour False 21)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -972,7 +975,7 @@ ruleWithinDuration = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Duration dd:_) -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1114,7 +1117,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTagDerDeutschenEinheit :: Rule
|
||||
@ -1264,7 +1267,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 3
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1349,7 +1353,7 @@ ruleAfterLunch = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 13, hour False 17)
|
||||
td2 = interval TTime.Open (hour False 13, hour False 17)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1397,7 +1401,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1431,7 +1435,8 @@ ruleNight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 0
|
||||
to = hour False 4
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofmonthOrdinal :: Rule
|
||||
@ -1556,7 +1561,7 @@ ruleTonight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1679,7 +1684,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ rulePartOfDays = Rule
|
||||
, pattern = [regex "(morning|after ?noo?n|evening|night|(at )?lunch)"]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
let td = interval False $ case Text.toLower match of
|
||||
let td = interval TTime.Open $ case Text.toLower match of
|
||||
"morning" -> (hour False 4, hour False 12)
|
||||
"evening" -> (hour False 18, hour False 0)
|
||||
"night" -> (hour False 18, hour False 0)
|
||||
@ -742,7 +742,7 @@ ruleEarlyMorning = Rule
|
||||
[ regex "early ((in|hours of) the )?morning"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . partOfDay . mkLatent $
|
||||
interval False (hour False 4, hour False 9)
|
||||
interval TTime.Open (hour False 4, hour False 9)
|
||||
}
|
||||
|
||||
rulePODIn :: Rule
|
||||
@ -776,7 +776,7 @@ ruleTonight = Rule
|
||||
, pattern = [regex "toni(ght|gth|te)"]
|
||||
, prod = \_ ->
|
||||
let today = cycleNth TG.Day 0
|
||||
evening = interval False (hour False 18, hour False 0) in
|
||||
evening = interval TTime.Open (hour False 18, hour False 0) in
|
||||
Just . Token Time . partOfDay . notLatent $ intersect (today, evening)
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ ruleAfterPartofday = Rule
|
||||
"school" -> Just (hour False 15, hour False 21)
|
||||
_ -> Nothing
|
||||
Just . Token Time . partOfDay . notLatent $
|
||||
intersect (cycleNth TG.Day 0, interval False pair)
|
||||
intersect (cycleNth TG.Day 0, interval TTime.Open pair)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let fri = intersect (dayOfWeek 5, hour False 18)
|
||||
mon = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (fri, mon)
|
||||
in Just . Token Time $ interval TTime.Open (fri, mon)
|
||||
}
|
||||
|
||||
ruleSeasons :: Rule
|
||||
@ -854,7 +854,7 @@ ruleSeasons = Rule
|
||||
"winter" -> Just $ monthDay 3 20
|
||||
"spring" -> Just $ monthDay 6 21
|
||||
_ -> Nothing
|
||||
Just . Token Time $ interval False (start, end)
|
||||
Just . Token Time $ interval TTime.Open (start, end)
|
||||
_ -> Nothing
|
||||
|
||||
}
|
||||
@ -902,7 +902,7 @@ ruleIntervalMonthDDDD = Rule
|
||||
dd2 <- parseInt d2
|
||||
let dom1 = intersect (dayOfMonth dd1, td)
|
||||
dom2 = intersect (dayOfMonth dd2, td)
|
||||
in Just . Token Time $ interval True (dom1, dom2)
|
||||
in Just . Token Time $ interval TTime.Closed (dom1, dom2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -917,7 +917,7 @@ ruleIntervalDash = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -932,7 +932,7 @@ ruleIntervalFrom = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -947,7 +947,7 @@ ruleIntervalBetween = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -962,7 +962,7 @@ ruleIntervalTODDash = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -977,7 +977,7 @@ ruleIntervalTODFrom = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1004,7 +1004,7 @@ ruleIntervalTODAMPM = Rule
|
||||
Just m -> hourMinute True h m
|
||||
Nothing -> hour True h
|
||||
Just . Token Time $
|
||||
interval True (timeOfDayAMPM td1 ampm, timeOfDayAMPM td2 ampm)
|
||||
interval TTime.Closed (timeOfDayAMPM td1 ampm, timeOfDayAMPM td2 ampm)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1019,7 +1019,7 @@ ruleIntervalTODBetween = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1032,7 +1032,7 @@ ruleIntervalBy = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
Just . Token Time $ interval False (cycleNth TG.Second 0, td)
|
||||
Just . Token Time $ interval TTime.Open (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1045,7 +1045,7 @@ ruleIntervalByTheEndOf = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
Just . Token Time $ interval True (cycleNth TG.Second 0, td)
|
||||
Just . Token Time $ interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1423,7 +1423,7 @@ ruleDurationInWithinAfter = Rule
|
||||
Token Duration dd:
|
||||
_) -> case Text.toLower match of
|
||||
"within" -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
"after" -> Just . Token Time . withDirection TTime.After $ inDuration dd
|
||||
"in" -> Just . Token Time $ inDuration dd
|
||||
_ -> Nothing
|
||||
|
@ -122,7 +122,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -144,7 +144,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayOfMonthSt :: Rule
|
||||
@ -204,7 +205,7 @@ ruleEntreDatetimeEtDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -312,7 +313,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -661,7 +662,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -721,7 +723,7 @@ ruleDdddMonthinterval = Rule
|
||||
d2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth d1, td)
|
||||
to = intersect (dayOfMonth d2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -769,7 +771,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -781,7 +783,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleRightNow :: Rule
|
||||
@ -802,7 +804,7 @@ ruleDimTimeDeLaTarde = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let tarde = interval False (hour False 12, hour False 21)
|
||||
let tarde = interval TTime.Open (hour False 12, hour False 21)
|
||||
in Just . Token Time $ intersect (td, mkLatent $ partOfDay tarde)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -884,7 +886,7 @@ ruleDimTimeDeLaManana = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let manana = interval False (hour False 0, hour False 12)
|
||||
let manana = interval TTime.Open (hour False 0, hour False 12)
|
||||
in Just . Token Time $ intersect (td, mkLatent $ partOfDay manana)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -900,7 +902,7 @@ ruleDeDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -942,7 +944,8 @@ ruleDentroDeDuration = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Duration dd:_) ->
|
||||
Just . Token Time $ interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
Just . Token Time $
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -964,7 +967,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleOrdinalQuarterYear :: Rule
|
||||
@ -1057,7 +1060,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleALasHourmintimeofday :: Rule
|
||||
@ -1131,7 +1135,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofweekDayofmonth :: Rule
|
||||
@ -1195,7 +1199,7 @@ ruleEntreDdEtDdMonthinterval = Rule
|
||||
v2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth v1, td)
|
||||
to = intersect (dayOfMonth v2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1394,7 +1398,8 @@ ruleDelMedioda = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 17
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedday3 :: Rule
|
||||
|
@ -71,7 +71,7 @@ ruleDbutDeJourne = Rule
|
||||
[ regex "d(\x00e9|e)but de journ(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . partOfDay . mkLatent $
|
||||
interval False (hour False 6, hour False 10)
|
||||
interval TTime.Open (hour False 6, hour False 10)
|
||||
}
|
||||
|
||||
ruleLeLendemainDuTime :: Rule
|
||||
@ -173,7 +173,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -200,7 +200,7 @@ ruleDatetimeddMonthinterval = Rule
|
||||
n <- parseInt match
|
||||
let from = intersect (td2, td1)
|
||||
to = intersect (dayOfMonth n, td2)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ ruleDeTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ ruleEntreDatetimeEtDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ ruleDatetimedayofweekDdMonthinterval = Rule
|
||||
n <- parseInt match
|
||||
let from = intersect (td2, td1)
|
||||
to = intersect (dayOfMonth n, td2)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -370,7 +370,8 @@ ruleDiciDuration = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Duration dd:_) ->
|
||||
Just . Token Time $ interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
Just . Token Time $
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -433,7 +434,8 @@ ruleSeason4 = Rule
|
||||
, pattern =
|
||||
[ regex "(ce )?printemps"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (monthDay 3 20, monthDay 6 21)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (monthDay 3 20, monthDay 6 21)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -473,7 +475,8 @@ ruleDimTimeDuMatin = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let morning = partOfDay . mkLatent $ interval False (hour False 0, hour False 12)
|
||||
let morning = partOfDay . mkLatent $
|
||||
interval TTime.Open (hour False 0, hour False 12)
|
||||
in Just . Token Time $ intersect (td, morning)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -491,7 +494,7 @@ ruleOrdinalWeekendDeTime = Rule
|
||||
n <- getIntValue token
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
td2 = intersect (td, interval False (from, to))
|
||||
td2 = intersect (td, interval TTime.Open (from, to))
|
||||
Just . Token Time $ predNth (n - 1) False td2
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -703,7 +706,8 @@ ruleEnSemaine = Rule
|
||||
, pattern =
|
||||
[ regex "(pendant la |en )?semaine"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (dayOfWeek 1, dayOfWeek 5)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (dayOfWeek 1, dayOfWeek 5)
|
||||
}
|
||||
|
||||
ruleDdmm :: Rule
|
||||
@ -778,7 +782,7 @@ ruleSoir = Rule
|
||||
[ regex "soir(\x00e9|e)?e?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 18, hour False 0)
|
||||
interval TTime.Open (hour False 18, hour False 0)
|
||||
}
|
||||
|
||||
ruleDbutDeSoire :: Rule
|
||||
@ -788,7 +792,7 @@ ruleDbutDeSoire = Rule
|
||||
[ regex "d(\x00e9|e)but de soir(\x00e9|e)e?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 18, hour False 21)
|
||||
interval TTime.Open (hour False 18, hour False 21)
|
||||
}
|
||||
|
||||
ruleFinDeSoire :: Rule
|
||||
@ -798,7 +802,7 @@ ruleFinDeSoire = Rule
|
||||
[ regex "fin de soir(\x00e9|e)e?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 21, hour False 0)
|
||||
interval TTime.Open (hour False 21, hour False 0)
|
||||
}
|
||||
|
||||
ruleDbutDeMatine :: Rule
|
||||
@ -808,7 +812,7 @@ ruleDbutDeMatine = Rule
|
||||
[ regex "le matin (tr(e|\x00e8)s )?t(\x00f4|o)t|(tr(e|\x00e8)s )?t(\x00f4|o)t le matin|d(\x00e9|e)but de matin(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 7, hour False 9)
|
||||
interval TTime.Open (hour False 7, hour False 9)
|
||||
}
|
||||
|
||||
ruleNamedday5 :: Rule
|
||||
@ -835,7 +839,7 @@ ruleDdddMonthinterval = Rule
|
||||
d2 <- parseInt m2
|
||||
let from = intersect (td, dayOfMonth d1)
|
||||
to = intersect (td, dayOfMonth d2)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -869,7 +873,7 @@ ruleDuDddayofweekDdMonthinterval = Rule
|
||||
d2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth d1, td)
|
||||
to = intersect (dayOfMonth d2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -884,7 +888,7 @@ ruleDbutNamedmonthinterval = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfMonth 1, td)
|
||||
to = intersect (dayOfMonth 5, td)
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -904,7 +908,7 @@ ruleMilieuDeJourne = Rule
|
||||
[ regex "milieu de journ(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 11, hour False 16)
|
||||
interval TTime.Open (hour False 11, hour False 16)
|
||||
}
|
||||
|
||||
ruleFinDeJourne :: Rule
|
||||
@ -914,7 +918,7 @@ ruleFinDeJourne = Rule
|
||||
[ regex "fin de journ(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 17, hour False 21)
|
||||
interval TTime.Open (hour False 17, hour False 21)
|
||||
}
|
||||
|
||||
ruleLeCycleDeTime :: Rule
|
||||
@ -938,7 +942,8 @@ ruleSeason3 = Rule
|
||||
, pattern =
|
||||
[ regex "(cet )?hiver"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (monthDay 12 21, monthDay 3 20)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (monthDay 12 21, monthDay 3 20)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -947,7 +952,8 @@ ruleSeason = Rule
|
||||
, pattern =
|
||||
[ regex "(cet )?(\x00e9|e)t(\x00e9|e)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (monthDay 6 21, monthDay 9 23)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (monthDay 6 21, monthDay 9 23)
|
||||
}
|
||||
|
||||
ruleAprsmidi :: Rule
|
||||
@ -957,7 +963,7 @@ ruleAprsmidi = Rule
|
||||
[ regex "apr(e|\x00e9|\x00e8)s?[ \\-]?midi"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 12, hour False 19)
|
||||
interval TTime.Open (hour False 12, hour False 19)
|
||||
}
|
||||
|
||||
ruleNoel :: Rule
|
||||
@ -1040,7 +1046,8 @@ ruleDimTimeDuSoir = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let td2 = mkLatent . partOfDay $ interval False (hour False 16, hour False 0)
|
||||
let td2 = mkLatent . partOfDay $
|
||||
interval TTime.Open (hour False 16, hour False 0)
|
||||
in Just . Token Time $ intersect (td, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -1066,7 +1073,7 @@ ruleAprsLeDjeuner = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 13, hour False 17)
|
||||
td2 = interval TTime.Open (hour False 13, hour False 17)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1103,7 +1110,7 @@ rulePremireQuinzaineDeNamedmonthinterval = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfMonth 1, td)
|
||||
to = intersect (dayOfMonth 14, td)
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1118,7 +1125,7 @@ ruleDeDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1161,7 +1168,7 @@ ruleAprsLeTravail = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 17, hour False 21)
|
||||
td2 = interval TTime.Open (hour False 17, hour False 21)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1199,7 +1206,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleCedansLeCycle :: Rule
|
||||
@ -1252,7 +1259,7 @@ ruleAvantLeDjeuner = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 10, hour False 12)
|
||||
td2 = interval TTime.Open (hour False 10, hour False 12)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1267,7 +1274,7 @@ ruleDernierWeekendDeTime = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ predLastOf (interval False (from, to)) td
|
||||
in Just . Token Time $ predLastOf (interval TTime.Open (from, to)) td
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1321,7 +1328,7 @@ ruleEntreTimeofdayEtTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1350,7 +1357,7 @@ ruleDeuximeQuinzaineDeNamedmonthinterval = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfMonth 15, td)
|
||||
to = cycleLastOf TG.Day td
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1389,7 +1396,8 @@ ruleMilieuDeSemaine = Rule
|
||||
, pattern =
|
||||
[ regex "(en |au )?milieu de (cette |la )?semaine"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (dayOfWeek 3, dayOfWeek 4)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (dayOfWeek 3, dayOfWeek 4)
|
||||
}
|
||||
|
||||
ruleDbutDeSemaine :: Rule
|
||||
@ -1398,7 +1406,8 @@ ruleDbutDeSemaine = Rule
|
||||
, pattern =
|
||||
[ regex "(en |au )?d(\x00e9|e)but de (cette |la )?semaine"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (dayOfWeek 1, dayOfWeek 2)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (dayOfWeek 1, dayOfWeek 2)
|
||||
}
|
||||
|
||||
ruleTimeofdayHeures :: Rule
|
||||
@ -1458,7 +1467,7 @@ ruleDuDatetimedayofweekDdMonthinterval = Rule
|
||||
n <- parseInt m
|
||||
let from = intersect (td2, td1)
|
||||
to = intersect (dayOfMonth n, td2)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1475,7 +1484,7 @@ ruleDuDdAuDdinterval = Rule
|
||||
(_:Token RegexMatch (GroupMatch (m1:_)):_:Token RegexMatch (GroupMatch (m2:_)):_) -> do
|
||||
n1 <- parseInt m1
|
||||
n2 <- parseInt m2
|
||||
Just . Token Time $ interval True (dayOfMonth n1, dayOfMonth n2)
|
||||
Just . Token Time $ interval TTime.Closed (dayOfMonth n1, dayOfMonth n2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1486,7 +1495,7 @@ ruleMatin = Rule
|
||||
[ regex "mat(in(\x00e9|e)?e?)?"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 4, hour False 12)
|
||||
interval TTime.Open (hour False 4, hour False 12)
|
||||
}
|
||||
|
||||
ruleYearLatent :: Rule
|
||||
@ -1508,7 +1517,8 @@ ruleSeason2 = Rule
|
||||
, pattern =
|
||||
[ regex "(cet )?automne"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (monthDay 9 23, monthDay 12 21)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (monthDay 9 23, monthDay 12 21)
|
||||
}
|
||||
|
||||
ruleVersTimeofday :: Rule
|
||||
@ -1535,7 +1545,7 @@ ruleFinNamedmonthinterval = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfMonth 25, td)
|
||||
to = cycleLastOf TG.Day td
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1623,7 +1633,7 @@ ruleEntreDdEtDdMonthinterval = Rule
|
||||
n2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth n1, td)
|
||||
to = intersect (dayOfMonth n2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1660,7 +1670,8 @@ ruleFinDeSemaine = Rule
|
||||
, pattern =
|
||||
[ regex "(en |(\x00e0|a) la )?fin de (cette |la )?semaine"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $ interval False (dayOfWeek 4, dayOfWeek 7)
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval TTime.Open (dayOfWeek 4, dayOfWeek 7)
|
||||
}
|
||||
|
||||
ruleIlYADuration :: Rule
|
||||
@ -1696,7 +1707,7 @@ ruleAuDjeuner = Rule
|
||||
[ regex "((\x00e0|a) l(')?heure du|pendant( le)?|au)? d(e|\x00e9|\x00e8)jeuner"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 12, hour False 14)
|
||||
interval TTime.Open (hour False 12, hour False 14)
|
||||
}
|
||||
|
||||
ruleYear :: Rule
|
||||
@ -1737,7 +1748,7 @@ ruleMilieuDeMatine = Rule
|
||||
[ regex "milieu de matin(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 9, hour False 11)
|
||||
interval TTime.Open (hour False 9, hour False 11)
|
||||
}
|
||||
|
||||
ruleFinDeMatine :: Rule
|
||||
@ -1747,7 +1758,7 @@ ruleFinDeMatine = Rule
|
||||
[ regex "fin de matin(\x00e9|e)e"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 10, hour False 12)
|
||||
interval TTime.Open (hour False 10, hour False 12)
|
||||
}
|
||||
|
||||
ruleDdmmyyyy :: Rule
|
||||
@ -1799,7 +1810,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1832,7 +1843,7 @@ ruleDbutDaprsmidi = Rule
|
||||
[ regex "d(\x00e9|e)but d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 12, hour False 14)
|
||||
interval TTime.Open (hour False 12, hour False 14)
|
||||
}
|
||||
|
||||
ruleLeTime :: Rule
|
||||
@ -1856,7 +1867,7 @@ ruleSoirDeNol = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (monthDay 12 24, hour False 18)
|
||||
to = intersect (monthDay 12 25, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofweekDayofmonthTimeofday :: Rule
|
||||
@ -1881,7 +1892,7 @@ ruleMilieuDaprsmidi = Rule
|
||||
[ regex "milieu d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 15, hour False 17)
|
||||
interval TTime.Open (hour False 15, hour False 17)
|
||||
}
|
||||
|
||||
ruleFinDaprsmidi :: Rule
|
||||
@ -1891,7 +1902,7 @@ ruleFinDaprsmidi = Rule
|
||||
[ regex "fin d'apr(e|\x00e9|\x00e8)s?[ \\-]?midi"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 17, hour False 19)
|
||||
interval TTime.Open (hour False 17, hour False 19)
|
||||
}
|
||||
|
||||
ruleJourDeLan :: Rule
|
||||
@ -1947,7 +1958,7 @@ ruleNamedmonth13 = Rule
|
||||
(_:Token Time td:_) ->
|
||||
let from = intersect (dayOfMonth 10, td)
|
||||
to = intersect (dayOfMonth 19, td)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1967,7 +1978,7 @@ ruleDayofweekErdayofweekDdMonthinterval = Rule
|
||||
n <- parseInt m
|
||||
let from = intersect (dayOfMonth 1, td)
|
||||
to = intersect (dayOfMonth n, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1989,7 +2000,7 @@ ruleFinDuMois = Rule
|
||||
, prod = \_ -> do
|
||||
let from = cycleNthAfter False TG.Day (- 10) $ cycleNth TG.Month 1
|
||||
to = cycleNth TG.Month 1
|
||||
Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
Just . Token Time . mkLatent . partOfDay $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTimezone :: Rule
|
||||
|
@ -124,12 +124,12 @@ takeN n notImmediate f = mkSeriesPredicate series
|
||||
slot = if n >= 0
|
||||
then case fut of
|
||||
(start:_) -> case drop n fut of
|
||||
(end:_) -> Just $ TTime.timeInterval False start end
|
||||
(end:_) -> Just $ TTime.timeInterval TTime.Open start end
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
else case past of
|
||||
(end:_) -> case drop ((- n) - 1) past of
|
||||
(start:_) -> Just $ TTime.timeInterval True start end
|
||||
(start:_) -> Just $ TTime.timeInterval TTime.Closed start end
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
|
||||
@ -237,13 +237,15 @@ timeSeqMap dontReverse f g = mkSeriesPredicate series
|
||||
-- future from the future's series tacked on
|
||||
future = sortedFuture ++ oldFuture
|
||||
|
||||
timeIntervals :: Bool -> TTime.Predicate -> TTime.Predicate -> TTime.Predicate
|
||||
timeIntervals isOuter pred1 pred2 = timeSeqMap True f pred1
|
||||
timeIntervals
|
||||
:: TTime.TimeIntervalType -> TTime.Predicate
|
||||
-> TTime.Predicate -> TTime.Predicate
|
||||
timeIntervals intervalType pred1 pred2 = timeSeqMap True f pred1
|
||||
where
|
||||
-- Pick the first interval *after* the given time segment
|
||||
f thisSegment ctx = case runPredicate pred2 thisSegment ctx of
|
||||
(_, firstFuture:_) -> Just $
|
||||
TTime.timeInterval isOuter thisSegment firstFuture
|
||||
TTime.timeInterval intervalType thisSegment firstFuture
|
||||
_ -> Nothing
|
||||
|
||||
shiftDuration :: TTime.Predicate -> DurationData -> TTime.Predicate
|
||||
@ -452,12 +454,16 @@ predNthAfter n TimeData {TTime.timePred = p, TTime.timeGrain = g} base =
|
||||
, TTime.timeGrain = g
|
||||
}
|
||||
|
||||
interval :: Bool -> (TimeData, TimeData) -> TimeData
|
||||
interval isOuter (TimeData p1 _ g1 _ _ _, TimeData p2 _ g2 _ _ _) =
|
||||
interval :: TTime.TimeIntervalType -> (TimeData, TimeData) -> TimeData
|
||||
interval intervalType (TimeData p1 _ g1 _ _ _, TimeData p2 _ g2 _ _ _) =
|
||||
TTime.timedata'
|
||||
{TTime.timePred = timeIntervals outer p1 p2, TTime.timeGrain = min g1 g2}
|
||||
{ TTime.timePred = timeIntervals intervalType' p1 p2
|
||||
, TTime.timeGrain = min g1 g2
|
||||
}
|
||||
where
|
||||
outer = isOuter || (g1 == g2 && g1 == TG.Day)
|
||||
intervalType'
|
||||
| g1 == g2 && g1 == TG.Day = TTime.Closed
|
||||
| otherwise = intervalType
|
||||
|
||||
durationAgo :: DurationData -> TimeData
|
||||
durationAgo dd = inDuration $ timeNegPeriod dd
|
||||
@ -509,7 +515,7 @@ withDirection :: TTime.IntervalDirection -> TimeData -> TimeData
|
||||
withDirection dir td = td {TTime.direction = Just dir}
|
||||
|
||||
longWEBefore :: TimeData -> TimeData
|
||||
longWEBefore monday = interval False (start, end)
|
||||
longWEBefore monday = interval TTime.Open (start, end)
|
||||
where
|
||||
start = intersect (fri, hour False 18)
|
||||
end = intersect (tue, hour False 0)
|
||||
|
@ -112,7 +112,7 @@ ruleStanotte = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 1
|
||||
td2 = interval False (hour False 0, hour False 4)
|
||||
td2 = interval TTime.Open (hour False 0, hour False 4)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ ruleDomattina = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 1
|
||||
td2 = interval False (hour False 4, hour False 12)
|
||||
td2 = interval TTime.Open (hour False 4, hour False 12)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ ruleStamattina = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 4, hour False 12)
|
||||
td2 = interval TTime.Open (hour False 4, hour False 12)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ ruleDdddMonthInterval = Rule
|
||||
v2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth v1, td)
|
||||
to = intersect (dayOfMonth v2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -423,7 +423,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -445,7 +445,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayOfMonthSt :: Rule
|
||||
@ -469,7 +470,7 @@ ruleInDuration = Rule
|
||||
Token Duration dd:
|
||||
_) -> case Text.toLower match of
|
||||
"entro" -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, inDuration dd)
|
||||
interval TTime.Open (cycleNth TG.Second 0, inDuration dd)
|
||||
"in" -> Just . Token Time $ inDuration dd
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
@ -989,7 +990,8 @@ ruleDalIntAlInt = Rule
|
||||
(_:token1:_:token2:_) -> do
|
||||
v1 <- getIntValue token1
|
||||
v2 <- getIntValue token2
|
||||
Just . Token Time $ interval True (dayOfMonth v1, dayOfMonth v2)
|
||||
Just . Token Time $
|
||||
interval TTime.Closed (dayOfMonth v1, dayOfMonth v2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1006,7 +1008,8 @@ ruleTraIlIntEIlInt = Rule
|
||||
(_:token1:_:token2:_) -> do
|
||||
v1 <- getIntValue token1
|
||||
v2 <- getIntValue token2
|
||||
Just . Token Time $ interval True (dayOfMonth v1, dayOfMonth v2)
|
||||
Just . Token Time $
|
||||
interval TTime.Closed (dayOfMonth v1, dayOfMonth v2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1086,7 +1089,7 @@ ruleEntroIlDuration = Rule
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = cycleNth grain 1
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1113,7 +1116,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -1202,7 +1205,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDdmm :: Rule
|
||||
@ -1243,7 +1247,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -1280,7 +1285,7 @@ ruleDimTimeDelMattino = Rule
|
||||
(Token Time td:_) ->
|
||||
let from = hour False 0
|
||||
to = hour False 12
|
||||
td2 = mkLatent . partOfDay $ interval False (from, to)
|
||||
td2 = mkLatent . partOfDay $ interval TTime.Open (from, to)
|
||||
in Just . Token Time $ intersect (td, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -1354,7 +1359,7 @@ ruleTimeNotte = Rule
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let td1 = cycleNthAfter False TG.Day 1 td
|
||||
td2 = interval False (hour False 0, hour False 4)
|
||||
td2 = interval TTime.Open (hour False 0, hour False 4)
|
||||
in Just . Token Time $ intersect (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -1376,7 +1381,7 @@ ruleStasera = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1389,7 +1394,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -1401,7 +1406,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleIntegerLatentTimeofday :: Rule
|
||||
@ -1473,7 +1478,7 @@ ruleTimeNotte2 = Rule
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
let td1 = cycleNthAfter False TG.Day 1 td
|
||||
td2 = interval False (hour False 0, hour False 4)
|
||||
td2 = interval TTime.Open (hour False 0, hour False 4)
|
||||
in Just . Token Time $ intersect (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -1528,7 +1533,7 @@ ruleFinoAlDatetimeInterval = Rule
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
let now = cycleNth TG.Second 0
|
||||
in Just . Token Time $ interval False (now, td)
|
||||
in Just . Token Time $ interval TTime.Open (now, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1605,7 +1610,7 @@ ruleDalDatetimeAlDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1622,7 +1627,7 @@ ruleTimeofdayTimeofdayDayofmonthInterval = Rule
|
||||
(Token Time td1:_:Token Time td2:Token Time td3:_) ->
|
||||
let from = intersect (td1, td3)
|
||||
to = intersect (td2, td3)
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1635,7 +1640,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleIlWeekendDelTime :: Rule
|
||||
@ -1651,7 +1656,7 @@ ruleIlWeekendDelTime = Rule
|
||||
from = intersect (from1, hour False 18)
|
||||
to1 = intersect (cycleNthAfter False TG.Week 1 td, dayOfWeek 1)
|
||||
to = intersect (to1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1706,7 +1711,7 @@ ruleTraIlDatetimeEIlDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1888,7 +1893,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTheDayofmonth :: Rule
|
||||
@ -2001,7 +2007,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleCircaPerLeTimeofday :: Rule
|
||||
@ -2045,7 +2051,7 @@ ruleNight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 1
|
||||
td2 = interval False (hour False 0, hour False 4)
|
||||
td2 = interval TTime.Open (hour False 0, hour False 4)
|
||||
in Just . Token Time . partOfDay . mkLatent $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -2131,7 +2137,7 @@ ruleDalleTimeofdayAlleTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -2315,7 +2321,7 @@ ruleProssimiUnitofduration = Rule
|
||||
(_:Token TimeGrain grain:_) ->
|
||||
let from = cycleNth grain 1
|
||||
to = cycleNth grain 3
|
||||
in Just . Token Time $ interval True (from, to)
|
||||
in Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -423,7 +423,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -448,7 +449,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleChristmasEve :: Rule
|
||||
@ -548,7 +550,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -560,7 +562,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayWithKoreanNumeral :: Rule
|
||||
@ -679,7 +681,7 @@ ruleWithinDuration = Rule
|
||||
(Token Duration dd:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = inDuration dd
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -752,7 +754,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTimeDayofweek :: Rule
|
||||
@ -847,7 +849,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisCycle :: Rule
|
||||
@ -929,7 +932,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1093,7 +1096,7 @@ ruleByTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, td)
|
||||
interval TTime.Open (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1138,7 +1141,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1160,7 +1163,8 @@ ruleEveningnight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . partOfDay . mkLatent $ interval False (from, to)
|
||||
in Just . Token Time . partOfDay . mkLatent $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleIndependenceMovementDay :: Rule
|
||||
|
@ -282,7 +282,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -304,7 +304,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTheDayofmonthNonOrdinal :: Rule
|
||||
@ -383,7 +384,7 @@ ruleFromDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -406,7 +407,7 @@ ruleMonthDdddInterval = Rule
|
||||
dd2 <- parseInt d2
|
||||
let dom1 = intersect (dayOfMonth dd1, td)
|
||||
dom2 = intersect (dayOfMonth dd2, td)
|
||||
in Just . Token Time $ interval True (dom1, dom2)
|
||||
in Just . Token Time $ interval TTime.Closed (dom1, dom2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -539,7 +540,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -634,7 +635,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -673,7 +675,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -833,7 +836,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -881,7 +884,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleBetweenDatetimeAndDatetimeInterval :: Rule
|
||||
@ -895,7 +898,7 @@ ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -930,7 +933,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) -> Just . Token Time $
|
||||
interval True (cycleNth TG.Second 0, td)
|
||||
interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -942,7 +945,7 @@ ruleAfterWork = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 17, hour False 21)
|
||||
td2 = interval TTime.Open (hour False 17, hour False 21)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -984,7 +987,7 @@ ruleWithinDuration = Rule
|
||||
(_:Token Duration dd:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = inDuration dd
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1115,7 +1118,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleEomendOfMonth :: Rule
|
||||
@ -1261,7 +1264,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1324,7 +1328,7 @@ ruleAfterLunch = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 13, hour False 17)
|
||||
td2 = interval TTime.Open (hour False 13, hour False 17)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1372,7 +1376,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1406,7 +1410,8 @@ ruleNight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 0
|
||||
to = hour False 4
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofmonthOrdinal :: Rule
|
||||
@ -1491,7 +1496,7 @@ ruleTonight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1613,7 +1618,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -313,7 +313,7 @@ ruleFromDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -348,7 +348,7 @@ ruleMonthDdddInterval = Rule
|
||||
dd2 <- parseInt d2
|
||||
let dom1 = intersect (dayOfMonth dd1, td)
|
||||
dom2 = intersect (dayOfMonth dd2, td)
|
||||
in Just . Token Time $ interval True (dom1, dom2)
|
||||
in Just . Token Time $ interval TTime.Closed (dom1, dom2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -455,7 +455,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -574,7 +574,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -599,7 +600,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleHourofdayHourofdayInterval :: Rule
|
||||
@ -612,7 +614,7 @@ ruleHourofdayHourofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -795,7 +797,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -829,7 +831,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -841,7 +843,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleIntegerLatentTimeofday :: Rule
|
||||
@ -868,7 +870,7 @@ ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -903,7 +905,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) -> Just . Token Time $
|
||||
interval True (cycleNth TG.Second 0, td)
|
||||
interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -954,7 +956,7 @@ ruleWithinDuration = Rule
|
||||
(_:Token Duration dd:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = inDuration dd
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1088,7 +1090,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleEomendOfMonth :: Rule
|
||||
@ -1205,7 +1207,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1342,7 +1345,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1452,7 +1455,7 @@ ruleFromHourofdayHourofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1572,7 +1575,7 @@ ruleByTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
Just . Token Time $ interval False (cycleNth TG.Second 0, td)
|
||||
Just . Token Time $ interval TTime.Open (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1618,7 +1621,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1654,7 +1657,8 @@ ruleEveningnight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleOrdinalQuarter :: Rule
|
||||
|
@ -156,7 +156,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -178,7 +178,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayOfMonthSt :: Rule
|
||||
@ -208,7 +209,8 @@ ruleDimTimeDaMadrugada = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let td2 = mkLatent . partOfDay $ interval False (hour False 1, hour False 4)
|
||||
let td2 = mkLatent . partOfDay $
|
||||
interval TTime.Open (hour False 1, hour False 4)
|
||||
in Just . Token Time $ intersect (td, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -300,7 +302,7 @@ ruleSeason4 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 3 20
|
||||
to = monthDay 6 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleYearLatent2 :: Rule
|
||||
@ -685,7 +687,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -706,7 +709,8 @@ ruleDimTimeDaManha = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let td2 = mkLatent . partOfDay $ interval False (hour False 4, hour False 12)
|
||||
let td2 = mkLatent . partOfDay $
|
||||
interval TTime.Open (hour False 4, hour False 12)
|
||||
in Just . Token Time $ intersect (td, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -765,7 +769,7 @@ ruleDdddMonthinterval = Rule
|
||||
d2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth d1, td)
|
||||
to = intersect (dayOfMonth d2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -826,7 +830,7 @@ ruleSeason3 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleSeason :: Rule
|
||||
@ -838,7 +842,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleRightNow :: Rule
|
||||
@ -942,7 +946,7 @@ ruleDeDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -966,7 +970,7 @@ ruleDentroDeDuration = Rule
|
||||
(_:Token Duration dd:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = inDuration dd
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1001,7 +1005,8 @@ ruleDimTimeDaTarde = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td:_) ->
|
||||
let td2 = mkLatent . partOfDay $ interval False (hour False 12, hour False 18)
|
||||
let td2 = mkLatent . partOfDay $
|
||||
interval TTime.Open (hour False 12, hour False 18)
|
||||
in Just . Token Time $ intersect (td, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
@ -1015,7 +1020,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofweekSHourmin :: Rule
|
||||
@ -1186,7 +1191,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent .partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent .partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1255,7 +1261,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 9 23
|
||||
to = monthDay 12 21
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDiaDoTrabalhador :: Rule
|
||||
@ -1319,7 +1325,7 @@ ruleEntreDatetimeEDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval False (td1, td2)
|
||||
Just . Token Time $ interval TTime.Open (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1346,7 +1352,7 @@ ruleEntreDdEtDdMonthinterval = Rule
|
||||
dd2 <- parseInt d2
|
||||
let dom1 = intersect (dayOfMonth dd1, td)
|
||||
dom2 = intersect (dayOfMonth dd2, td)
|
||||
in Just . Token Time $ interval True (dom1, dom2)
|
||||
in Just . Token Time $ interval TTime.Closed (dom1, dom2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ ruleDupamiaza = Rule
|
||||
[ regex "dupamiaz(a|\x0103)|dup(a|\x0103) amiaz(a|\x0103)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 12, hour False 19)
|
||||
interval TTime.Open (hour False 12, hour False 19)
|
||||
}
|
||||
|
||||
ruleNamedmonth12 :: Rule
|
||||
@ -192,7 +192,7 @@ ruleMonthDdddInterval = Rule
|
||||
d2 <- parseInt m2
|
||||
let dom1 = intersect (dayOfMonth d1, td)
|
||||
dom2 = intersect (dayOfMonth d2, td)
|
||||
Just . Token Time $ interval True (dom1, dom2)
|
||||
Just . Token Time $ interval TTime.Closed (dom1, dom2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -304,7 +304,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ ruleDiseara = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ ruleSeason3 = Rule
|
||||
[ regex "primavar(a|\x0103)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval False (monthDay 3 20, monthDay 6 21)
|
||||
interval TTime.Open (monthDay 3 20, monthDay 6 21)
|
||||
}
|
||||
|
||||
ruleUrmatoareleNCycle :: Rule
|
||||
@ -628,7 +628,7 @@ ruleSeason = Rule
|
||||
[ regex "toamn(a|\x0103)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time $
|
||||
interval False (monthDay 9 23, monthDay 12 21)
|
||||
interval TTime.Open (monthDay 9 23, monthDay 12 21)
|
||||
}
|
||||
|
||||
ruleDupaDuration :: Rule
|
||||
@ -662,7 +662,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
Just . Token Time $ interval True (cycleNth TG.Second 0, td)
|
||||
Just . Token Time $ interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -761,7 +761,7 @@ ruleIntreDatetimeSiDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -812,7 +812,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let fri = intersect (dayOfWeek 5, hour False 18)
|
||||
mon = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (fri, mon)
|
||||
in Just . Token Time $ interval TTime.Open (fri, mon)
|
||||
}
|
||||
|
||||
rulePeDayofmonthNonOrdinal :: Rule
|
||||
@ -1001,7 +1001,7 @@ ruleSezonAnotimp = Rule
|
||||
[ regex "var(a|\x0103)"
|
||||
]
|
||||
, prod = \_ ->
|
||||
Just . Token Time $ interval False (monthDay 6 21, monthDay 9 23)
|
||||
Just . Token Time $ interval TTime.Open (monthDay 6 21, monthDay 9 23)
|
||||
}
|
||||
|
||||
ruleSearaNoapte :: Rule
|
||||
@ -1011,7 +1011,7 @@ ruleSearaNoapte = Rule
|
||||
[ regex "sear(a|\x0103)|noapte"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 18, hour False 0)
|
||||
interval TTime.Open (hour False 18, hour False 0)
|
||||
}
|
||||
|
||||
ruleYearLatent :: Rule
|
||||
@ -1034,7 +1034,7 @@ ruleSeason2 = Rule
|
||||
[ regex "iarn(a|\x0103)"
|
||||
]
|
||||
, prod = \_ ->
|
||||
Just . Token Time $ interval False (monthDay 12 21, monthDay 3 20)
|
||||
Just . Token Time $ interval TTime.Open (monthDay 12 21, monthDay 3 20)
|
||||
}
|
||||
|
||||
ruleUltimeleNCycle :: Rule
|
||||
@ -1071,7 +1071,7 @@ ruleDimineata = Rule
|
||||
[ regex "diminea(t|\x021b)(a|\x0103)"
|
||||
]
|
||||
, prod = \_ -> Just . Token Time . mkLatent . partOfDay $
|
||||
interval False (hour False 4, hour False 12)
|
||||
interval TTime.Open (hour False 4, hour False 12)
|
||||
}
|
||||
|
||||
ruleTimeUrmatoarer :: Rule
|
||||
@ -1278,7 +1278,7 @@ ruleByTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) -> Just . Token Time $
|
||||
interval False (cycleNth TG.Second 0, td)
|
||||
interval TTime.Open (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ ruleDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -296,7 +296,8 @@ ruleEvening = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleTheDayofmonthNonOrdinal :: Rule
|
||||
@ -375,7 +376,7 @@ ruleFromDatetimeDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -398,7 +399,7 @@ ruleMonthDdddInterval = Rule
|
||||
v2 <- parseInt m2
|
||||
let from = intersect (dayOfMonth v1, td)
|
||||
to = intersect (dayOfMonth v2, td)
|
||||
Just . Token Time $ interval True (from, to)
|
||||
Just . Token Time $ interval TTime.Closed (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -531,7 +532,7 @@ ruleBetweenTimeofdayAndTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -626,7 +627,8 @@ ruleLunch = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 14
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastCycle :: Rule
|
||||
@ -665,7 +667,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -828,7 +831,7 @@ ruleFromTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -876,7 +879,7 @@ ruleSeason = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 6 21
|
||||
to = monthDay 9 23
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleBetweenDatetimeAndDatetimeInterval :: Rule
|
||||
@ -890,7 +893,7 @@ ruleBetweenDatetimeAndDatetimeInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -925,7 +928,7 @@ ruleByTheEndOfTime = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:Token Time td:_) ->
|
||||
Just . Token Time $ interval True (cycleNth TG.Second 0, td)
|
||||
Just . Token Time $ interval TTime.Closed (cycleNth TG.Second 0, td)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -937,7 +940,7 @@ ruleAfterWork = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 17, hour False 21)
|
||||
td2 = interval TTime.Open (hour False 17, hour False 21)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -979,7 +982,7 @@ ruleWithinDuration = Rule
|
||||
(_:Token Duration dd:_) ->
|
||||
let from = cycleNth TG.Second 0
|
||||
to = inDuration dd
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -1113,7 +1116,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleEomendOfMonth :: Rule
|
||||
@ -1263,7 +1266,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleThisPartofday :: Rule
|
||||
@ -1326,7 +1330,7 @@ ruleAfterLunch = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 13, hour False 17)
|
||||
td2 = interval TTime.Open (hour False 13, hour False 17)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1373,7 +1377,7 @@ ruleSeason2 = Rule
|
||||
, prod = \_ ->
|
||||
let from = monthDay 12 21
|
||||
to = monthDay 3 20
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleAfterTimeofday :: Rule
|
||||
@ -1407,7 +1411,8 @@ ruleNight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 0
|
||||
to = hour False 4
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleDayofmonthOrdinal :: Rule
|
||||
@ -1492,7 +1497,7 @@ ruleTonight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1596,7 +1601,7 @@ ruleTimeofdayTimeofdayInterval = Rule
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token Time td1:_:Token Time td2:_) ->
|
||||
Just . Token Time $ interval True (td1, td2)
|
||||
Just . Token Time $ interval TTime.Closed (td1, td2)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
@ -365,7 +365,7 @@ runAMPMPredicate ampm = series
|
||||
anchorEnd = timePlus anchorStart TG.Hour 12
|
||||
-- an interval of length 12h starting either at 12am or 12pm,
|
||||
-- the same day as input time
|
||||
anchor = timeInterval False anchorStart anchorEnd
|
||||
anchor = timeInterval Open anchorStart anchorEnd
|
||||
|
||||
runDayOfTheWeekPredicate :: Int -> SeriesPredicate
|
||||
runDayOfTheWeekPredicate n = series
|
||||
@ -578,11 +578,17 @@ timeStartingAtTheEndOf :: TimeObject -> TimeObject
|
||||
timeStartingAtTheEndOf t = TimeObject
|
||||
{start = timeEnd t, end = Nothing, grain = grain t}
|
||||
|
||||
timeInterval :: Bool -> TimeObject -> TimeObject -> TimeObject
|
||||
timeInterval isOuter t1 t2 = TimeObject
|
||||
-- | Closed if the interval between A and B should include B
|
||||
-- Open if the interval should end right before B
|
||||
data TimeIntervalType = Open | Closed
|
||||
|
||||
timeInterval :: TimeIntervalType -> TimeObject -> TimeObject -> TimeObject
|
||||
timeInterval intervalType t1 t2 = TimeObject
|
||||
{ start = start t1
|
||||
, grain = min (grain t1) (grain t2)
|
||||
, end = Just $ if isOuter then timeEnd t2 else start t2
|
||||
, end = Just $ case intervalType of
|
||||
Open -> start t2
|
||||
Closed -> timeEnd t2
|
||||
}
|
||||
|
||||
timeStartsBeforeTheEndOf :: TimeObject -> TimeObject -> Bool
|
||||
|
@ -509,7 +509,8 @@ ruleAfternoon = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 12
|
||||
to = hour False 19
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedmonth4 :: Rule
|
||||
@ -712,7 +713,7 @@ ruleWeekend = Rule
|
||||
, prod = \_ ->
|
||||
let from = intersect (dayOfWeek 5, hour False 18)
|
||||
to = intersect (dayOfWeek 1, hour False 0)
|
||||
in Just . Token Time $ interval False (from, to)
|
||||
in Just . Token Time $ interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleLastYear :: Rule
|
||||
@ -789,7 +790,8 @@ ruleMorning = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 4
|
||||
to = hour False 12
|
||||
in Just . Token Time . mkLatent . partOfDay $ interval False (from, to)
|
||||
in Just . Token Time . mkLatent . partOfDay $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNextYear :: Rule
|
||||
@ -853,7 +855,7 @@ ruleLastNight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day $ - 1
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -958,7 +960,7 @@ ruleTonight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 0
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -970,7 +972,7 @@ ruleTomorrowNight = Rule
|
||||
]
|
||||
, prod = \_ ->
|
||||
let td1 = cycleNth TG.Day 1
|
||||
td2 = interval False (hour False 18, hour False 0)
|
||||
td2 = interval TTime.Open (hour False 18, hour False 0)
|
||||
in Just . Token Time . partOfDay $ intersect (td1, td2)
|
||||
}
|
||||
|
||||
@ -1040,7 +1042,8 @@ ruleEveningnight = Rule
|
||||
, prod = \_ ->
|
||||
let from = hour False 18
|
||||
to = hour False 0
|
||||
in Just . Token Time . partOfDay . mkLatent $ interval False (from, to)
|
||||
in Just . Token Time . partOfDay . mkLatent $
|
||||
interval TTime.Open (from, to)
|
||||
}
|
||||
|
||||
ruleNamedday3 :: Rule
|
||||
|
Loading…
Reference in New Issue
Block a user