mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 21:27:13 +03:00
Tweak the rule for parsing "tomorrow" in ES
Summary: There are two rules for parsing "manana" (dimension: Time): one is resolved to "morning"; while the other is resolved to "tomorrow". And the first (or "morning") rule resolves to a LATENT result; while the second (or "tomorrow") rule resolves to a NON-LATENT result. If the duckling is called with "latent" option turned off, the "tomorrow" rule prevails. However, if the duckling is invoked with "latent" option turned on, the "morning" rule is preferred. The solution (for now) is to steer the classifier towards "tomorrow" rule by adding large number of (same) examples for "tomorrow" rule. Reviewed By: chinmay87 Differential Revision: D22425277 fbshipit-source-id: 2f139eec0c38b9b5227f27d9f09f6264e7cf86cd
This commit is contained in:
parent
82e976b77d
commit
9c1ab0de69
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -201,8 +201,8 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("semana (grain)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.890371757896165,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 16},
|
||||
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}}),
|
||||
@ -728,11 +728,10 @@ classifiers
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("tomorrow",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -1.0116009116784799, unseen = -1.791759469228055,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||
ClassData{prior = -0.12188981760903689, unseen = -4.02535169073515,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 54},
|
||||
koData =
|
||||
ClassData{prior = -0.45198512374305727,
|
||||
unseen = -2.1972245773362196,
|
||||
ClassData{prior = -2.164963715117998, unseen = -2.1972245773362196,
|
||||
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
|
||||
("mes (grain)",
|
||||
Classifier{okData =
|
||||
@ -1236,6 +1235,22 @@ classifiers
|
||||
koData =
|
||||
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||
likelihoods = HashMap.fromList [], n = 0}}),
|
||||
("next week (alt)",
|
||||
Classifier{okData =
|
||||
ClassData{prior = -0.3364722366212129,
|
||||
unseen = -2.5649493574615367,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 5},
|
||||
koData =
|
||||
ClassData{prior = -1.252762968495368, unseen = -1.9459101490553135,
|
||||
likelihoods =
|
||||
HashMap.fromList
|
||||
[("week", -0.6931471805599453),
|
||||
("semana (grain)", -0.6931471805599453)],
|
||||
n = 2}}),
|
||||
("Marzo",
|
||||
Classifier{okData =
|
||||
ClassData{prior = 0.0, unseen = -2.3025850929940455,
|
||||
|
@ -20,7 +20,6 @@ import Duckling.Resolve
|
||||
import Duckling.Time.Corpus
|
||||
import Duckling.TimeGrain.Types hiding (add)
|
||||
import Duckling.Testing.Types hiding (examples)
|
||||
import Duckling.Time.Types hiding (Month)
|
||||
|
||||
context :: Context
|
||||
context = testContext {locale = makeLocale ES Nothing}
|
||||
@ -56,8 +55,63 @@ allExamples = concat
|
||||
[ "anteayer"
|
||||
, "antier"
|
||||
]
|
||||
{--
|
||||
This is intentional
|
||||
The purpose is to steer the classifier towards "tomorrow" rule
|
||||
instead of "morning" rule.
|
||||
--}
|
||||
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
|
||||
[ "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
, "mañana"
|
||||
, "manana"
|
||||
]
|
||||
, examples (datetime (2013, 2, 14, 0, 0, 0) Day)
|
||||
[ "pasado mañana"
|
||||
|
Loading…
Reference in New Issue
Block a user