mirror of
https://github.com/facebook/duckling.git
synced 2024-12-01 08:19:36 +03:00
Refactored weekend rules to use the weekend helper for all languages
Summary: This is a simple refactor that uses the weekend helper for all languages Reviewed By: patapizza Differential Revision: D5677330 fbshipit-source-id: 9984539
This commit is contained in:
parent
004995b595
commit
4e96a15c15
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user