mirror of
https://github.com/facebook/duckling.git
synced 2024-11-24 07:23:03 +03:00
Time/EN_US: Modify this|last|next <cycle>
Summary: We weren't capturing cases like "the first Saturday of the month", due to "the month" not being properly parsed. Reviewed By: haoxuany Differential Revision: D18193355 fbshipit-source-id: 2c4e83a3f22b0fe306ce7662ade85434a0016784
This commit is contained in:
parent
8dc4ca9289
commit
ba092881c5
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -744,6 +744,12 @@ allExamples = concat
|
||||
, examples (datetime (2012, 11, 12, 0, 0, 0) Day)
|
||||
[ "three months ago"
|
||||
]
|
||||
, examples (datetime (2013, 02, 04, 0, 0, 0) Day)
|
||||
[ "the first Monday of this month"
|
||||
, "the first Monday of the month"
|
||||
, "the first Monday in this month"
|
||||
, "first Monday in the month"
|
||||
]
|
||||
, examples (datetime (2011, 2, 1, 0, 0, 0) Month)
|
||||
[ "two years ago"
|
||||
]
|
||||
|
@ -1961,7 +1961,7 @@ ruleCycleThisLastNext :: Rule
|
||||
ruleCycleThisLastNext = Rule
|
||||
{ name = "this|last|next <cycle>"
|
||||
, pattern =
|
||||
[ regex "(this|current|coming|next|the following|last|past|previous)"
|
||||
[ regex "(this|current|coming|next|(the( following)?)|last|past|previous)"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
@ -1975,6 +1975,7 @@ ruleCycleThisLastNext = Rule
|
||||
"previous" -> tt . cycleNth grain $ - 1
|
||||
"next" -> tt $ cycleNth grain 1
|
||||
"the following" -> tt $ cycleNth grain 1
|
||||
"the" -> tt $ cycleNth grain 0
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ module Duckling.Time.Helpers
|
||||
, predNth, predNthAfter, predNthClosest, season, second, timeOfDayAMPM
|
||||
, weekday, weekend, workweek, withDirection, year, yearMonthDay, tt, durationIntervalAgo
|
||||
, inDurationInterval, intersectWithReplacement, yearADBC, yearMonth
|
||||
, predEveryNDaysFrom
|
||||
, predEveryNDaysFrom, timeCycle
|
||||
-- Other
|
||||
, getIntValue, timeComputed, toTimeObjectM
|
||||
-- Rule constructors
|
||||
|
Loading…
Reference in New Issue
Block a user