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:
Kai Jun Weng 2019-10-31 12:33:46 -07:00 committed by Facebook Github Bot
parent ba092881c5
commit fa5d74ed34
15 changed files with 6993 additions and 7106 deletions

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

View File

@ -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"

View File

@ -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
}