mirror of
https://github.com/facebook/duckling.git
synced 2024-11-24 07:23:03 +03:00
Add Time dimension for language BG
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/403 Reviewed By: haoxuany Differential Revision: D18348752 Pulled By: patapizza fbshipit-source-id: ce3b5c76cb2cf39114216842529d4eaa8df5b93f
This commit is contained in:
parent
8d681f7ec7
commit
cff1ca0080
@ -17,4 +17,5 @@ allDimensions =
|
|||||||
, This Duration
|
, This Duration
|
||||||
, This Numeral
|
, This Numeral
|
||||||
, This Ordinal
|
, This Ordinal
|
||||||
|
, This Time
|
||||||
]
|
]
|
||||||
|
@ -19,4 +19,640 @@ import qualified Data.HashMap.Strict as HashMap
|
|||||||
import Duckling.Ranking.Types
|
import Duckling.Ranking.Types
|
||||||
|
|
||||||
classifiers :: Classifiers
|
classifiers :: Classifiers
|
||||||
classifiers = HashMap.fromList []
|
classifiers
|
||||||
|
= HashMap.fromList
|
||||||
|
[("Thursday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("integer (numeric)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.7308875085427924, unseen = -2.70805020110221,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 13},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.6567795363890705, unseen = -2.772588722239781,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 14}}),
|
||||||
|
("noon|midnight|EOD|end of day",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
|
||||||
|
("from|since|after <time>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.791759469228055,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -2.772588722239781,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("noon|midnight|EOD|end of day", -2.0149030205422647),
|
||||||
|
("day", -1.6094379124341003),
|
||||||
|
("the <day-of-month> (number)", -1.6094379124341003),
|
||||||
|
("time-of-day (latent)", -1.6094379124341003),
|
||||||
|
("hour", -1.3217558399823195)],
|
||||||
|
n = 5}}),
|
||||||
|
("<day-of-month> (ordinal or number) <named-month>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -2.833213344056216,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("ordinals (first..19th)March", -2.0794415416798357),
|
||||||
|
("integer (numeric)April", -2.0794415416798357),
|
||||||
|
("integer (numeric)August", -2.0794415416798357),
|
||||||
|
("integer (numeric)February", -2.0794415416798357),
|
||||||
|
("month", -0.9808292530117262),
|
||||||
|
("integer (numeric)March", -2.0794415416798357)],
|
||||||
|
n = 5},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.9459101490553135,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<time> <part-of-day>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -1.0986122886681098,
|
||||||
|
unseen = -2.3025850929940455,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("hourhour", -1.0986122886681098),
|
||||||
|
("at <time-of-day>part of days", -1.5040773967762742),
|
||||||
|
("time-of-day (latent)part of days", -1.5040773967762742)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.40546510810816444,
|
||||||
|
unseen = -2.639057329615259,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("dayhour", -1.1786549963416462),
|
||||||
|
("the <day-of-month> (number)part of days",
|
||||||
|
-1.1786549963416462),
|
||||||
|
("hourhour", -1.8718021769015913),
|
||||||
|
("time-of-day (latent)part of days", -1.8718021769015913)],
|
||||||
|
n = 4}}),
|
||||||
|
("today",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("at <time-of-day>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.1823215567939546, unseen = -2.772588722239781,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("<time-of-day> am", -2.0149030205422647),
|
||||||
|
("time-of-day (latent)", -1.3217558399823195),
|
||||||
|
("hh:mm", -2.0149030205422647), ("hour", -1.0986122886681098),
|
||||||
|
("minute", -2.0149030205422647)],
|
||||||
|
n = 5},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.791759469228055, unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("time-of-day (latent)", -1.252762968495368),
|
||||||
|
("hour", -1.252762968495368)],
|
||||||
|
n = 1}}),
|
||||||
|
("absorption of , after named day",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Monday", -0.6931471805599453), ("day", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("tonight",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<time-of-day> pm",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.6931471805599453,
|
||||||
|
unseen = -1.9459101490553135,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("hh:mm", -1.0986122886681098),
|
||||||
|
("minute", -1.0986122886681098)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.6931471805599453,
|
||||||
|
unseen = -1.9459101490553135,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("time-of-day (latent)", -1.0986122886681098),
|
||||||
|
("hour", -1.0986122886681098)],
|
||||||
|
n = 1}}),
|
||||||
|
("October",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("month (grain)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<time-of-day> o'clock",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("time-of-day (latent)", -0.6931471805599453),
|
||||||
|
("hour", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("in|within|after <duration>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("day", -1.252762968495368), ("year", -1.252762968495368),
|
||||||
|
("<integer> <unit-of-duration>", -0.8472978603872037)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("hour (grain)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
|
||||||
|
("intersect",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.3364722366212129,
|
||||||
|
unseen = -3.1354942159291497,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("daymonth", -2.3978952727983707),
|
||||||
|
("monthyear", -2.3978952727983707),
|
||||||
|
("Octoberyear (latent)", -2.3978952727983707),
|
||||||
|
("todayat <time-of-day>", -2.3978952727983707),
|
||||||
|
("dayday", -2.3978952727983707),
|
||||||
|
("absorption of , after named day<day-of-month> (ordinal or number) <named-month>",
|
||||||
|
-2.3978952727983707),
|
||||||
|
("dayyear", -2.3978952727983707),
|
||||||
|
("the <day-of-month> (ordinal)March", -2.3978952727983707),
|
||||||
|
("<day-of-month> (ordinal or number) <named-month>year (latent)",
|
||||||
|
-2.3978952727983707),
|
||||||
|
("dayminute", -2.3978952727983707)],
|
||||||
|
n = 5},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.252762968495368, unseen = -2.833213344056216,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("dayhour", -2.0794415416798357),
|
||||||
|
("monthyear", -2.0794415416798357),
|
||||||
|
("todayat <time-of-day>", -2.0794415416798357),
|
||||||
|
("Aprilyear (latent)", -2.0794415416798357)],
|
||||||
|
n = 2}}),
|
||||||
|
("after lunch/work/school",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
|
||||||
|
("in <number> (implicit minutes)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
|
||||||
|
n = 2}}),
|
||||||
|
("year (grain)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.791759469228055,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("Saturday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("year (latent)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
|
||||||
|
n = 3},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("Monday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.791759469228055,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("yesterday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("April",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<time-of-day> am",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.2876820724517809,
|
||||||
|
unseen = -2.4849066497880004,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("at <time-of-day>", -1.7047480922384253),
|
||||||
|
("time-of-day (latent)", -1.7047480922384253),
|
||||||
|
("hh:mm", -1.7047480922384253), ("hour", -1.2992829841302609),
|
||||||
|
("minute", -1.7047480922384253)],
|
||||||
|
n = 3},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.3862943611198906,
|
||||||
|
unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("time-of-day (latent)", -1.252762968495368),
|
||||||
|
("hour", -1.252762968495368)],
|
||||||
|
n = 1}}),
|
||||||
|
("week (grain)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("now",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("this <part-of-day>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("tonight", -1.252762968495368), ("hour", -0.8472978603872037),
|
||||||
|
("part of days", -1.252762968495368)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("Friday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("tomorrow",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("this|last|next <cycle>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -3.044522437723423,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("week", -1.6094379124341003),
|
||||||
|
("month (grain)", -2.3025850929940455),
|
||||||
|
("year (grain)", -1.6094379124341003),
|
||||||
|
("week (grain)", -1.6094379124341003),
|
||||||
|
("year", -1.6094379124341003), ("month", -2.3025850929940455)],
|
||||||
|
n = 7},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.9459101490553135,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<time> after next",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Friday", -0.6931471805599453), ("day", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("the <day-of-month> (ordinal)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("ordinals (first..19th)", 0.0)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("the <day-of-month> (number)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.9459101490553135,
|
||||||
|
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
|
||||||
|
n = 5}}),
|
||||||
|
("Sunday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("February",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("time-of-day (latent)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.8109302162163288,
|
||||||
|
unseen = -1.9459101490553135,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("integer (numeric)", -0.40546510810816444),
|
||||||
|
("number (0..19)", -1.0986122886681098)],
|
||||||
|
n = 4},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.587786664902119, unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList [("integer (numeric)", -0.15415067982725836)],
|
||||||
|
n = 5}}),
|
||||||
|
("<integer> <unit-of-duration>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.40546510810816444,
|
||||||
|
unseen = -2.3978952727983707,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("integer (numeric)day (grain)", -1.6094379124341003),
|
||||||
|
("integer (numeric)year (grain)", -1.6094379124341003),
|
||||||
|
("day", -1.6094379124341003), ("year", -1.6094379124341003)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.0986122886681098,
|
||||||
|
unseen = -2.1972245773362196,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("hour", -1.3862943611198906),
|
||||||
|
("integer (numeric)hour (grain)", -1.3862943611198906)],
|
||||||
|
n = 1}}),
|
||||||
|
("ordinals (first..19th)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("on <day>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("day", -0.6931471805599453),
|
||||||
|
("the <day-of-month> (ordinal)", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("a <unit-of-duration>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -2.3978952727983707,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -3.4339872044851463,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("week", -2.0149030205422647),
|
||||||
|
("month (grain)", -2.70805020110221),
|
||||||
|
("hour (grain)", -2.70805020110221),
|
||||||
|
("year (grain)", -1.791759469228055),
|
||||||
|
("week (grain)", -2.0149030205422647),
|
||||||
|
("day", -2.70805020110221), ("year", -1.791759469228055),
|
||||||
|
("hour", -2.70805020110221), ("month", -2.70805020110221),
|
||||||
|
("day (grain)", -2.70805020110221)],
|
||||||
|
n = 10}}),
|
||||||
|
("hh:mm",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.791759469228055,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("number (0..19)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("intersect by \",\", \"of\", \"from\", \"'s\"",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Monday<day-of-month> (ordinal or number) <named-month>",
|
||||||
|
-0.6931471805599453),
|
||||||
|
("dayday", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("March",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("Christmas",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("dd.mm.yyyy",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("decimal number",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.791759469228055,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
|
||||||
|
("<day-of-month>(ordinal or number)/<named-month>/year",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("integer (numeric)April", -0.6931471805599453),
|
||||||
|
("month", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("next <time>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.40546510810816444,
|
||||||
|
unseen = -2.3025850929940455,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("day", -1.5040773967762742), ("March", -1.5040773967762742),
|
||||||
|
("month", -1.5040773967762742),
|
||||||
|
("Tuesday", -1.5040773967762742)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.0986122886681098,
|
||||||
|
unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Friday", -1.252762968495368), ("day", -1.252762968495368)],
|
||||||
|
n = 1}}),
|
||||||
|
("Tuesday",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<named-month> year",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -1.0986122886681098, unseen = -1.791759469228055,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("October", -0.916290731874155), ("month", -0.916290731874155)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.40546510810816444,
|
||||||
|
unseen = -2.0794415416798357,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("April", -0.8472978603872037), ("month", -0.8472978603872037)],
|
||||||
|
n = 2}}),
|
||||||
|
("winter",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("<named-month> <day-of-month> (non ordinal)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Aprilinteger (numeric)", -0.6931471805599453),
|
||||||
|
("month", -0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("this|next <day-of-week>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.40546510810816444,
|
||||||
|
unseen = -2.1972245773362196,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Monday", -1.3862943611198906), ("day", -0.9808292530117262),
|
||||||
|
("Tuesday", -1.3862943611198906)],
|
||||||
|
n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -1.0986122886681098,
|
||||||
|
unseen = -1.9459101490553135,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Friday", -1.0986122886681098), ("day", -1.0986122886681098)],
|
||||||
|
n = 1}}),
|
||||||
|
("day (grain)",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("right now",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("intersect by \",\", \"of\", \"from\" for year",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.6094379124341003,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("dayyear", -0.6931471805599453),
|
||||||
|
("<named-month> <day-of-month> (non ordinal)year (latent)",
|
||||||
|
-0.6931471805599453)],
|
||||||
|
n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("part of days",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = -0.6931471805599453,
|
||||||
|
unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -0.6931471805599453,
|
||||||
|
unseen = -1.3862943611198906,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
|
||||||
|
("summer",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("this <time>",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -2.3978952727983707,
|
||||||
|
likelihoods =
|
||||||
|
HashMap.fromList
|
||||||
|
[("Monday", -1.6094379124341003), ("day", -0.916290731874155),
|
||||||
|
("winter", -1.6094379124341003),
|
||||||
|
("summer", -1.6094379124341003)],
|
||||||
|
n = 3},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -1.6094379124341003,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}}),
|
||||||
|
("August",
|
||||||
|
Classifier{okData =
|
||||||
|
ClassData{prior = 0.0, unseen = -1.0986122886681098,
|
||||||
|
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
|
||||||
|
koData =
|
||||||
|
ClassData{prior = -infinity, unseen = -0.6931471805599453,
|
||||||
|
likelihoods = HashMap.fromList [], n = 0}})]
|
@ -21,6 +21,7 @@ import qualified Duckling.Numeral.BG.Rules as Numeral
|
|||||||
import qualified Duckling.AmountOfMoney.BG.Rules as AmountOfMoney
|
import qualified Duckling.AmountOfMoney.BG.Rules as AmountOfMoney
|
||||||
import qualified Duckling.Distance.BG.Rules as Distance
|
import qualified Duckling.Distance.BG.Rules as Distance
|
||||||
import qualified Duckling.Duration.BG.Rules as Duration
|
import qualified Duckling.Duration.BG.Rules as Duration
|
||||||
|
import qualified Duckling.Time.BG.Rules as Time
|
||||||
import qualified Duckling.TimeGrain.BG.Rules as TimeGrain
|
import qualified Duckling.TimeGrain.BG.Rules as TimeGrain
|
||||||
import qualified Duckling.Ordinal.BG.Rules as Ordinal
|
import qualified Duckling.Ordinal.BG.Rules as Ordinal
|
||||||
|
|
||||||
@ -43,7 +44,7 @@ langRules (This PhoneNumber) = []
|
|||||||
langRules (This Quantity) = []
|
langRules (This Quantity) = []
|
||||||
langRules (This RegexMatch) = []
|
langRules (This RegexMatch) = []
|
||||||
langRules (This Temperature) = []
|
langRules (This Temperature) = []
|
||||||
langRules (This Time) = []
|
langRules (This Time) = Time.rules
|
||||||
langRules (This TimeGrain) = TimeGrain.rules
|
langRules (This TimeGrain) = TimeGrain.rules
|
||||||
langRules (This Url) = []
|
langRules (This Url) = []
|
||||||
langRules (This Volume) = []
|
langRules (This Volume) = []
|
||||||
|
171
Duckling/Time/BG/Corpus.hs
Normal file
171
Duckling/Time/BG/Corpus.hs
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
-- Copyright (c) 2016-present, Facebook, Inc.
|
||||||
|
-- All rights reserved.
|
||||||
|
--
|
||||||
|
-- This source code is licensed under the BSD-style license found in the
|
||||||
|
-- LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module Duckling.Time.BG.Corpus
|
||||||
|
( corpus
|
||||||
|
, negativeCorpus
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.String
|
||||||
|
import Prelude
|
||||||
|
|
||||||
|
import Duckling.Locale
|
||||||
|
import Duckling.Resolve
|
||||||
|
import Duckling.Testing.Types hiding (examples)
|
||||||
|
import Duckling.Time.Corpus
|
||||||
|
import Duckling.Time.Types hiding (Month)
|
||||||
|
import Duckling.TimeGrain.Types hiding (add)
|
||||||
|
|
||||||
|
context :: Context
|
||||||
|
context = testContext {locale = makeLocale BG Nothing}
|
||||||
|
|
||||||
|
corpus :: Corpus
|
||||||
|
corpus = (context, testOptions, allExamples)
|
||||||
|
|
||||||
|
negativeCorpus :: NegativeCorpus
|
||||||
|
negativeCorpus = (context, testOptions, examples)
|
||||||
|
where
|
||||||
|
examples =
|
||||||
|
[ "един хотел"
|
||||||
|
, "една оферта"
|
||||||
|
, "следващи 5"
|
||||||
|
]
|
||||||
|
|
||||||
|
allExamples :: [Example]
|
||||||
|
allExamples = concat
|
||||||
|
[ examples (datetime (2013, 2, 12, 4, 30, 0) Second)
|
||||||
|
[ "сега"
|
||||||
|
, "точно сега"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 12, 0, 0, 0) Day)
|
||||||
|
[ "днес"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 11, 0, 0, 0) Day)
|
||||||
|
[ "вчера"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
|
||||||
|
[ "утре"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
|
||||||
|
[ "понеделник"
|
||||||
|
, "пон."
|
||||||
|
, "този понеделник"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
|
||||||
|
[ "понеделник, 18 февруари"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 19, 0, 0, 0) Day)
|
||||||
|
[ "вторник"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 14, 0, 0, 0) Day)
|
||||||
|
[ "четвъртък"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 15, 0, 0, 0) Day)
|
||||||
|
[ "петък"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 16, 0, 0, 0) Day)
|
||||||
|
[ "събота"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 17, 0, 0, 0) Day)
|
||||||
|
[ "неделя"
|
||||||
|
, "нед."
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 3, 1, 0, 0, 0) Day)
|
||||||
|
[ "1 март"
|
||||||
|
, "първи март"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 15, 0, 0, 0) Day)
|
||||||
|
[ "на петнадесети"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 8, 8, 0, 0, 0) Day)
|
||||||
|
[ "8 август"
|
||||||
|
]
|
||||||
|
, examples (datetime (2014, 10, 0, 0, 0, 0) Month)
|
||||||
|
[ "октомври 2014"
|
||||||
|
]
|
||||||
|
, examples (datetime (1974, 10, 31, 0, 0, 0) Day)
|
||||||
|
[ "31.10.1974"
|
||||||
|
, "31.10.74"
|
||||||
|
]
|
||||||
|
, examples (datetime (2015, 4, 14, 0, 0, 0) Day)
|
||||||
|
["14 април 2015"
|
||||||
|
,"април 14, 2015"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 19, 0, 0, 0) Day)
|
||||||
|
[ "следващия вторник"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 22, 0, 0, 0) Day)
|
||||||
|
[ "по-следващия петък"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 3, 0, 0, 0, 0) Month)
|
||||||
|
[ "следващия март"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 11, 0, 0, 0) Week)
|
||||||
|
[ "тази седмица"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 4, 0, 0, 0) Week)
|
||||||
|
[ "последната седмица"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 18, 0, 0, 0) Week)
|
||||||
|
[ "следващата седмица"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 1, 0, 0, 0, 0) Month)
|
||||||
|
[ "последния месец"
|
||||||
|
]
|
||||||
|
, examples (datetime (2012, 0, 0, 0, 0, 0) Year)
|
||||||
|
[ "миналата година"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 0, 0, 0, 0, 0) Year)
|
||||||
|
[ "тази година"
|
||||||
|
]
|
||||||
|
, examples (datetime (2014, 0, 0, 0, 0, 0) Year)
|
||||||
|
[ "следващата година"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 12, 4, 0, 0) Hour)
|
||||||
|
[ "в 4 сутринта"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 12, 15, 0, 0) Hour)
|
||||||
|
[ "в 3"
|
||||||
|
, "3 часа"
|
||||||
|
, "в три"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 13, 3, 18, 0) Minute)
|
||||||
|
[ "3:18 сутринта"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 13, 3, 18, 0) Minute)
|
||||||
|
[ "3:18"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 12, 15, 18, 0) Minute)
|
||||||
|
[ "3:18 след обед"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 12, 20, 0, 0) Minute)
|
||||||
|
[ "днес в 20:00"
|
||||||
|
]
|
||||||
|
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
|
||||||
|
[ "утре"
|
||||||
|
]
|
||||||
|
, examples (datetimeOpenInterval After (2016, 2, 0, 0, 0, 0) Month)
|
||||||
|
[ "след 3 години"
|
||||||
|
]
|
||||||
|
, examples (datetimeOpenInterval After (2013, 2, 19, 4, 0, 0) Hour)
|
||||||
|
[ "след 7 дни"
|
||||||
|
]
|
||||||
|
, examples (datetimeInterval ((2013, 6, 21, 0, 0, 0), (2013, 9, 24, 0, 0, 0)) Day)
|
||||||
|
[ "това лято"
|
||||||
|
]
|
||||||
|
, examples (datetimeInterval ((2012, 12, 21, 0, 0, 0), (2013, 3, 21, 0, 0, 0)) Day)
|
||||||
|
[ "тази зима"
|
||||||
|
]
|
||||||
|
, examples (datetimeHoliday (2013, 12, 25, 0, 0, 0) Day "Christmas")
|
||||||
|
[ "коледа"
|
||||||
|
]
|
||||||
|
, examples (datetimeInterval ((2013, 2, 12, 18, 0, 0), (2013, 2, 13, 0, 0, 0)) Hour)
|
||||||
|
[ "тази вечер"
|
||||||
|
]
|
||||||
|
]
|
1793
Duckling/Time/BG/Rules.hs
Normal file
1793
Duckling/Time/BG/Rules.hs
Normal file
File diff suppressed because it is too large
Load Diff
@ -630,6 +630,8 @@ library
|
|||||||
-- Time
|
-- Time
|
||||||
, Duckling.Time.AR.Corpus
|
, Duckling.Time.AR.Corpus
|
||||||
, Duckling.Time.AR.Rules
|
, Duckling.Time.AR.Rules
|
||||||
|
, Duckling.Time.BG.Corpus
|
||||||
|
, Duckling.Time.BG.Rules
|
||||||
, Duckling.Time.DA.Corpus
|
, Duckling.Time.DA.Corpus
|
||||||
, Duckling.Time.DA.Rules
|
, Duckling.Time.DA.Rules
|
||||||
, Duckling.Time.DE.Corpus
|
, Duckling.Time.DE.Corpus
|
||||||
@ -1045,6 +1047,7 @@ test-suite duckling-test
|
|||||||
|
|
||||||
-- Time
|
-- Time
|
||||||
, Duckling.Time.AR.Tests
|
, Duckling.Time.AR.Tests
|
||||||
|
, Duckling.Time.BG.Tests
|
||||||
, Duckling.Time.DA.Tests
|
, Duckling.Time.DA.Tests
|
||||||
, Duckling.Time.DE.Tests
|
, Duckling.Time.DE.Tests
|
||||||
, Duckling.Time.EL.Tests
|
, Duckling.Time.EL.Tests
|
||||||
|
@ -28,6 +28,7 @@ import Duckling.Ranking.Types
|
|||||||
import Duckling.Rules
|
import Duckling.Rules
|
||||||
import Duckling.Testing.Types
|
import Duckling.Testing.Types
|
||||||
import qualified Duckling.Time.AR.Corpus as ARTime
|
import qualified Duckling.Time.AR.Corpus as ARTime
|
||||||
|
import qualified Duckling.Time.BG.Corpus as BGTime
|
||||||
import qualified Duckling.Time.DA.Corpus as DATime
|
import qualified Duckling.Time.DA.Corpus as DATime
|
||||||
import qualified Duckling.Time.DE.Corpus as DETime
|
import qualified Duckling.Time.DE.Corpus as DETime
|
||||||
import qualified Duckling.Time.EL.Corpus as ELTime
|
import qualified Duckling.Time.EL.Corpus as ELTime
|
||||||
@ -170,7 +171,7 @@ getDefaultCorpusForLang lang = getCorpusForLang lang
|
|||||||
|
|
||||||
getCorpusForLang :: Lang -> Corpus
|
getCorpusForLang :: Lang -> Corpus
|
||||||
getCorpusForLang AR = ARTime.corpus
|
getCorpusForLang AR = ARTime.corpus
|
||||||
getCorpusForLang BG = (testContext, testOptions, [])
|
getCorpusForLang BG = BGTime.corpus
|
||||||
getCorpusForLang BN = (testContext, testOptions, [])
|
getCorpusForLang BN = (testContext, testOptions, [])
|
||||||
getCorpusForLang CS = (testContext, testOptions, [])
|
getCorpusForLang CS = (testContext, testOptions, [])
|
||||||
getCorpusForLang DA = DATime.corpus
|
getCorpusForLang DA = DATime.corpus
|
||||||
|
35
tests/Duckling/Time/BG/Tests.hs
Normal file
35
tests/Duckling/Time/BG/Tests.hs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
-- Copyright (c) 2016-present, Facebook, Inc.
|
||||||
|
-- All rights reserved.
|
||||||
|
--
|
||||||
|
-- This source code is licensed under the BSD-style license found in the
|
||||||
|
-- LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module Duckling.Time.BG.Tests
|
||||||
|
( tests
|
||||||
|
) where
|
||||||
|
|
||||||
|
import Data.Aeson
|
||||||
|
import Data.Aeson.Types ((.:), parseMaybe, withObject)
|
||||||
|
import Data.String
|
||||||
|
import Data.Text (Text)
|
||||||
|
import Prelude
|
||||||
|
import Test.Tasty
|
||||||
|
import Test.Tasty.HUnit
|
||||||
|
|
||||||
|
import Duckling.Dimensions.Types
|
||||||
|
import Duckling.Locale
|
||||||
|
import Duckling.Resolve
|
||||||
|
import Duckling.Testing.Asserts
|
||||||
|
import Duckling.Testing.Types hiding (examples)
|
||||||
|
import Duckling.Time.BG.Corpus
|
||||||
|
import Duckling.TimeGrain.Types (Grain(..))
|
||||||
|
import Duckling.Types (Range(..))
|
||||||
|
|
||||||
|
tests :: TestTree
|
||||||
|
tests = testGroup "BG Tests"
|
||||||
|
[ makeCorpusTest [This Time] corpus
|
||||||
|
, makeNegativeCorpusTest [This Time] negativeCorpus
|
||||||
|
]
|
@ -24,6 +24,7 @@ import Duckling.Testing.Types
|
|||||||
import Duckling.Time.Types
|
import Duckling.Time.Types
|
||||||
import Duckling.TimeGrain.Types
|
import Duckling.TimeGrain.Types
|
||||||
import qualified Duckling.Time.AR.Tests as AR
|
import qualified Duckling.Time.AR.Tests as AR
|
||||||
|
import qualified Duckling.Time.BG.Tests as BG
|
||||||
import qualified Duckling.Time.DA.Tests as DA
|
import qualified Duckling.Time.DA.Tests as DA
|
||||||
import qualified Duckling.Time.DE.Tests as DE
|
import qualified Duckling.Time.DE.Tests as DE
|
||||||
import qualified Duckling.Time.EN.Tests as EN
|
import qualified Duckling.Time.EN.Tests as EN
|
||||||
@ -50,6 +51,7 @@ import qualified Duckling.Time.ZH.Tests as ZH
|
|||||||
tests :: TestTree
|
tests :: TestTree
|
||||||
tests = testGroup "Time Tests"
|
tests = testGroup "Time Tests"
|
||||||
[ AR.tests
|
[ AR.tests
|
||||||
|
, BG.tests
|
||||||
, DA.tests
|
, DA.tests
|
||||||
, DE.tests
|
, DE.tests
|
||||||
, EL.tests
|
, EL.tests
|
||||||
|
Loading…
Reference in New Issue
Block a user