mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 21:27:13 +03:00
Updated the rule to parse ordinal day of month in ES (#495)
Summary: the rule is updated to conform with natural expression of "ordinal day of month". Pull Request resolved: https://github.com/facebook/duckling/pull/495 Differential Revision: D22054297 Pulled By: yuanbing fbshipit-source-id: d9d8e00311d4d3121685ab5b09f6c1f52f3077c9
This commit is contained in:
parent
195a9d7aa1
commit
dddb4adf23
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -195,13 +195,6 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -2.5649493574615367,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 1},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
@ -580,6 +573,13 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("dia <day-of-month> (non ordinal)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||
likelihoods = HashMap.fromList [("number (0..15)", 0.0)], n = 3},
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("el <time>",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -2.6668247082161294e-2,
|
||||
@ -648,11 +648,11 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("number (0..15)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -7.020425867324857e-2,
|
||||
unseen = -4.04305126783455,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 55},
|
||||
ClassData{prior = -6.782259633876106e-2,
|
||||
unseen = -4.07753744390572,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 57},
|
||||
koData =
|
||||
ClassData{prior = -2.691243082785829, unseen = -1.791759469228055,
|
||||
ClassData{prior = -2.7245795030534206, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||
("D\237a Internacional de las Cooperativas",
|
||||
Classifier{okData =
|
||||
|
@ -454,7 +454,13 @@ allExamples = concat
|
||||
, "día de las bromas"
|
||||
]
|
||||
, examples (datetime (2013, 3, 9, 0, 0, 0) Day)
|
||||
[ "el día nueve"
|
||||
[ "día nueve"
|
||||
]
|
||||
, examples (datetime (2013, 2, 15, 0, 0, 0) Day)
|
||||
[ "día quince"
|
||||
]
|
||||
, examples (datetime (2013, 3, 11, 0, 0, 0) Day)
|
||||
[ "día once"
|
||||
]
|
||||
, examples (datetime (2013, 2, 12, 18, 2, 0) Minute)
|
||||
[
|
||||
|
@ -1482,14 +1482,13 @@ rulePeriodicHolidays = mkRuleHolidays
|
||||
|
||||
ruleElDayofmonthNonOrdinalWithDia :: Rule
|
||||
ruleElDayofmonthNonOrdinalWithDia = Rule
|
||||
{ name = "el dia <day-of-month> (non ordinal)"
|
||||
{ name = "dia <day-of-month> (non ordinal)"
|
||||
, pattern =
|
||||
[ regex "el"
|
||||
, regex "día"
|
||||
[ regex "día"
|
||||
, Predicate $ isIntegerBetween 1 31
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(_:_:token:_) -> do
|
||||
(_:token:_) -> do
|
||||
v <- getIntValue token
|
||||
tt $ dayOfMonth v
|
||||
_ -> Nothing
|
||||
|
Loading…
Reference in New Issue
Block a user