Time/EN: Allow latent match for <part-of-day> <latent-time-of-day>

Summary:
This fixes #592 in a very conservative way: the reason why `ruleIntersect` does
not detect "tonight 815" and "tonight eight fifteen" as it does "tonight 8:15"
is because it explicitly forbids the second part of the intersection from being
latent, unless it is a year.

I don't think it's a good idea to remove the restriction on latent inputs in
`ruleIntersect`, so instead I just made a new rule specifically for the
intersection of `<part-of-day> <time-of-day>`.

It also seems to me that there's a lot of room for this to be too aggressive,
for example if I say "tonight 500 people will laugh" the "tonight" and "500"
aren't really linked. So, I set the rule to be latent; this may be too conservative
to be useful though (do client libraries usually allow latent results?).

Reviewed By: chessai

Differential Revision: D27842596

fbshipit-source-id: 36ac59e31c632d4864241bce291147a46d52f780
This commit is contained in:
Steven Troxler 2021-04-19 13:02:54 -07:00 committed by Facebook GitHub Bot
parent f1cb3bc87c
commit 9bd4c9b7fb
16 changed files with 318 additions and 1433 deletions

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3432,6 +3432,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Labour Day weekend",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,

View File

@ -3376,6 +3376,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -3585,6 +3585,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

View File

@ -83,11 +83,11 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("integer (numeric)",
Classifier{okData =
ClassData{prior = -0.561051950755874, unseen = -6.212606095751519,
likelihoods = HashMap.fromList [("", 0.0)], n = 497},
ClassData{prior = -0.5613354788149494, unseen = -6.214608098422191,
likelihoods = HashMap.fromList [("", 0.0)], n = 498},
koData =
ClassData{prior = -0.8453861794379709, unseen = -5.929589143389895,
likelihoods = HashMap.fromList [("", 0.0)], n = 374}}),
ClassData{prior = -0.8450095298691914, unseen = -5.932245187448011,
likelihoods = HashMap.fromList [("", 0.0)], n = 375}}),
("<year> (bc|ad)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
@ -698,8 +698,8 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
("October",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.258096538021482,
likelihoods = HashMap.fromList [("", 0.0)], n = 24},
ClassData{prior = 0.0, unseen = -3.295836866004329,
likelihoods = HashMap.fromList [("", 0.0)], n = 25},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -997,7 +997,7 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.4884848944913853, unseen = -7.199678345691172,
ClassData{prior = -0.4896732487607639, unseen = -7.199678345691172,
likelihoods =
HashMap.fromList
[("Navaratriyear (latent)", -6.505784060128229),
@ -1281,185 +1281,185 @@ classifiers
("minuteyear", -6.505784060128229)],
n = 516},
koData =
ClassData{prior = -0.9507664776432105, unseen = -6.863803391452954,
ClassData{prior = -0.948882632875619, unseen = -6.8658910748834385,
likelihoods =
HashMap.fromList
[("Thursdayhhhmm", -4.665533335715182),
("hourday", -3.5669210470470722),
[("Thursdayhhhmm", -4.667623200634641),
("hourday", -3.5690109119665316),
("<hour-of-day> <integer><time-of-day> am|pm",
-6.169610732491456),
("<day-of-month> (ordinal)August", -6.169610732491456),
("dayhour", -3.428770708566255),
("<time> timezoneyear (latent)", -5.476463551931511),
-6.171700597410915),
("<day-of-month> (ordinal)August", -6.171700597410915),
("dayhour", -3.4308605734857145),
("<time> timezoneyear (latent)", -5.47855341685097),
("<time-of-day> - <time-of-day> (interval)on <day>",
-5.253320000617301),
("Tuesdayfrom|since|after <time>", -5.476463551931511),
("daymonth", -3.461560531389246),
("hourquarter", -5.253320000617301),
("monthyear", -4.916847763996088),
("<time-of-day> am|pmyear (latent)", -5.476463551931511),
("Thai Pongalyear (latent)", -5.476463551931511),
("intersecthh:mm", -6.169610732491456),
-5.25540986553676),
("Tuesdayfrom|since|after <time>", -5.47855341685097),
("daymonth", -3.4636503963087053),
("hourquarter", -5.25540986553676),
("monthyear", -4.785406236291025),
("<time-of-day> am|pmyear (latent)", -5.47855341685097),
("Thai Pongalyear (latent)", -5.47855341685097),
("intersecthh:mm", -6.171700597410915),
("from <datetime> - <datetime> (interval)July",
-5.764145624383292),
("<day-of-month> (ordinal)Wednesday", -6.169610732491456),
("houryear", -4.377851263263401),
-5.766235489302751),
("<day-of-month> (ordinal)Wednesday", -6.171700597410915),
("houryear", -4.37994112818286),
("from <time-of-day> - <time-of-day> (interval)July",
-6.169610732491456),
("<day-of-month> (ordinal)October", -6.169610732491456),
-6.171700597410915),
("<day-of-month> (ordinal)October", -6.171700597410915),
("<time-of-day> am|pmintersect by \",\", \"of\", \"from\", \"'s\"",
-5.476463551931511),
("hournograin", -4.916847763996088),
("<time-of-day> am|pmintersect", -4.916847763996088),
("Octoberyear (latent)", -6.169610732491456),
("Good Fridayyear (latent)", -5.764145624383292),
-5.47855341685097),
("hournograin", -4.918937628915547),
("<time-of-day> am|pmintersect", -4.918937628915547),
("Octoberyear (latent)", -5.766235489302751),
("Good Fridayyear (latent)", -5.766235489302751),
("time-of-day (latent)intersect by \",\", \"of\", \"from\", \"'s\"",
-5.764145624383292),
("early morningat <time-of-day>", -6.169610732491456),
("until <time>on <day>", -5.476463551931511),
-5.766235489302751),
("early morningat <time-of-day>", -6.171700597410915),
("until <time>on <day>", -5.47855341685097),
("part of days<time-of-day> - <time-of-day> (interval)",
-6.169610732491456),
("time-of-day (latent)intersect", -5.476463551931511),
("todayin <number> (implicit minutes)", -6.169610732491456),
-6.171700597410915),
("time-of-day (latent)intersect", -5.47855341685097),
("todayin <number> (implicit minutes)", -6.171700597410915),
("<named-month>|<named-day> <day-of-month> (ordinal)year (latent)",
-5.476463551931511),
-5.47855341685097),
("this <part-of-day><time-of-day> - <time-of-day> (interval)",
-6.169610732491456),
-6.171700597410915),
("about|exactly <time-of-day>year (latent)",
-6.169610732491456),
("hh:mmon <day>", -4.916847763996088),
("hhhmmintersect", -5.764145624383292),
("absorption of , after named dayJuly", -5.253320000617301),
("from|since|after <time>July", -5.764145624383292),
-6.171700597410915),
("hh:mmon <day>", -4.918937628915547),
("hhhmmintersect", -5.766235489302751),
("absorption of , after named dayJuly", -5.25540986553676),
("from|since|after <time>July", -5.766235489302751),
("intersect by \",\", \"of\", \"from\", \"'s\"year (latent)",
-5.253320000617301),
("Clean Mondayyear (latent)", -6.169610732491456),
("monthhour", -6.169610732491456),
-5.25540986553676),
("Clean Mondayyear (latent)", -6.171700597410915),
("monthhour", -6.171700597410915),
("<day-of-month> (ordinal)intersect by \",\", \"of\", \"from\", \"'s\"",
-5.764145624383292),
("hourmonth", -4.029544568995185),
("todayat <time-of-day>", -6.169610732491456),
("hhhmmyear (latent)", -4.916847763996088),
("from|since|after <time>December", -6.169610732491456),
-5.766235489302751),
("hourmonth", -4.031634433914644),
("todayat <time-of-day>", -6.171700597410915),
("hhhmmyear (latent)", -4.918937628915547),
("from|since|after <time>December", -6.171700597410915),
("from|since|after <time><time-of-day> am|pm",
-6.169610732491456),
("<time-of-day> am|pmon <day>", -4.916847763996088),
("Mondayyear (latent)", -5.476463551931511),
("dayday", -4.029544568995185),
("mm/ddat <time-of-day>", -5.253320000617301),
("on <day>September", -5.476463551931511),
("time-of-day (latent)September", -5.764145624383292),
("hourhour", -4.09016919081162),
("time-of-day (latent)on <day>", -4.665533335715182),
-6.171700597410915),
("<time-of-day> am|pmon <day>", -4.918937628915547),
("Mondayyear (latent)", -5.47855341685097),
("dayday", -4.031634433914644),
("mm/ddat <time-of-day>", -5.25540986553676),
("on <day>September", -5.47855341685097),
("time-of-day (latent)September", -5.766235489302751),
("hourhour", -4.09225905573108),
("time-of-day (latent)on <day>", -4.667623200634641),
("time-of-day (latent)<cycle> after|before <time>",
-5.764145624383292),
("dayyear", -3.125088294768033),
("Thursdaymm/dd", -6.169610732491456),
("New Year's Dayyear (latent)", -5.253320000617301),
("time-of-day (latent)Sunday", -5.764145624383292),
("Thursdayfrom|since|after <time>", -4.46486264025303),
("Thursdayat <time-of-day>", -4.560172820057356),
-5.766235489302751),
("dayyear", -3.1271781596874924),
("Thursdaymm/dd", -6.171700597410915),
("New Year's Dayyear (latent)", -5.25540986553676),
("time-of-day (latent)Sunday", -5.766235489302751),
("Thursdayfrom|since|after <time>", -4.46695250517249),
("Thursdayat <time-of-day>", -4.562262684976815),
("<integer> to|till|before <hour-of-day>September",
-6.169610732491456),
("Aprilyear (latent)", -6.169610732491456),
("the <day-of-month> (ordinal)July", -6.169610732491456),
("the <day-of-month> (number)July", -6.169610732491456),
("monthminute", -6.169610732491456),
("<time-of-day> am|pmtomorrow", -5.764145624383292),
("Thursdayhh:mm", -5.253320000617301),
("<day-of-month> (ordinal)Tuesday", -5.764145624383292),
("minutemonth", -4.029544568995185),
("time-of-day (latent)Friday", -5.764145624383292),
("minutehour", -6.169610732491456),
("part of daysat <time-of-day>", -5.070998443823346),
-6.171700597410915),
("Aprilyear (latent)", -6.171700597410915),
("the <day-of-month> (ordinal)July", -6.171700597410915),
("the <day-of-month> (number)July", -6.171700597410915),
("monthminute", -6.171700597410915),
("<time-of-day> am|pmtomorrow", -5.766235489302751),
("Thursdayhh:mm", -5.25540986553676),
("<day-of-month> (ordinal)Tuesday", -5.766235489302751),
("minutemonth", -4.031634433914644),
("time-of-day (latent)Friday", -5.766235489302751),
("minutehour", -6.171700597410915),
("part of daysat <time-of-day>", -5.073088308742806),
("time-of-day (latent)this|last|next <cycle>",
-3.8182354753279784),
("Augustyear (latent)", -5.764145624383292),
("week-endin|during <named-month>|year", -6.169610732491456),
("time-of-day (latent)Tuesday", -5.764145624383292),
-3.8203253402474373),
("Augustyear (latent)", -5.766235489302751),
("week-endin|during <named-month>|year", -6.171700597410915),
("time-of-day (latent)Tuesday", -5.766235489302751),
("mm/dd<time-of-day> - <time-of-day> (interval)",
-5.764145624383292),
-5.766235489302751),
("tomorrowfrom <time-of-day> - <time-of-day> (interval)",
-6.169610732491456),
-6.171700597410915),
("tonight<time-of-day> - <time-of-day> (interval)",
-6.169610732491456),
("Sundayyear (latent)", -5.253320000617301),
("hourweek", -5.253320000617301),
("the <day-of-month> (ordinal)Monday", -5.476463551931511),
("Christmasat <time-of-day>", -6.169610732491456),
("from|since|after <time>year (latent)", -5.070998443823346),
("hhhmmon <day>", -5.253320000617301),
("yesterday<time-of-day> am|pm", -6.169610732491456),
("<day-of-month> (ordinal)July", -5.476463551931511),
-6.171700597410915),
("Sundayyear (latent)", -5.25540986553676),
("hourweek", -5.25540986553676),
("the <day-of-month> (ordinal)Monday", -5.47855341685097),
("Christmasat <time-of-day>", -6.171700597410915),
("from|since|after <time>year (latent)", -5.073088308742806),
("hhhmmon <day>", -5.25540986553676),
("yesterday<time-of-day> am|pm", -6.171700597410915),
("<day-of-month> (ordinal)July", -5.47855341685097),
("intersect by \",\", \"of\", \"from\", \"'s\"hh:mm",
-6.169610732491456),
("mm/ddyear (latent)", -6.169610732491456),
-6.171700597410915),
("mm/ddyear (latent)", -6.171700597410915),
("Thursday<time-of-day> - <time-of-day> (interval)",
-6.169610732491456),
-6.171700597410915),
("in|during <named-month>|yearyear (latent)",
-6.169610732491456),
("at <time-of-day>intersect", -5.253320000617301),
("hh:mmyear (latent)", -4.783316371371566),
("Holiyear (latent)", -6.169610732491456),
("until <time><time-of-day> am|pm", -6.169610732491456),
-6.171700597410915),
("at <time-of-day>intersect", -5.25540986553676),
("hh:mmyear (latent)", -4.785406236291025),
("Holiyear (latent)", -6.171700597410915),
("until <time><time-of-day> am|pm", -6.171700597410915),
("at <time-of-day>intersect by \",\", \"of\", \"from\", \"'s\"",
-5.764145624383292),
("dayminute", -3.307409851561988),
("yyyy-mm-ddhh:mm", -5.764145624383292),
("intersectfrom|since|after <time>", -5.764145624383292),
("intersectSeptember", -4.297808555589865),
("minuteday", -3.0126103113413425),
-5.766235489302751),
("dayminute", -3.309499716481447),
("yyyy-mm-ddhh:mm", -5.766235489302751),
("intersectfrom|since|after <time>", -5.766235489302751),
("intersectSeptember", -4.299898420509324),
("minuteday", -3.014700176260802),
("absorption of , after named dayintersect",
-6.169610732491456),
("intersectyear (latent)", -6.169610732491456),
("Februaryin|during the <part-of-day>", -6.169610732491456),
-6.171700597410915),
("intersectyear (latent)", -6.171700597410915),
("Februaryin|during the <part-of-day>", -6.171700597410915),
("<duration> after|before|from|past <time>December",
-6.169610732491456),
("time-of-day (latent)July", -5.476463551931511),
("Saturdayyear (latent)", -6.169610732491456),
-6.171700597410915),
("time-of-day (latent)July", -5.47855341685097),
("Saturdayyear (latent)", -6.171700597410915),
("hhhmmintersect by \",\", \"of\", \"from\", \"'s\"",
-6.169610732491456),
("<day-of-month> (ordinal)Monday", -4.916847763996088),
("at <time-of-day>on <day>", -5.253320000617301),
-6.171700597410915),
("<day-of-month> (ordinal)Monday", -4.918937628915547),
("at <time-of-day>on <day>", -5.25540986553676),
("absorption of , after named daySeptember",
-4.916847763996088),
("Naraka Chaturdashiyear (latent)", -6.169610732491456),
("from|since|after <time>on <day>", -5.253320000617301),
("dayweek", -6.169610732491456),
("Easter Sundayyear (latent)", -5.764145624383292),
("Thursday<time-of-day> am|pm", -4.916847763996088),
("weekyear", -5.764145624383292),
("time-of-day (latent)Thursday", -5.764145624383292),
-4.918937628915547),
("Naraka Chaturdashiyear (latent)", -6.171700597410915),
("from|since|after <time>on <day>", -5.25540986553676),
("dayweek", -6.171700597410915),
("Easter Sundayyear (latent)", -5.766235489302751),
("Thursday<time-of-day> am|pm", -4.918937628915547),
("weekyear", -5.766235489302751),
("time-of-day (latent)Thursday", -5.766235489302751),
("<named-month> <day-of-month> (non ordinal)until <time>",
-6.169610732491456),
("<day-of-month> (ordinal)April", -6.169610732491456),
-6.171700597410915),
("<day-of-month> (ordinal)April", -6.171700597410915),
("yyyy-mm-dd<time-of-day> - <time-of-day> (interval)",
-5.764145624383292),
-5.766235489302751),
("intersect by \",\", \"of\", \"from\" for yearhh:mm",
-5.476463551931511),
("Sundayfrom|since|after <time>", -6.169610732491456),
("absorption of , after named dayFebruary", -5.253320000617301),
-5.47855341685097),
("Sundayfrom|since|after <time>", -6.171700597410915),
("absorption of , after named dayFebruary", -5.25540986553676),
("time-of-day (latent)in|during the <part-of-day>",
-5.764145624383292),
-5.766235489302751),
("July<integer> to|till|before <hour-of-day>",
-6.169610732491456),
("tomorrowat <time-of-day>", -6.169610732491456),
("daynograin", -5.764145624383292),
("Fridayin|during <named-month>|year", -6.169610732491456),
-6.171700597410915),
("tomorrowat <time-of-day>", -6.171700597410915),
("daynograin", -5.766235489302751),
("Fridayin|during <named-month>|year", -6.171700597410915),
("<integer> to|till|before <hour-of-day>July",
-5.764145624383292),
("last <cycle> of <time>year (latent)", -5.764145624383292),
("tomorrow<time-of-day> am|pm", -6.169610732491456),
-5.766235489302751),
("last <cycle> of <time>year (latent)", -5.766235489302751),
("tomorrow<time-of-day> am|pm", -6.171700597410915),
("<named-month> <day-of-month> (non ordinal)year (latent)",
-5.476463551931511),
("Diwaliyear (latent)", -5.764145624383292),
-5.47855341685097),
("Diwaliyear (latent)", -5.766235489302751),
("<time-of-day> - <time-of-day> (interval)July",
-6.169610732491456),
("this <part-of-day>at <time-of-day>", -5.253320000617301),
("Fridayyear (latent)", -5.253320000617301),
("time-of-day (latent)April", -6.169610732491456),
("minuteyear", -3.9723861551552364)],
n = 325}}),
-6.171700597410915),
("this <part-of-day>at <time-of-day>", -5.25540986553676),
("Fridayyear (latent)", -5.25540986553676),
("time-of-day (latent)April", -6.171700597410915),
("minuteyear", -3.974476020074696)],
n = 326}}),
("one eleven",
Classifier{okData =
ClassData{prior = -1.3862943611198906,
@ -1752,7 +1752,7 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("year (latent)",
Classifier{okData =
ClassData{prior = -0.14701474296180966,
ClassData{prior = -0.15091338337746693,
unseen = -5.420534999272286,
likelihoods =
HashMap.fromList
@ -1760,14 +1760,13 @@ classifiers
("intersect 2 numbers", -4.029806041084529)],
n = 221},
koData =
ClassData{prior = -1.9898293829901488,
unseen = -3.6888794541139363,
ClassData{prior = -1.9655571464391097, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("integer (numeric)", -1.5841201044498106),
("negative numbers", -0.40546510810816444),
("compose by multiplication", -2.277267285009756)],
n = 35}}),
[("integer (numeric)", -1.6094379124341003),
("negative numbers", -0.3930425881096072),
("compose by multiplication", -2.3025850929940455)],
n = 36}}),
("mm/dd/yyyy",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
@ -3347,15 +3346,16 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.0794415416798357,
ClassData{prior = 0.0, unseen = -2.5649493574615367,
likelihoods =
HashMap.fromList
[("ordinal (digits)October", -1.252762968495368),
("month", -0.8472978603872037),
("integer (numeric)October", -1.252762968495368)],
n = 2},
[("ordinal (digits)October", -1.791759469228055),
("ordinal (digits)April", -1.791759469228055),
("month", -0.8754687373538999),
("integer (numeric)October", -1.3862943611198906)],
n = 4},
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
ClassData{prior = -infinity, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
@ -3456,12 +3456,12 @@ classifiers
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -3.8066624897703196,
ClassData{prior = 0.0, unseen = -3.828641396489095,
likelihoods =
HashMap.fromList
[("integer (numeric)", -4.652001563489282e-2),
("integer (0..19)", -3.0910424533583156)],
n = 42}}),
[("integer (numeric)", -4.546237407675729e-2),
("integer (0..19)", -3.1135153092103742)],
n = 43}}),
("about|exactly <duration>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,

View File

@ -3307,6 +3307,17 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("<day-of-month>(ordinal or number)/<named-month>/year",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinal (digits)April", -0.6931471805599453),
("month", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Naraka Chaturdashi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,

File diff suppressed because it is too large Load Diff

View File

@ -166,6 +166,9 @@ latentCorpus = (testContext, testOptions {withLatent = True}, xs)
, examples (datetimeInterval ((1960, 1, 1, 0, 0, 0), (1962, 1, 1, 0, 0, 0)) Year)
[ "1960 - 1961"
]
, examples (datetime (2013, 2, 12, 20, 15, 0) Minute)
[ "tonight 815"
]
]
diffContext :: Context

View File

@ -624,6 +624,21 @@ rulePODatTOD = Rule
}
rulePODintersectTODlatent :: Rule
rulePODintersectTODlatent = Rule
{ name = "<part-of-day> <latent-time-of-day> (latent)"
, pattern =
[ Predicate isAPartOfDay
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
(Token Time td1:Token Time td2:_)
| not (TTime.latent td1) || TTime.latent td2 ->
Token Time . mkLatent <$> intersect td1 td2
_ -> Nothing
}
ruleHHMM :: Rule
ruleHHMM = Rule
{ name = "hh:mm"
@ -2705,6 +2720,7 @@ rules =
, ruleAtTOD
, ruleTODOClock
, rulePODatTOD
, rulePODintersectTODlatent
, ruleHHMM
, ruleHHhMM
, ruleHHMMLatent