mirror of
https://github.com/facebook/duckling.git
synced 2025-01-08 15:00:59 +03:00
Time/EN: Support 'the <day-of-month > of <month>'
Summary: We weren't capturing cases like "the second of february" as it was matching with the "the <cycle> of <time>" rule Differential Revision: D18249651 fbshipit-source-id: 09e214f585b96d07af4d5043de61445f4e156c54
This commit is contained in:
parent
ba092881c5
commit
fa5d74ed34
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
@ -236,10 +236,17 @@ allExamples = concat
|
||||
, examples (datetime (2013, 3, 1, 0, 0, 0) Day)
|
||||
[ "the 1st of march"
|
||||
, "first of march"
|
||||
, "the first of march"
|
||||
, "march first"
|
||||
]
|
||||
, examples (datetime (2013, 3, 2, 0, 0, 0) Day)
|
||||
[ "the 2nd of march"
|
||||
, "second of march"
|
||||
, "the second of march"
|
||||
]
|
||||
, examples (datetime (2013, 3, 3, 0, 0, 0) Day)
|
||||
[ "march 3"
|
||||
, "the third of march"
|
||||
]
|
||||
, examples (datetime (2013, 3, 15, 0, 0, 0) Day)
|
||||
[ "the ides of march"
|
||||
|
@ -434,12 +434,13 @@ ruleDOMOfMonth :: Rule
|
||||
ruleDOMOfMonth = Rule
|
||||
{ name = "<day-of-month> (ordinal or number) of <named-month>"
|
||||
, pattern =
|
||||
[ Predicate isDOMValue
|
||||
[ regex "(the)?"
|
||||
, Predicate isDOMValue
|
||||
, regex "of|in"
|
||||
, Predicate isAMonth
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
|
||||
(_:token:_:Token Time td:_) -> Token Time <$> intersectDOM td token
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user