mirror of
https://github.com/facebook/duckling.git
synced 2024-08-17 17:20:55 +03:00
s/ptn/pattern
Summary: I don't think abbreviating pattern to ptn is a win, the abbreviation isn't good enough to be unambiguous (I found this because I was trying to figure out what "ptn" meant), and `pattern` isn't that long a name. Reviewed By: chessai Differential Revision: D28462776 fbshipit-source-id: bd685720b198fed791d84c00732eb1873b37528b
This commit is contained in:
parent
dbc5c91263
commit
3d2f1939ef
@ -714,14 +714,14 @@ mkSingleRegexRule name pattern token = Types.Rule
|
||||
mkRuleInstants :: [(Text, TG.Grain, Int, String)] -> [Rule]
|
||||
mkRuleInstants = map go
|
||||
where
|
||||
go (name, grain, n, ptn) = mkSingleRegexRule name ptn $ tt $
|
||||
go (name, grain, n, pattern) = mkSingleRegexRule name pattern $ tt $
|
||||
cycleNth grain n
|
||||
|
||||
mkRuleDaysOfWeek :: [(Text, String)] -> [Rule]
|
||||
mkRuleDaysOfWeek daysOfWeek = zipWith go daysOfWeek [1..7]
|
||||
where
|
||||
go (name, ptn) i =
|
||||
mkSingleRegexRule name ptn $ tt $ mkOkForThisNext $ dayOfWeek i
|
||||
go (name, pattern) i =
|
||||
mkSingleRegexRule name pattern $ tt $ mkOkForThisNext $ dayOfWeek i
|
||||
|
||||
mkRuleMonths :: [(Text, String)] -> [Rule]
|
||||
mkRuleMonths = mkRuleMonthsWithLatent . map (uncurry (,, False))
|
||||
@ -729,25 +729,25 @@ mkRuleMonths = mkRuleMonthsWithLatent . map (uncurry (,, False))
|
||||
mkRuleMonthsWithLatent :: [(Text, String, Bool)] -> [Rule]
|
||||
mkRuleMonthsWithLatent months = zipWith go months [1..12]
|
||||
where
|
||||
go (name, ptn, latent) i =
|
||||
mkSingleRegexRule name ptn $ tt $ (if latent then mkLatent else id)
|
||||
go (name, pattern, latent) i =
|
||||
mkSingleRegexRule name pattern $ tt $ (if latent then mkLatent else id)
|
||||
$ mkOkForThisNext $ month i
|
||||
|
||||
mkRuleSeasons :: [(Text, String, TimeData, TimeData)] -> [Rule]
|
||||
mkRuleSeasons = map go
|
||||
where
|
||||
go (name, ptn, start, end) = mkSingleRegexRule name ptn $
|
||||
go (name, pattern, start, end) = mkSingleRegexRule name pattern $
|
||||
Token Time <$> mkOkForThisNext <$> interval TTime.Open start end
|
||||
|
||||
mkRuleHolidays :: [(Text, String, TimeData)] -> [Rule]
|
||||
mkRuleHolidays = map go
|
||||
where
|
||||
go (name, ptn, td) = mkSingleRegexRule name ptn $ tt
|
||||
go (name, pattern, td) = mkSingleRegexRule name pattern $ tt
|
||||
$ withHoliday name $ mkOkForThisNext td
|
||||
|
||||
mkRuleHolidays' :: [(Text, String, Maybe TimeData)] -> [Rule]
|
||||
mkRuleHolidays' = map go
|
||||
where
|
||||
go (name, ptn, maybeTimeData) = mkSingleRegexRule name ptn $ do
|
||||
go (name, pattern, maybeTimeData) = mkSingleRegexRule name pattern $ do
|
||||
timeData <- maybeTimeData
|
||||
tt $ withHoliday name $ mkOkForThisNext timeData
|
||||
|
Loading…
Reference in New Issue
Block a user