adds support for during month and regenerates classifiers (#208)

Summary:
Adds support for catching `during <month>`.

Wasn't sure whether or not to commit the classifiers, let me know if I got this right :)

Thanks!
Closes https://github.com/facebook/duckling/pull/208

Reviewed By: chinmay87

Differential Revision: D8427153

Pulled By: patapizza

fbshipit-source-id: 72c9567939cd0eeab62870e48d6e084cfe290bf1
This commit is contained in:
Lucas Pasqualin 2018-06-14 12:46:49 -07:00 committed by Facebook Github Bot
parent 5ab49060e1
commit 7d469a2f85
16 changed files with 135 additions and 147 deletions

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2502,8 +2502,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2702,18 +2702,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2445,8 +2445,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2635,18 +2635,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2522,8 +2522,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2743,18 +2743,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2410,8 +2410,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2600,18 +2600,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -2385,8 +2385,8 @@ classifiers
n = 7}}),
("March",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2566,18 +2566,17 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("in <named-month>|year",
Classifier{okData =
ClassData{prior = -0.2719337154836418,
unseen = -3.6635616461296463,
ClassData{prior = -0.2578291093020998, unseen = -3.713572066704308,
likelihoods =
HashMap.fromList
[("<year> (bc|ad)", -1.845826690498331),
("October", -2.9444389791664407),
("year (latent)", -1.3350010667323402),
("year", -0.9295359586241757), ("March", -2.9444389791664407),
("month", -2.538973871058276)],
n = 16},
[("<year> (bc|ad)", -1.8971199848858813),
("October", -2.995732273553991),
("year (latent)", -1.3862943611198906),
("year", -0.9808292530117262), ("March", -2.5902671654458267),
("month", -2.3025850929940455)],
n = 17},
koData =
ClassData{prior = -1.4350845252893227, unseen = -2.833213344056216,
ClassData{prior = -1.4816045409242156, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("October", -1.6739764335716716),

View File

@ -320,10 +320,10 @@ classifiers
unseen = -4.31748811353631,
likelihoods =
HashMap.fromList
[("<integer> (latent time-of-day)", -0.9718605830289658),
[("<integer> (latent time-of-day)", -0.9718605830289657),
("intersect by \"di\", \"della\", \"del\"", -3.20545280453606),
("day", -2.3581549441488563), ("Lunedi", -3.6109179126442243),
("hour", -0.9718605830289658),
("hour", -0.9718605830289657),
("two time tokens separated by `di`", -3.20545280453606),
("Domenica", -3.6109179126442243)],
n = 33}}),

View File

@ -1103,6 +1103,7 @@ allExamples = concat
, examples (datetime (2013, 3, 1, 0, 0, 0) Month)
[ "March"
, "in March"
, "during March"
]
, examples (datetime (2013, 2, 13, 17, 0, 0) Hour)
[ "tomorrow afternoon at 5"

View File

@ -105,9 +105,9 @@ ruleAbsorbOnADOW = Rule
ruleAbsorbInMonthYear :: Rule
ruleAbsorbInMonthYear = Rule
{ name = "in <named-month>|year"
{ name = "in|during <named-month>|year"
, pattern =
[ regex "in"
[ regex "in|during"
, Predicate $ or . sequence [isAMonth, isGrainOfTime TG.Year]
]
, prod = \tokens -> case tokens of