diff --git a/Duckling/Time/DA/Rules.hs b/Duckling/Time/DA/Rules.hs index fb5bb8c7..8efa4797 100644 --- a/Duckling/Time/DA/Rules.hs +++ b/Duckling/Time/DA/Rules.hs @@ -1145,10 +1145,7 @@ ruleWeekend = Rule , pattern = [ regex "(week(\\s|-)?end)(en)?" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleAboutDuration :: Rule diff --git a/Duckling/Time/DE/Rules.hs b/Duckling/Time/DE/Rules.hs index 1f3bfedf..93261418 100644 --- a/Duckling/Time/DE/Rules.hs +++ b/Duckling/Time/DE/Rules.hs @@ -1173,10 +1173,7 @@ ruleWeekend = Rule , pattern = [ regex "wochen ?ende?" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleTagDerDeutschenEinheit :: Rule diff --git a/Duckling/Time/ES/Rules.hs b/Duckling/Time/ES/Rules.hs index fefdc89c..6d49e1b3 100644 --- a/Duckling/Time/ES/Rules.hs +++ b/Duckling/Time/ES/Rules.hs @@ -892,10 +892,7 @@ ruleWeekend = Rule , pattern = [ regex "week[ -]?end|fin de semana" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleOrdinalQuarterYear :: Rule diff --git a/Duckling/Time/FR/Rules.hs b/Duckling/Time/FR/Rules.hs index ac3d2569..89ca46fc 100644 --- a/Duckling/Time/FR/Rules.hs +++ b/Duckling/Time/FR/Rules.hs @@ -622,9 +622,7 @@ ruleOrdinalWeekendDeTime = Rule , prod = \tokens -> case tokens of (token:_:Token Time td:_) -> do n <- getIntValue token - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - td2 <- intersect td =<< interval TTime.Open from to + td2 <- intersect td weekend tt $ predNth (n - 1) False td2 _ -> Nothing } @@ -1283,10 +1281,7 @@ ruleWeekend = Rule , pattern = [ regex "week(\\s|-)?end" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleCedansLeCycle :: Rule @@ -1352,10 +1347,7 @@ ruleDernierWeekendDeTime = Rule ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - td2 <- interval TTime.Open from to - tt $ predLastOf td2 td + tt $ predLastOf weekend td _ -> Nothing } diff --git a/Duckling/Time/HE/Rules.hs b/Duckling/Time/HE/Rules.hs index 37d8d176..97947ef8 100644 --- a/Duckling/Time/HE/Rules.hs +++ b/Duckling/Time/HE/Rules.hs @@ -896,10 +896,7 @@ ruleWeekend = Rule , pattern = [ regex "(\x05e1\x05d5\x05e4\x05f4\x05e9|\x05e1\x05d5\x05e3 \x05d4\x05e9\x05d1\x05d5\x05e2)" ] - , prod = \_ -> do - fri <- intersect (dayOfWeek 5) (hour False 18) - mon <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open fri mon + , prod = \_ -> tt weekend } ruleNameddayDayofmonthOrdinal :: Rule diff --git a/Duckling/Time/HR/Rules.hs b/Duckling/Time/HR/Rules.hs index c54fd4d9..8fe45d9a 100644 --- a/Duckling/Time/HR/Rules.hs +++ b/Duckling/Time/HR/Rules.hs @@ -1058,10 +1058,7 @@ ruleWeekend = Rule , pattern = [ regex "(za )?vikenda?" ] - , prod = \_ -> do - fri <- intersect (dayOfWeek 5) (hour False 18) - mon <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open fri mon + , prod = \_ -> tt weekend } rulePrijeDuration :: Rule diff --git a/Duckling/Time/IT/Rules.hs b/Duckling/Time/IT/Rules.hs index 62ea0de5..0673d52c 100644 --- a/Duckling/Time/IT/Rules.hs +++ b/Duckling/Time/IT/Rules.hs @@ -1637,10 +1637,7 @@ ruleWeekend = Rule , pattern = [ regex "week[ -]?end|fine ?settimana|we" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleIlWeekendDelTime :: Rule diff --git a/Duckling/Time/KO/Rules.hs b/Duckling/Time/KO/Rules.hs index 7d4c261e..0e232af7 100644 --- a/Duckling/Time/KO/Rules.hs +++ b/Duckling/Time/KO/Rules.hs @@ -751,10 +751,7 @@ ruleWeekend = Rule , pattern = [ regex "\xc8fc\xb9d0" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleTimeDayofweek :: Rule diff --git a/Duckling/Time/NB/Rules.hs b/Duckling/Time/NB/Rules.hs index 6d4de6a1..4dfa68a7 100644 --- a/Duckling/Time/NB/Rules.hs +++ b/Duckling/Time/NB/Rules.hs @@ -1125,10 +1125,7 @@ ruleWeekend = Rule , pattern = [ regex "((week(\\s|-)?end)|helg)(en|a)?" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleEomendOfMonth :: Rule diff --git a/Duckling/Time/PL/Rules.hs b/Duckling/Time/PL/Rules.hs index f931f2b4..b03ff5b2 100644 --- a/Duckling/Time/PL/Rules.hs +++ b/Duckling/Time/PL/Rules.hs @@ -1072,10 +1072,7 @@ ruleWeekend = Rule , pattern = [ regex "((wek|week|wik)(\\s|-)?end|wkend)" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleEomendOfMonth :: Rule diff --git a/Duckling/Time/PT/Rules.hs b/Duckling/Time/PT/Rules.hs index a71aba57..23d42a7d 100644 --- a/Duckling/Time/PT/Rules.hs +++ b/Duckling/Time/PT/Rules.hs @@ -1017,10 +1017,7 @@ ruleWeekend = Rule , pattern = [ regex "final de semana|fim de semana|fds" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleDayofweekSHourmin :: Rule diff --git a/Duckling/Time/RO/Rules.hs b/Duckling/Time/RO/Rules.hs index c1049e9a..ba1f5a2f 100644 --- a/Duckling/Time/RO/Rules.hs +++ b/Duckling/Time/RO/Rules.hs @@ -693,10 +693,7 @@ ruleWeekend = Rule , pattern = [ regex "(week(\\s|\\-)?end|wkend)" ] - , prod = \_ -> do - fri <- intersect (dayOfWeek 5) (hour False 18) - mon <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open fri mon + , prod = \_ -> tt weekend } rulePeDayofmonthNonOrdinal :: Rule diff --git a/Duckling/Time/SV/Rules.hs b/Duckling/Time/SV/Rules.hs index 6959c93b..a651ce14 100644 --- a/Duckling/Time/SV/Rules.hs +++ b/Duckling/Time/SV/Rules.hs @@ -1113,10 +1113,7 @@ ruleWeekend = Rule , pattern = [ regex "((week(\\s|-)?end)|helg)(en)?" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleEomendOfMonth :: Rule diff --git a/Duckling/Time/VI/Rules.hs b/Duckling/Time/VI/Rules.hs index 3affdd23..61f78496 100644 --- a/Duckling/Time/VI/Rules.hs +++ b/Duckling/Time/VI/Rules.hs @@ -690,10 +690,7 @@ ruleWeekend = Rule , pattern = [ regex "(cu(\x1ed1)i|h(\x1ebf)t) tu(\x1ea7)n" ] - , prod = \_ -> do - fri <- intersect (dayOfWeek 5) (hour False 18) - mon <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open fri mon + , prod = \_ -> tt weekend } ruleTimeofdaySngchiuti :: Rule diff --git a/Duckling/Time/ZH/Rules.hs b/Duckling/Time/ZH/Rules.hs index 25a0703d..177244ce 100644 --- a/Duckling/Time/ZH/Rules.hs +++ b/Duckling/Time/ZH/Rules.hs @@ -725,10 +725,7 @@ ruleWeekend = Rule , pattern = [ regex "\x5468\x672b|\x9031\x672b" ] - , prod = \_ -> do - from <- intersect (dayOfWeek 5) (hour False 18) - to <- intersect (dayOfWeek 1) (hour False 0) - Token Time <$> interval TTime.Open from to + , prod = \_ -> tt weekend } ruleLastYear :: Rule