mirror of
https://github.com/facebook/duckling.git
synced 2025-01-06 04:53:13 +03:00
78904b6680
Summary: The pattern laied out in the bug report https://github.com/facebook/duckling/issues/444 is actually already handled by the pattern `<day-of-month>(ordinal or number)/<named-month>/year`. The problem is purely that the regular expression doesn't match 2-digit years, so the pattern is getting skipped rather than evaluated. This diff fixes the regexp and adds a new example with a 2-digit pattern. This fixes the bug report: ``` > debug (makeLocale EN Nothing) "10-Apr-15" [Seal Time] <day-of-month>(ordinal or number)/<named-month>/year (10-Apr-15) -- integer (numeric) (10) -- -- regex (10) -- regex (-) -- April (Apr) -- -- regex (Apr) -- regex (-) -- regex (15) [Entity {dim = "time", body = "10-Apr-15", value = RVal Time (TimeValue (SimpleValue (InstantValue {vValue = 2015-04-10 00:00:00 -0200, vGrain = Day})) [SimpleValue (InstantValue {vValue = 2015-04-10 00:00:00 -0200, vGrain = Day})] Nothing), start = 0, end = 9, latent = False, enode = Node {nodeRange = Range 0 9, token = Token Time TimeData{latent=False, grain=Day, form=Nothing, direction=Nothing, holiday=Nothing, hasTimezone=False}, children = [Node {nodeRange = Range 0 2, token = Token Numeral (NumeralData {value = 10.0, grain = Nothing, multipliable = False, okForAnyTime = True}), children = [Node {nodeRange = Range 0 2, token = Token RegexMatch (GroupMatch ["10"]), children = [], rule = Nothing}], rule = Just "integer (numeric)"},Node {nodeRange = Range 2 3, token = Token RegexMatch (GroupMatch []), children = [], rule = Nothing},Node {nodeRange = Range 3 6, token = Token Time TimeData{latent=False, grain=Month, form=Just (Month {month = 4}), direction=Nothing, holiday=Nothing, hasTimezone=False}, children = [Node {nodeRange = Range 3 6, token = Token RegexMatch (GroupMatch []), children = [], rule = Nothing}], rule = Just "April"},Node {nodeRange = Range 6 7, token = Token RegexMatch (GroupMatch []), children = [], rule = Nothing},Node {nodeRange = Range 7 9, token = Token RegexMatch (GroupMatch ["15"]), children = [], rule = Nothing}], rule = Just "<day-of-month>(ordinal or number)/<named-month>/year"}}] ``` Reviewed By: chessai Differential Revision: D27106007 fbshipit-source-id: 4751672aef807464febef87f6d22d7270bd335df |
||
---|---|---|
.. | ||
AR | ||
BG | ||
DA | ||
DE | ||
EL | ||
EN | ||
ES | ||
FR | ||
GA | ||
HE | ||
HR | ||
HU | ||
IT | ||
KA | ||
KO | ||
NB | ||
NL | ||
PL | ||
PT | ||
RO | ||
RU | ||
SV | ||
TimeZone | ||
UK | ||
VI | ||
ZH | ||
Computed.hs | ||
Corpus.hs | ||
Helpers.hs | ||
HolidayHelpers.hs | ||
Types.hs |