Summary:
* Time dimension for Vietnamese.
* Expose `debugContext`.

Reviewed By: niteria

Differential Revision: D4963594

fbshipit-source-id: 2373735
This commit is contained in:
Julien Odent 2017-04-28 07:47:05 -07:00 committed by Facebook Github Bot
parent e4d4531877
commit 35b9101c48
10 changed files with 2499 additions and 3 deletions

View File

@ -13,6 +13,7 @@
module Duckling.Debug
( allParses
, debug
, debugContext
, fullParses
, ptree
) where

View File

@ -17,4 +17,5 @@ allDimensions =
[ This Duration
, This Numeral
, This Ordinal
, This Time
]

View File

@ -19,4 +19,888 @@ import qualified Data.HashMap.Strict as HashMap
import Data.String
classifiers :: Classifiers
classifiers = HashMap.fromList []
classifiers
= HashMap.fromList
[("<time> timezone",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("<time-of-day> am|pm", -0.6931471805599453),
("hour", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("integer (numeric)",
Classifier{okData =
ClassData{prior = -0.4986303506721723, unseen = -4.61512051684126,
likelihoods = HashMap.fromList [("", 0.0)], n = 99},
koData =
ClassData{prior = -0.9348671174470905, unseen = -4.189654742026425,
likelihoods = HashMap.fromList [("", 0.0)], n = 64}}),
("exactly <time-of-day>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.3978952727983707,
likelihoods =
HashMap.fromList
[("time-of-day gi\7901", -1.6094379124341003),
("<time-of-day> s\225ng|chi\7873u|t\7889i",
-1.6094379124341003),
("time-of-day (latent)", -1.6094379124341003),
("hour", -0.916290731874155)],
n = 3},
koData =
ClassData{prior = -infinity, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [], n = 0}}),
("ng\224y h\244m qua",
Classifier{okData =
ClassData{prior = -0.5596157879354228, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
koData =
ClassData{prior = -0.8472978603872037,
unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("lunch",
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}}),
("ng\224y dd/mm",
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}}),
("dd/mm",
Classifier{okData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
koData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5}}),
("<part-of-day> <time>",
Classifier{okData =
ClassData{prior = -0.7884573603642702,
unseen = -3.5553480614894135,
likelihoods =
HashMap.fromList
[("hourday", -1.128465251817791),
("noonh\244m nay", -2.833213344056216),
("lunchng\224y mai", -2.4277482359480516),
("morningnamed-day", -2.833213344056216),
("noonng\224y h\244m qua", -2.4277482359480516),
("noonng\224y mai", -2.4277482359480516),
("afternoonng\224y dd/mm", -2.833213344056216),
("afternoonng\224y mai", -2.833213344056216)],
n = 10},
koData =
ClassData{prior = -0.6061358035703156,
unseen = -3.6635616461296463,
likelihoods =
HashMap.fromList
[("hourday", -1.072636802264849),
("afternoon<day-of-month> (numeric with day symbol) <named-month>",
-2.538973871058276),
("afternoongi\225ng sinh", -1.845826690498331),
("afternoonng\224y dd/mm/yyyy", -2.9444389791664407),
("noongi\225ng sinh", -2.9444389791664407),
("afternoonng\224y dd/mm", -2.9444389791664407),
("lunchgi\225ng sinh", -2.9444389791664407),
("afternoonintersect", -2.9444389791664407)],
n = 12}}),
("tonight",
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}}),
("integer (0..19)",
Classifier{okData =
ClassData{prior = -1.452252328911688, unseen = -2.5649493574615367,
likelihoods = HashMap.fromList [("", 0.0)], n = 11},
koData =
ClassData{prior = -0.2666286632539486,
unseen = -3.6375861597263857,
likelihoods = HashMap.fromList [("", 0.0)], n = 36}}),
("<day-of-week> t\7899i",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.3978952727983707,
likelihoods =
HashMap.fromList
[("day", -0.6931471805599453),
("named-day", -0.6931471805599453)],
n = 4},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("month (grain)",
Classifier{okData =
ClassData{prior = -1.4271163556401458,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -0.2744368457017603, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19}}),
("ng\224y h\244m kia",
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}}),
("gi\225ng sinh",
Classifier{okData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -3.4657359027997265,
likelihoods = HashMap.fromList [("", 0.0)], n = 30}}),
("hour (grain)",
Classifier{okData =
ClassData{prior = -1.791759469228055, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
koData =
ClassData{prior = -0.1823215567939546,
unseen = -3.0910424533583156,
likelihoods = HashMap.fromList [("", 0.0)], n = 20}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.5070449009260846,
unseen = -5.0106352940962555,
likelihoods =
HashMap.fromList
[("<time-of-day> s\225ng|chi\7873u|t\7889ing\224y dd/mm",
-3.6176519448255684),
("hourday", -3.6176519448255684),
("dayhour", -4.310799125385514),
("h\244m nay<time-of-day> s\225ng|chi\7873u|t\7889i",
-4.310799125385514),
("monthyear", -3.3945083935113587),
("time-of-day gi\7901<part-of-day> <time>", -4.310799125385514),
("time-of-day gi\7901<time> n\224y", -4.310799125385514),
("month (numeric with month symbol)year (numeric with year symbol)",
-3.6176519448255684),
("dayday", -2.6060510331470885),
("named-monthyear (numeric with year symbol)",
-4.310799125385514),
("hourhour", -3.3945083935113587),
("named-day<day-of-month> (numeric with day symbol) <named-month>",
-2.7013612129514133),
("intersectyear (numeric with year symbol)",
-3.6176519448255684),
("dayyear", -2.4389969484839225),
("<ordinal> <cycle> of <time>year (numeric with year symbol)",
-4.310799125385514),
("minutehour", -3.9053340172773496),
("<time-of-day> s\225ng|chi\7873u|t\7889iintersect",
-3.9053340172773496),
("time-of-day gi\7901<part-of-day> (h\244m )?nay",
-4.310799125385514),
("<day-of-month> (numeric with day symbol) <named-month>year (numeric with year symbol)",
-3.2121868367174042),
("named-daynext <cycle>", -3.6176519448255684),
("named-dayintersect", -4.310799125385514),
("<time-of-day> s\225ng|chi\7873u|t\7889i<day-of-month> (numeric with day symbol) <named-month>",
-3.3945083935113587),
("time-of-day gi\7901tonight", -4.310799125385514),
("minuteday", -2.8067217286092396),
("hh:mm<part-of-day> <time>", -4.310799125385514),
("<day-of-month> <named-month>year (numeric with year symbol)",
-3.2121868367174042),
("at hh:mm<part-of-day> <time>", -4.310799125385514),
("dayweek", -3.0580361568901457),
("weekyear", -4.310799125385514),
("<time-of-day> s\225ng|chi\7873u|t\7889ing\224y dd/mm/yyyy",
-4.310799125385514),
("<time-of-day> s\225ng|chi\7873u|t\7889ing\224y mai",
-4.310799125385514),
("named-daythis <cycle>", -3.6176519448255684),
("seasonthis <cycle>", -4.310799125385514),
("minuteyear", -3.9053340172773496)],
n = 53},
koData =
ClassData{prior = -0.9219887529887928, unseen = -4.736198448394496,
likelihoods =
HashMap.fromList
[("<time-of-day> s\225ng|chi\7873u|t\7889ing\224y dd/mm",
-4.034240638152395),
("hourday", -2.2424811689243405),
("dayhour", -4.034240638152395),
("monthyear", -2.7814776696570274),
("noonh\244m nay", -4.034240638152395),
("houryear", -4.034240638152395),
("month (numeric with month symbol)year (numeric with year symbol)",
-2.7814776696570274),
("dayday", -2.5301632413761213),
("dayyear", -4.034240638152395),
("h\244m naytime-of-day gi\7901", -4.034240638152395),
("minutehour", -3.628775530044231),
("<part-of-day> <time>year (numeric with year symbol)",
-4.034240638152395),
("<time-of-day> s\225ng|chi\7873u|t\7889igi\225ng sinh",
-2.424802725718295),
("noonng\224y h\244m qua", -3.628775530044231),
("noongi\225ng sinh", -4.034240638152395),
("minuteday", -2.9356283494842854),
("hh:mm<part-of-day> <time>", -4.034240638152395),
("noonng\224y mai", -3.628775530044231),
("<day-of-month> <named-month>year (numeric with year symbol)",
-4.034240638152395),
("named-daygi\225ng sinh", -2.5301632413761213),
("at hh:mm<part-of-day> <time>", -4.034240638152395)],
n = 35}}),
("time-of-day gi\7901",
Classifier{okData =
ClassData{prior = -6.453852113757118e-2,
unseen = -4.174387269895637,
likelihoods =
HashMap.fromList
[("exactly <time-of-day>", -3.4657359027997265),
("about <time-of-day>", -3.0602707946915624),
("time-of-day (latent)", -0.8266785731844679),
("hour", -0.7248958788745256)],
n = 30},
koData =
ClassData{prior = -2.772588722239781, unseen = -2.1972245773362196,
likelihoods =
HashMap.fromList
[("time-of-day (latent)", -0.9808292530117262),
("hour", -0.9808292530117262)],
n = 2}}),
("<ordinal> <cycle> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("daymonth", -1.3862943611198906),
("day (grain)ordinalsnamed-month", -2.0794415416798357),
("day (grain)ordinalsmonth (numeric with month symbol)",
-1.6739764335716716),
("week (grain)ordinalsintersect", -2.0794415416798357),
("weekmonth", -1.6739764335716716),
("week (grain)ordinalsmonth (numeric with month symbol)",
-2.0794415416798357)],
n = 5},
koData =
ClassData{prior = -infinity, unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [], n = 0}}),
("season",
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}}),
("year (grain)",
Classifier{okData =
ClassData{prior = -0.5389965007326869, unseen = -2.772588722239781,
likelihoods = HashMap.fromList [("", 0.0)], n = 14},
koData =
ClassData{prior = -0.8754687373538999,
unseen = -2.4849066497880004,
likelihoods = HashMap.fromList [("", 0.0)], n = 10}}),
("quarter <number>",
Classifier{okData =
ClassData{prior = -0.40546510810816444,
unseen = -2.4849066497880004,
likelihoods =
HashMap.fromList
[("quarter (grain)integer (numeric)", -1.2992829841302609),
("quarter (grain)integer (0..19)", -1.2992829841302609),
("quarter", -0.7884573603642702)],
n = 4},
koData =
ClassData{prior = -1.0986122886681098,
unseen = -2.0794415416798357,
likelihoods =
HashMap.fromList
[("quarter (grain)integer (numeric)", -0.8472978603872037),
("quarter", -0.8472978603872037)],
n = 2}}),
("next <cycle>",
Classifier{okData =
ClassData{prior = -0.6931471805599453,
unseen = -3.7612001156935624,
likelihoods =
HashMap.fromList
[("week", -1.9459101490553135),
("month (grain)", -3.044522437723423),
("year (grain)", -2.128231705849268),
("week (grain)", -1.9459101490553135),
("quarter", -2.3513752571634776), ("year", -2.128231705849268),
("month", -3.044522437723423),
("quarter (grain)", -2.3513752571634776)],
n = 13},
koData =
ClassData{prior = -0.6931471805599453,
unseen = -3.7612001156935624,
likelihoods =
HashMap.fromList
[("month (grain)", -2.639057329615259),
("hour (grain)", -2.639057329615259),
("year (grain)", -2.639057329615259),
("second", -2.3513752571634776), ("day", -2.639057329615259),
("minute (grain)", -2.639057329615259),
("year", -2.639057329615259),
("second (grain)", -2.3513752571634776),
("hour", -2.639057329615259), ("month", -2.639057329615259),
("minute", -2.639057329615259),
("day (grain)", -2.639057329615259)],
n = 13}}),
("ng\224y mai",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("quarter <number> <year>",
Classifier{okData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList
[("quarteryear", -1.0986122886681098),
("quarter (grain)integer (numeric)year (numeric with year symbol)",
-1.0986122886681098)],
n = 1},
koData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList
[("quarterhour", -1.0986122886681098),
("quarter (grain)integer (numeric)time-of-day (latent)",
-1.0986122886681098)],
n = 1}}),
("dd/mm/yyyy",
Classifier{okData =
ClassData{prior = -0.15415067982725836,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -1.9459101490553135,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("after lunch",
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}}),
("hh:mm:ss",
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> tr\432\7899c",
Classifier{okData =
ClassData{prior = -1.9459101490553135,
unseen = -2.3025850929940455,
likelihoods =
HashMap.fromList
[("day", -1.5040773967762742),
("named-day", -1.5040773967762742)],
n = 1},
koData =
ClassData{prior = -0.15415067982725836,
unseen = -2.995732273553991,
likelihoods =
HashMap.fromList
[("gi\225ng sinh", -2.2512917986064953),
("<hour-of-day> <integer>", -2.2512917986064953),
("day", -2.2512917986064953),
("time-of-day (latent)", -1.3350010667323402),
("hour", -1.3350010667323402), ("minute", -2.2512917986064953)],
n = 6}}),
("ng\224y dd/mm/yyyy",
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> n\224y",
Classifier{okData =
ClassData{prior = -0.6061358035703156, unseen = -2.995732273553991,
likelihoods =
HashMap.fromList
[("season", -1.845826690498331),
("<time-of-day> s\225ng|chi\7873u|t\7889i",
-2.2512917986064953),
("day", -1.845826690498331), ("noon", -1.845826690498331),
("hour", -1.3350010667323402),
("morning", -2.2512917986064953)],
n = 6},
koData =
ClassData{prior = -0.7884573603642702, unseen = -2.890371757896165,
likelihoods =
HashMap.fromList
[("time-of-day (latent)", -1.4469189829363254),
("noon", -1.7346010553881064), ("hour", -1.041453874828161)],
n = 5}}),
("b\226y gi\7901",
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}}),
("<hour-of-day> <integer>",
Classifier{okData =
ClassData{prior = -1.4469189829363254,
unseen = -2.4849066497880004,
likelihoods =
HashMap.fromList
[("hour", -0.7884573603642702),
("time-of-day gi\7901integer (numeric)", -0.7884573603642702)],
n = 4},
koData =
ClassData{prior = -0.2682639865946794,
unseen = -3.4011973816621555,
likelihoods =
HashMap.fromList
[("time-of-day (latent)integer (0..19)", -0.7282385003712154),
("hour", -0.7282385003712154)],
n = 13}}),
("<time> t\7899i",
Classifier{okData =
ClassData{prior = -0.4700036292457356, unseen = -2.995732273553991,
likelihoods =
HashMap.fromList
[("month (numeric with month symbol)", -2.2512917986064953),
("day", -1.3350010667323402),
("named-day", -1.3350010667323402),
("month", -2.2512917986064953)],
n = 5},
koData =
ClassData{prior = -0.9808292530117262, unseen = -2.772588722239781,
likelihoods =
HashMap.fromList
[("gi\225ng sinh", -2.0149030205422647),
("time-of-day gi\7901", -2.0149030205422647),
("<hour-of-day> <integer>", -2.0149030205422647),
("day", -2.0149030205422647), ("hour", -2.0149030205422647),
("minute", -2.0149030205422647)],
n = 3}}),
("<time-of-day> s\225ng|chi\7873u|t\7889i",
Classifier{okData =
ClassData{prior = -5.129329438755058e-2,
unseen = -4.465908118654584,
likelihoods =
HashMap.fromList
[("exactly <time-of-day>", -3.7612001156935624),
("time-of-day gi\7901", -1.318853080324358),
("<hour-of-day> <integer>", -3.355735007585398),
("about <time-of-day>", -3.355735007585398),
("at hh:mm", -3.068052935133617),
("(hour-of-day) half", -3.355735007585398),
("hh:mm", -2.5084371471981943), ("hour", -1.1962507582320256),
("minute", -1.8152899666382492)],
n = 38},
koData =
ClassData{prior = -2.995732273553991, unseen = -2.70805020110221,
likelihoods =
HashMap.fromList
[("time-of-day (latent)", -1.540445040947149),
("hour", -1.540445040947149)],
n = 2}}),
("named-month",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("month (numeric with month symbol)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.4339872044851463,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.2231435513142097),
("integer (0..19)", -1.6094379124341003)],
n = 28},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("week (grain)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.70805020110221,
likelihoods = HashMap.fromList [("", 0.0)], n = 13},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("year (numeric with year symbol)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.5649493574615367,
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
n = 11},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("quarter <number> of <year>",
Classifier{okData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList
[("quarteryear", -1.0986122886681098),
("quarter (grain)integer (numeric)year (numeric with year symbol)",
-1.0986122886681098)],
n = 1},
koData =
ClassData{prior = -0.6931471805599453,
unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList
[("quarterhour", -1.0986122886681098),
("quarter (grain)integer (numeric)time-of-day (latent)",
-1.0986122886681098)],
n = 1}}),
("afternoon",
Classifier{okData =
ClassData{prior = -0.916290731874155, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
koData =
ClassData{prior = -0.5108256237659907,
unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("this <cycle>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.6109179126442243,
likelihoods =
HashMap.fromList
[("week", -1.6376087894007967),
("year (grain)", -2.1972245773362196),
("week (grain)", -1.6376087894007967),
("day", -2.890371757896165), ("quarter", -1.9740810260220096),
("year", -2.1972245773362196),
("quarter (grain)", -1.9740810260220096),
("day (grain)", -2.890371757896165)],
n = 14},
koData =
ClassData{prior = -infinity, unseen = -2.1972245773362196,
likelihoods = HashMap.fromList [], n = 0}}),
("minute (grain)",
Classifier{okData =
ClassData{prior = -0.2876820724517809,
unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
koData =
ClassData{prior = -1.3862943611198906,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("about <time-of-day>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.833213344056216,
likelihoods =
HashMap.fromList
[("time-of-day gi\7901", -1.6739764335716716),
("<time-of-day> s\225ng|chi\7873u|t\7889i",
-1.6739764335716716),
("time-of-day (latent)", -1.6739764335716716),
("hour", -0.8266785731844679)],
n = 6},
koData =
ClassData{prior = -infinity, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [], n = 0}}),
("time-of-day (latent)",
Classifier{okData =
ClassData{prior = -0.6567795363890705,
unseen = -3.4339872044851463,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.10536051565782628),
("integer (0..19)", -2.3025850929940455)],
n = 28},
koData =
ClassData{prior = -0.7308875085427924, unseen = -3.367295829986474,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.4989911661189879),
("integer (0..19)", -0.9343092373768334)],
n = 26}}),
("at hh:mm",
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}}),
("(hour-of-day) half",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.1972245773362196,
likelihoods =
HashMap.fromList
[("time-of-day gi\7901", -0.6931471805599453),
("hour", -0.6931471805599453)],
n = 3},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("<integer> <unit-of-duration>",
Classifier{okData =
ClassData{prior = -infinity, unseen = -2.995732273553991,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -5.225746673713201,
likelihoods =
HashMap.fromList
[("week", -3.42859635585027),
("integer (0..19)year (grain)", -4.527208644518379),
("integer (numeric)day (grain)", -3.0231312477421053),
("integer (0..19)hour (grain)", -3.834061463958434),
("second", -3.6109179126442243),
("integer (numeric)second (grain)", -3.6109179126442243),
("integer (numeric)year (grain)", -2.655406467616788),
("day", -2.822460552279954), ("year", -2.581298495463066),
("integer (numeric)week (grain)", -4.121743536410215),
("integer (0..19)month (grain)", -4.527208644518379),
("hour", -2.001480000210124), ("month", -2.042301994730379),
("integer (numeric)minute (grain)", -3.6109179126442243),
("integer (numeric)month (grain)", -2.084861609149175),
("minute", -3.6109179126442243),
("integer (numeric)hour (grain)", -2.129313371720009),
("integer (0..19)day (grain)", -4.121743536410215),
("integer (0..19)week (grain)", -3.834061463958434)],
n = 83}}),
("<time-of-day> am|pm",
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}}),
("h\244m nay",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("hh:mm",
Classifier{okData =
ClassData{prior = -8.701137698962981e-2,
unseen = -2.5649493574615367,
likelihoods = HashMap.fromList [("", 0.0)], n = 11},
koData =
ClassData{prior = -2.4849066497880004,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("named-day",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.4339872044851463,
likelihoods = HashMap.fromList [("", 0.0)], n = 29},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("second (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}}),
("intersect by \"of\", \"from\", \"'s\"",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.3025850929940455,
likelihoods =
HashMap.fromList
[("named-daynext <cycle>", -1.5040773967762742),
("dayweek", -0.8109302162163288),
("named-daythis <cycle>", -1.0986122886681098)],
n = 3},
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [], n = 0}}),
("<hour-of-day> <integer> ph\250t",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("hour", -0.6931471805599453),
("time-of-day gi\7901integer (numeric)", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("noon",
Classifier{okData =
ClassData{prior = -0.7621400520468967,
unseen = -2.1972245773362196,
likelihoods = HashMap.fromList [("", 0.0)], n = 7},
koData =
ClassData{prior = -0.6286086594223742,
unseen = -2.3025850929940455,
likelihoods = HashMap.fromList [("", 0.0)], n = 8}}),
("ordinals",
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}}),
("(hour-of-day) quarter",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("hour", -0.6931471805599453),
("time-of-day gi\7901integer (numeric)", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("last <cycle>",
Classifier{okData =
ClassData{prior = -0.7731898882334817, unseen = -3.295836866004329,
likelihoods =
HashMap.fromList
[("week", -2.5649493574615367),
("month (grain)", -2.5649493574615367),
("year (grain)", -1.6486586255873816),
("week (grain)", -2.5649493574615367),
("year", -1.6486586255873816), ("month", -2.5649493574615367)],
n = 6},
koData =
ClassData{prior = -0.6190392084062235, unseen = -3.367295829986474,
likelihoods =
HashMap.fromList
[("month (grain)", -2.2335922215070942),
("hour (grain)", -2.639057329615259),
("year (grain)", -2.639057329615259),
("second", -2.639057329615259), ("day", -2.639057329615259),
("minute (grain)", -2.639057329615259),
("year", -2.639057329615259),
("second (grain)", -2.639057329615259),
("hour", -2.639057329615259), ("month", -2.2335922215070942),
("minute", -2.639057329615259),
("day (grain)", -2.639057329615259)],
n = 7}}),
("next n <cycle>",
Classifier{okData =
ClassData{prior = -0.1431008436406733,
unseen = -3.7612001156935624,
likelihoods =
HashMap.fromList
[("integer (numeric)day (grain)", -2.639057329615259),
("second", -2.3513752571634776),
("integer (numeric)second (grain)", -2.3513752571634776),
("integer (numeric)year (grain)", -2.639057329615259),
("day", -2.639057329615259), ("year", -2.639057329615259),
("integer (0..19)month (grain)", -3.044522437723423),
("hour", -2.639057329615259), ("month", -2.639057329615259),
("integer (numeric)minute (grain)", -2.639057329615259),
("integer (numeric)month (grain)", -3.044522437723423),
("minute", -2.639057329615259),
("integer (numeric)hour (grain)", -2.639057329615259)],
n = 13},
koData =
ClassData{prior = -2.0149030205422647, unseen = -3.044522437723423,
likelihoods =
HashMap.fromList
[("week", -1.8971199848858813),
("integer (numeric)week (grain)", -2.3025850929940455),
("integer (0..19)week (grain)", -2.3025850929940455)],
n = 2}}),
("<day-of-month> <named-month>",
Classifier{okData =
ClassData{prior = -0.10008345855698253,
unseen = -3.7376696182833684,
likelihoods =
HashMap.fromList
[("integer (numeric)month (numeric with month symbol)",
-0.8232003088081431),
("integer (numeric)named-month", -2.6149597780361984),
("month", -0.7178397931503169)],
n = 19},
koData =
ClassData{prior = -2.3513752571634776,
unseen = -2.0794415416798357,
likelihoods =
HashMap.fromList
[("integer (numeric)month (numeric with month symbol)",
-0.8472978603872037),
("month", -0.8472978603872037)],
n = 2}}),
("last n <cycle>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.4657359027997265,
likelihoods =
HashMap.fromList
[("integer (numeric)day (grain)", -2.3353749158170367),
("integer (0..19)hour (grain)", -2.740840023925201),
("second", -2.740840023925201),
("integer (numeric)second (grain)", -2.740840023925201),
("integer (numeric)year (grain)", -2.740840023925201),
("day", -2.3353749158170367), ("year", -2.740840023925201),
("hour", -2.3353749158170367), ("month", -2.3353749158170367),
("integer (numeric)minute (grain)", -2.740840023925201),
("integer (numeric)month (grain)", -2.3353749158170367),
("minute", -2.740840023925201),
("integer (numeric)hour (grain)", -2.740840023925201)],
n = 9},
koData =
ClassData{prior = -infinity, unseen = -2.639057329615259,
likelihoods = HashMap.fromList [], n = 0}}),
("quarter (grain)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.70805020110221,
likelihoods = HashMap.fromList [("", 0.0)], n = 13},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("morning",
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}}),
("day (grain)",
Classifier{okData =
ClassData{prior = -0.6190392084062235,
unseen = -2.1972245773362196,
likelihoods = HashMap.fromList [("", 0.0)], n = 7},
koData =
ClassData{prior = -0.7731898882334817,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6}}),
("<part-of-day> (h\244m )?nay",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.4849066497880004,
likelihoods =
HashMap.fromList
[("noon", -1.0116009116784799), ("hour", -0.7884573603642702),
("morning", -1.7047480922384253)],
n = 4},
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [], n = 0}}),
("<day-of-month> (numeric with day symbol) <named-month>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.784189633918261,
likelihoods =
HashMap.fromList
[("integer (numeric)month (numeric with month symbol)",
-0.8167611365271219),
("integer (numeric)named-month", -2.662587827025453),
("month", -0.7166776779701395)],
n = 20},
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -19,6 +19,7 @@ import qualified Duckling.AmountOfMoney.VI.Rules as AmountOfMoney
import qualified Duckling.Numeral.VI.Rules as Numeral
import qualified Duckling.Ordinal.VI.Rules as Ordinal
import qualified Duckling.TimeGrain.VI.Rules as TimeGrain
import qualified Duckling.Time.VI.Rules as Time
rules :: Some Dimension -> [Rule]
rules (This Distance) = []
@ -31,7 +32,7 @@ rules (This PhoneNumber) = []
rules (This Quantity) = []
rules (This RegexMatch) = []
rules (This Temperature) = []
rules (This Time) = []
rules (This Time) = Time.rules
rules (This TimeGrain) = TimeGrain.rules
rules (This Url) = []
rules (This Volume) = []

370
Duckling/Time/VI/Corpus.hs Normal file
View File

@ -0,0 +1,370 @@
-- 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. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE OverloadedStrings #-}
module Duckling.Time.VI.Corpus
( corpus ) where
import Prelude
import Data.String
import Duckling.Lang
import Duckling.Resolve
import Duckling.Time.Corpus
import Duckling.Time.Types hiding (Month, refTime)
import Duckling.TimeGrain.Types hiding (add)
import Duckling.Testing.Types hiding (examples)
corpus :: Corpus
corpus = (context, allExamples)
where
context = testContext
{ lang = VI
, referenceTime = refTime (2017, 2, 2, 3, 55, 0) (-2)
}
allExamples :: [Example]
allExamples = concat
[ examples (datetime (2017, 2, 2, 3, 55, 0) Second)
[ "bây giờ"
, "ngay bây giờ"
, "ngay lúc này"
]
, examples (datetime (2017, 2, 2, 0, 0, 0) Day)
[ "hôm nay"
, "ngày hôm nay"
, "bữa nay"
]
, examples (datetime (2017, 2, 1, 0, 0, 0) Day)
[ "hôm qua"
, "ngày hôm qua"
]
, examples (datetime (2017, 2, 3, 0, 0, 0) Day)
[ "ngày mai"
]
, examples (datetime (2017, 1, 31, 0, 0, 0) Day)
[ "hôm kia"
, "ngày hôm kia"
]
, examples (datetime (2017, 2, 6, 0, 0, 0) Day)
[ "thứ 2"
, "thứ hai"
]
, examples (datetime (2017, 2, 6, 0, 0, 0) Day)
[ "thứ 2 ngày 6 tháng 2"
, "thứ 2 mồng 6 tháng 2"
, "thứ hai ngày 6 tháng 2"
]
, examples (datetime (2017, 2, 7, 0, 0, 0) Day)
[ "thứ 3"
, "thứ ba"
]
, examples (datetime (2017, 2, 5, 0, 0, 0) Day)
[ "chủ nhật"
]
, examples (datetime (2017, 6, 0, 0, 0, 0) Month)
[ "tháng 6"
, "tháng sáu"
]
, examples (datetime (2017, 3, 1, 0, 0, 0) Day)
[ "ngày đầu tiên của tháng ba"
, "ngày đầu tiên của tháng 3"
]
, examples (datetime (2017, 3, 3, 0, 0, 0) Day)
[ "mồng 3 tháng ba"
, "mồng 3 tháng 3"
]
, examples (datetime (2017, 3, 3, 0, 0, 0) Day)
[ "ngày mồng 3 tháng 3 năm 2017"
, "ngày 3 tháng 3 năm 2017"
, "3/3/2017"
, "3/3/17"
, "03/03/2017"
]
, examples (datetime (2017, 3, 7, 0, 0, 0) Day)
[ "ngày mồng 7 tháng 3"
, "ngày 7 tháng ba"
, "7/3"
, "07/03"
]
, examples (datetime (2017, 10, 0, 0, 0, 0) Month)
[ "tháng 10 năm 2017"
, "tháng mười năm 2017"
]
, examples (datetime (1991, 9, 3, 0, 0, 0) Day)
[ "03/09/1991"
, "3/9/91"
, "3/9/1991"
]
, examples (datetime (2017, 10, 12, 0, 0, 0) Day)
[ "12 tháng 10 năm 2017"
, "ngày 12 tháng 10 năm 2017"
]
, examples (datetime (2017, 2, 9, 0, 0, 0) Day)
[ "thứ năm tuần tới"
, "thứ 5 tuần sau"
]
, examples (datetime (2017, 3, 0, 0, 0, 0) Month)
[ "tháng 3 tới"
]
, examples (datetime (2017, 4, 9, 0, 0, 0) Day)
[ "chủ nhật ngày mồng 9 tháng 4"
, "chủ nhật ngày 9 tháng 4"
]
, examples (datetime (2017, 2, 6, 0, 0, 0) Day)
[ "thứ 2 ngày 6 tháng 2"
, "thứ 2 ngày mồng 6 tháng 2"
, "thứ hai ngày mồng 6 tháng 2"
]
, examples (datetime (2018, 4, 3, 0, 0, 0) Day)
[ "thứ 3 ngày 3 tháng 4 năm 2018"
]
, examples (datetime (2017, 1, 30, 0, 0, 0) Week)
[ "tuần này"
]
, examples (datetime (2017, 1, 23, 0, 0, 0) Week)
[ "tuần trước"
]
, examples (datetime (2017, 2, 6, 0, 0, 0) Week)
[ "tuần sau"
]
, examples (datetime (2017, 1, 0, 0, 0, 0) Month)
[ "tháng trước"
]
, examples (datetime (2017, 3, 0, 0, 0, 0) Month)
[ "tháng sau"
]
, examples (datetime (2017, 1, 1, 0, 0, 0) Quarter)
[ "quý này"
]
, examples (datetime (2017, 4, 1, 0, 0, 0) Quarter)
[ "quý sau"
]
, examples (datetime (2017, 7, 1, 0, 0, 0) Quarter)
[ "quý 3"
, "quý ba"
]
, examples (datetime (2018, 10, 1, 0, 0, 0) Quarter)
[ "quý 4 năm 2018"
]
, examples (datetime (2016, 0, 0, 0, 0, 0) Year)
[ "năm trước"
, "năm ngoái"
]
, examples (datetime (2017, 0, 0, 0, 0, 0) Year)
[ "năm nay"
]
, examples (datetime (2018, 0, 0, 0, 0, 0) Year)
[ "năm sau"
]
, examples (datetime (2017, 1, 1, 0, 0, 0) Quarter)
[ "quý này"
, "quý nay"
, "quý hiện tại"
]
, examples (datetime (2017, 4, 1, 0, 0, 0) Quarter)
[ "quý tới"
, "quý tiếp"
]
, examples (datetime (2017, 7, 1, 0, 0, 0) Quarter)
[ "quý ba"
, "quý 3"
]
, examples (datetime (2018, 10, 1, 0, 0, 0) Quarter)
[ "quý 4 của năm 2018"
]
, examples (datetime (2016, 0, 0, 0, 0, 0) Year)
[ "năm ngoái"
, "năm trước"
]
, examples (datetime (2017, 0, 0, 0, 0, 0) Year)
[ "năm nay"
]
, examples (datetime (2018, 0, 0, 0, 0, 0) Year)
[ "năm tiếp theo"
, "năm kế tiếp"
, "năm tới"
]
, examples (datetime (2017, 1, 31, 0, 0, 0) Day)
[ "thứ ba vừa rồi"
]
, examples (datetime (2017, 2, 7, 0, 0, 0) Day)
[ "thứ ba tới"
]
, examples (datetime (2017, 2, 3, 0, 0, 0) Day)
[ "thứ sáu tới"
]
, examples (datetime (2017, 2, 8, 0, 0, 0) Day)
[ "thứ tư tuần tới"
, "thứ tư của tuần tới"
]
, examples (datetime (2017, 2, 3, 0, 0, 0) Day)
[ "thứ sáu tuần này"
, "thứ 6 tuần này"
, "thứ 6 của tuần này"
]
, examples (datetime (2017, 2, 2, 0, 0, 0) Day)
[ "thứ năm tuần này"
, "thứ 5 của tuần này"
]
, examples (datetime (2017, 9, 4, 0, 0, 0) Week)
[ "tuần đầu tiên của tháng 9 năm 2017"
]
, examples (datetime (2017, 2, 3, 2, 0, 0) Hour)
[ "vào lúc 2 giờ sáng"
, "lúc 2 giờ sáng"
]
, examples (datetime (2017, 2, 3, 1, 18, 0) Minute)
[ "1:18 sáng"
]
, examples (datetime (2017, 2, 2, 15, 0, 0) Hour)
[ "lúc 3 giờ tối"
, "vào lúc 3 giờ chiều"
, "vào đúng 3 giờ chiều"
]
, examples (datetime (2017, 2, 2, 15, 0, 0) Hour)
[ "vào khoảng 3 giờ chiều"
, "khoảng 3 giờ chiều"
]
, examples (datetime (2017, 2, 2, 15, 30, 0) Minute)
[ "3 giờ rưỡi chiều"
, "3:30 chiều"
, "ba giờ rưỡi chiều"
]
, examples (datetime (2017, 2, 2, 14, 30, 0) Minute)
[ "2:30"
, "hai giờ rưỡi"
]
, examples (datetime (2017, 2, 2, 15, 23, 24) Second)
[ "15:23:24"
]
, examples (datetime (2017, 2, 2, 10, 45, 0) Minute)
[ "11 giờ kém 15"
, "10 giờ 45 phút"
, "10:45"
, "10 giờ 45"
, "10h45"
, "10g45"
]
, examples (datetime (2017, 2, 2, 20, 0, 0) Hour)
[ "8 giờ tối nay"
]
, examples (datetime (2017, 4, 20, 19, 30, 0) Minute)
[ "vào lúc 7:30 chiều ngày 20 tháng 4 năm 2017"
, "7:30 chiều ngày 20/4/2017"
]
, examples (datetimeInterval ((2017, 6, 21, 0, 0, 0), (2017, 9, 24, 0, 0, 0)) Day)
[ "mùa hè này"
, "mùa hè năm nay"
]
, examples (datetimeInterval ((2016, 12, 21, 0, 0, 0), (2017, 3, 21, 0, 0, 0)) Day)
[ "mùa đông này"
]
, examples (datetimeInterval ((2017, 2, 2, 18, 0, 0), (2017, 2, 3, 0, 0, 0)) Hour)
[ "tối nay"
, "tối hôm nay"
]
, examples (datetimeInterval ((2017, 2, 3, 18, 0, 0), (2017, 2, 4, 0, 0, 0)) Hour)
[ "tối mai"
, "tối ngày mai"
]
, examples (datetimeInterval ((2017, 2, 3, 12, 0, 0), (2017, 2, 3, 14, 0, 0)) Hour)
[ "trưa mai"
, "trưa ngày mai"
]
, examples (datetimeInterval ((2017, 2, 1, 18, 0, 0), (2017, 2, 2, 0, 0, 0)) Hour)
[ "tối qua"
, "tối hôm qua"
]
, examples (datetimeInterval ((2017, 2, 5, 4, 0, 0), (2017, 2, 5, 12, 0, 0)) Hour)
[ "sáng chủ nhật"
]
, examples (datetimeInterval ((2017, 2, 2, 3, 54, 58), (2017, 2, 2, 3, 55, 0)) Second)
[ "2 giây vừa rồi"
]
, examples (datetimeInterval ((2017, 2, 2, 3, 55, 1), (2017, 2, 2, 3, 55, 4)) Second)
[ "3 giây tới"
, "3 giây tiếp theo"
, "3 s tiếp theo"
]
, examples (datetimeInterval ((2017, 2, 2, 3, 53, 0), (2017, 2, 2, 3, 55, 0)) Minute)
[ "2 phút vừa rồi"
]
, examples (datetimeInterval ((2017, 2, 2, 3, 56, 0), (2017, 2, 2, 3, 59, 0)) Minute)
[ "3 phút tới"
, "3 phút tiếp theo"
]
, examples (datetimeInterval ((2017, 2, 2, 2, 0, 0), (2017, 2, 2, 3, 0, 0)) Hour)
[ "một tiếng vừa rồi"
, "1 giờ vừa qua"
]
, examples (datetimeInterval ((2017, 2, 2, 4, 0, 0), (2017, 2, 2, 7, 0, 0)) Hour)
[ "3 tiếng tiếp theo"
, "3 giờ tới"
]
, examples (datetimeInterval ((2017, 1, 31, 0, 0, 0), (2017, 2, 2, 0, 0, 0)) Day)
[ "2 ngày vừa rồi"
, "2 ngày vừa qua"
]
, examples (datetimeInterval ((2017, 2, 3, 0, 0, 0), (2017, 2, 6, 0, 0, 0)) Day)
[ "3 ngày tới"
, "3 ngày tiếp theo"
]
, examples (datetimeInterval ((2016, 12, 0, 0, 0, 0), (2017, 2, 0, 0, 0, 0)) Month)
[ "2 tháng vừa rồi"
, "2 tháng qua"
]
, examples (datetimeInterval ((2017, 3, 0, 0, 0, 0), (2017, 6, 0, 0, 0, 0)) Month)
[ "3 tháng tới"
, "ba tháng tiếp theo"
]
, examples (datetimeInterval ((2015, 0, 0, 0, 0, 0), (2017, 0, 0, 0, 0, 0)) Year)
[ "2 năm vừa rồi"
]
, examples (datetimeInterval ((2018, 0, 0, 0, 0, 0), (2021, 0, 0, 0, 0, 0)) Year)
[ "3 năm tới"
, "3 năm tiếp theo"
]
, examples (datetime (2017, 2, 2, 13, 0, 0) Minute)
[ "4pm CET"
]
, examples (datetime (2017, 2, 2, 14, 0, 0) Hour)
[ "hôm nay lúc 2 giờ chiều"
, "lúc 2 giờ chiều"
]
, examples (datetime (2017, 4, 23, 16, 0, 0) Minute)
[ "lúc 4:00 chiều ngày 23/4"
]
, examples (datetime (2017, 4, 23, 16, 0, 0) Hour)
[ "lúc 4 giờ chiều ngày 23 tháng 4"
]
, examples (datetime (2017, 2, 3, 15, 0, 0) Hour)
[ "3 giờ chiều ngày mai"
]
, examples (datetime (2017, 2, 2, 13, 30, 0) Minute)
[ "lúc 1:30 chiều"
, "lúc 1 giờ 30 chiều"
]
, examples (datetimeInterval ((2017, 2, 2, 13, 0, 0), (2017, 2, 2, 17, 0, 0)) Hour)
[ "sau bữa trưa"
]
, examples (datetime (2017, 2, 2, 10, 30, 0) Minute)
[ "10:30"
]
, examples (datetimeInterval ((2017, 2, 2, 4, 0, 0), (2017, 2, 2, 12, 0, 0)) Hour)
[ "buổi sáng nay"
]
, examples (datetime (2017, 2, 6, 0, 0, 0) Day)
[ "thứ hai tới"
, "thứ 2 tới"
]
, examples (datetime (2017, 4, 0, 0, 0, 0) Month)
[ "tháng 4"
, "tháng tư"
]
]

1211
Duckling/Time/VI/Rules.hs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -402,6 +402,8 @@ library
, Duckling.Time.RO.Rules
, Duckling.Time.SV.Corpus
, Duckling.Time.SV.Rules
, Duckling.Time.VI.Corpus
, Duckling.Time.VI.Rules
, Duckling.Time.ZH.Corpus
, Duckling.Time.ZH.Rules
, Duckling.Time.Corpus
@ -652,6 +654,7 @@ test-suite duckling-test
, Duckling.Time.PT.Tests
, Duckling.Time.RO.Tests
, Duckling.Time.SV.Tests
, Duckling.Time.VI.Tests
, Duckling.Time.ZH.Tests
, Duckling.Time.Tests

View File

@ -40,6 +40,7 @@ import qualified Duckling.Time.PL.Corpus as PLTime
import qualified Duckling.Time.PT.Corpus as PTTime
import qualified Duckling.Time.RO.Corpus as ROTime
import qualified Duckling.Time.SV.Corpus as SVTime
import qualified Duckling.Time.VI.Corpus as VITime
import qualified Duckling.Time.ZH.Corpus as ZHTime
-- -----------------------------------------------------------------
@ -90,7 +91,7 @@ regenClassifiers lang = do
SV -> SVTime.corpus
TR -> (testContext, [])
UK -> (testContext, [])
VI -> (testContext, [])
VI -> VITime.corpus
ZH -> ZHTime.corpus
-- Data structure for the module

View File

@ -38,6 +38,7 @@ import qualified Duckling.Time.PL.Tests as PL
import qualified Duckling.Time.PT.Tests as PT
import qualified Duckling.Time.RO.Tests as RO
import qualified Duckling.Time.SV.Tests as SV
import qualified Duckling.Time.VI.Tests as VI
import qualified Duckling.Time.ZH.Tests as ZH
tests :: TestTree
@ -56,6 +57,7 @@ tests = testGroup "Time Tests"
, PT.tests
, RO.tests
, SV.tests
, VI.tests
, ZH.tests
, timeFormatTest
, timeIntersectTest

View File

@ -0,0 +1,22 @@
-- 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. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
module Duckling.Time.VI.Tests
( tests ) where
import Data.String
import Prelude
import Test.Tasty
import Duckling.Dimensions.Types
import Duckling.Time.VI.Corpus
import Duckling.Testing.Asserts
tests :: TestTree
tests = testGroup "VI Tests"
[ makeCorpusTest [This Time] corpus
]