Norwegian improvements (#232)

Summary:
Some small improvements to the Norwegian implementation:

- The written number 8 had a typo: "otte" -> "åtte"
- Add support for half an hour before as e.g. "halv to"
- Add support for alternative clock denotation "klokka"
- Add support for alternative tomorrow denotation "i morra"
Pull Request resolved: https://github.com/facebook/duckling/pull/232

Reviewed By: girifb

Differential Revision: D8986441

Pulled By: chinmay87

fbshipit-source-id: 286617d30415febe1f0eda4bc7475ca5c9610734
This commit is contained in:
jfulse 2018-07-25 13:01:00 -07:00 committed by Facebook Github Bot
parent 8e658b2e27
commit e1088c1856
4 changed files with 316 additions and 270 deletions

View File

@ -208,7 +208,7 @@ zeroToNineteenMap = HashMap.fromList
, ( "seks" , 6 )
, ( "sju" , 7 )
, ( "syv" , 7 )
, ( "otte" , 8 )
, ( "åtte" , 8 )
, ( "ni" , 9 )
, ( "ti" , 10 )
, ( "elleve" , 11 )

View File

@ -23,31 +23,32 @@ classifiers
= HashMap.fromList
[("L\248rdag",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
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}}),
("<time> timezone",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.4657359027997265,
ClassData{prior = 0.0, unseen = -3.7376696182833684,
likelihoods =
HashMap.fromList
[("at <time-of-day>", -1.488077055429833),
("<time-of-day> o'clock", -2.740840023925201),
("hh:mm", -1.488077055429833), ("hour", -2.0476928433652555),
("minute", -1.0360919316867756)],
n = 13},
[("at <time-of-day>", -1.410986973710262),
("<time-of-day> o'clock", -3.0204248861443626),
("hh:mm", -1.5163474893680884), ("hour", -2.1041341542702074),
("minute", -1.0055218656020977)],
n = 18},
koData =
ClassData{prior = -infinity, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [], n = 0}}),
("integer (numeric)",
Classifier{okData =
ClassData{prior = -0.7905213445851217, unseen = -4.897839799950911,
likelihoods = HashMap.fromList [("", 0.0)], n = 132},
ClassData{prior = -0.7625566319321131,
unseen = -5.0875963352323845,
likelihoods = HashMap.fromList [("", 0.0)], n = 160},
koData =
ClassData{prior = -0.6044190649512611, unseen = -5.081404364984463,
likelihoods = HashMap.fromList [("", 0.0)], n = 159}}),
ClassData{prior = -0.6282442943245189, unseen = -5.220355825078324,
likelihoods = HashMap.fromList [("", 0.0)], n = 183}}),
("the day before yesterday",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
@ -64,8 +65,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("lunch",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
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}}),
@ -78,61 +79,61 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("<time> <part-of-day>",
Classifier{okData =
ClassData{prior = -0.5596157879354228, unseen = -2.772588722239781,
ClassData{prior = -0.45198512374305727,
unseen = -3.0910424533583156,
likelihoods =
HashMap.fromList
[("dayhour", -1.0986122886681098),
("tomorrowevening", -2.0149030205422647),
("tomorrowlunch", -2.0149030205422647),
("yesterdayevening", -2.0149030205422647),
("Mandagmorning", -2.0149030205422647)],
n = 4},
[("dayhour", -0.9650808960435872),
("tomorrowevening", -1.9459101490553135),
("tomorrowlunch", -1.9459101490553135),
("yesterdayevening", -2.3513752571634776),
("Mandagmorning", -1.9459101490553135)],
n = 7},
koData =
ClassData{prior = -0.8472978603872037, unseen = -2.639057329615259,
ClassData{prior = -1.0116009116784799, unseen = -2.772588722239781,
likelihoods =
HashMap.fromList
[("yearhour", -1.1786549963416462),
[("yearhour", -1.0986122886681098),
("year (latent)in|during the <part-of-day>",
-1.1786549963416462)],
n = 3}}),
-1.0986122886681098)],
n = 4}}),
("dd/mm",
Classifier{okData =
ClassData{prior = -0.5108256237659907,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
ClassData{prior = -0.40546510810816444,
unseen = -2.3025850929940455,
likelihoods = HashMap.fromList [("", 0.0)], n = 8},
koData =
ClassData{prior = -0.916290731874155, unseen = -1.791759469228055,
ClassData{prior = -1.0986122886681098, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
("today",
Classifier{okData =
ClassData{prior = -0.2876820724517809,
unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
ClassData{prior = -0.2231435513142097, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
koData =
ClassData{prior = -1.3862943611198906,
ClassData{prior = -1.6094379124341003,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("at <time-of-day>",
Classifier{okData =
ClassData{prior = -0.2776317365982795, unseen = -4.68213122712422,
ClassData{prior = -0.2488960474166244,
unseen = -5.2574953720277815,
likelihoods =
HashMap.fromList
[("<time> timezone", -3.0633909220278057),
("time-of-day (latent)", -1.3055330044754323),
[("<time> timezone", -3.3063632789913164),
("time-of-day (latent)", -1.244940242814159),
("relative minutes after|past <integer> (hour-of-day)",
-3.5742165457937967),
("hh:mm", -1.9647786333596962),
("<time-of-day> sharp", -3.5742165457937967),
("hour", -1.23884162997676), ("minute", -1.6283063967384832)],
n = 50},
-3.865979066926739),
("hh:mm", -2.074219597698684),
("<time-of-day> sharp", -3.3063632789913164),
("hour", -1.1413995638733185), ("minute", -1.7557658665801497)],
n = 92},
koData =
ClassData{prior = -1.4170660197866443,
unseen = -3.6888794541139363,
ClassData{prior = -1.5125880864441827, unseen = -4.0943445622221,
likelihoods =
HashMap.fromList
[("time-of-day (latent)", -0.8303483020734304),
("hour", -0.8303483020734304)],
n = 16}}),
[("time-of-day (latent)", -0.7817005779013904),
("hour", -0.7817005779013904)],
n = 26}}),
("absorption of , after named day",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.1354942159291497,
@ -163,20 +164,22 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("on <date>",
Classifier{okData =
ClassData{prior = -0.3313571359544425, unseen = -4.219507705176107,
ClassData{prior = -0.32158362412746233,
unseen = -4.248495242049359,
likelihoods =
HashMap.fromList
[("L\248rdag", -3.5115454388310208),
("on <date>", -3.5115454388310208),
("Mandag", -3.5115454388310208), ("Torsdag", -2.12525107771113),
("the <day-of-month> (non ordinal)", -3.1060803307228566),
("<day-of-month>(ordinal) <named-month>", -2.2587824703356527),
("day", -0.8373967894044921),
("the <day-of-month> (ordinal)", -3.5115454388310208),
("<day-of-month> (ordinal)", -1.9021075263969205)],
n = 28},
[("L\248rdag", -3.1354942159291497),
("on <date>", -3.5409593240373143),
("Mandag", -3.5409593240373143),
("Torsdag", -2.1546649629174235),
("the <day-of-month> (non ordinal)", -3.1354942159291497),
("<day-of-month>(ordinal) <named-month>", -2.2881963555419462),
("day", -0.832909122935104),
("the <day-of-month> (ordinal)", -3.5409593240373143),
("<day-of-month> (ordinal)", -1.9315214116032136)],
n = 29},
koData =
ClassData{prior = -1.2656663733312759,
ClassData{prior = -1.2909841813155656,
unseen = -3.5263605246161616,
likelihoods =
HashMap.fromList
@ -302,138 +305,139 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.38853604600771635,
unseen = -5.883322388488279,
ClassData{prior = -0.34574587340654206,
unseen = -6.1070228877422545,
likelihoods =
HashMap.fromList
[("Onsdagthis <cycle>", -5.187385805840755),
("Torsdag<time> timezone", -3.934622837345387),
[("Onsdagthis <cycle>", -5.4116460518550396),
("Torsdag<time> timezone", -3.907568655078766),
("<datetime> - <datetime> (interval)on <date>",
-4.088773517172645),
-4.31303376318693),
("<time-of-day> - <time-of-day> (interval)on <date>",
-4.088773517172645),
("hourday", -5.187385805840755), ("dayhour", -2.93609400723426),
("daymonth", -2.93609400723426),
("monthyear", -3.107944264160919),
-4.31303376318693),
("hourday", -5.006180943746876),
("dayhour", -2.2335922215070942),
("daymonth", -3.1603542532485447),
("monthyear", -3.332204510175204),
("Torsdagbetween <time-of-day> and <time-of-day> (interval)",
-5.187385805840755),
("Mandagon <date>", -4.78192069773259),
("intersecthh:mm", -5.187385805840755),
-5.4116460518550396),
("Mandagon <date>", -5.006180943746876),
("intersecthh:mm", -5.4116460518550396),
("Torsdagbetween <datetime> and <datetime> (interval)",
-5.187385805840755),
("Torsdagat <time-of-day>", -4.2710950739666),
("on <date>Februar", -4.78192069773259),
("Marsyear", -4.78192069773259),
-5.4116460518550396),
("Torsdagat <time-of-day>", -4.1588830833596715),
("on <date>Februar", -5.006180943746876),
("Marsyear", -5.006180943746876),
("intersect by \"of\", \"from\", \"'s\"year",
-4.78192069773259),
("Oktoberyear", -3.577947893406655),
-5.006180943746876),
("Oktoberyear", -3.8022081394209395),
("Torsdagfrom <time-of-day> - <time-of-day> (interval)",
-4.78192069773259),
-5.006180943746876),
("Torsdagfrom <datetime> - <datetime> (interval)",
-4.78192069773259),
("Mandagintersect", -4.78192069773259),
("last <day-of-week> of <time>year", -4.78192069773259),
("intersectFebruar", -4.78192069773259),
("todayat <time-of-day>", -4.78192069773259),
("dayday", -3.047319642344484),
("dd/mmat <time-of-day>", -4.2710950739666),
("intersect by \",\"hh:mm", -4.2710950739666),
("dayyear", -3.4826377136023297),
("tomorrow<time-of-day> sharp", -4.78192069773259),
-5.006180943746876),
("Mandagintersect", -5.006180943746876),
("last <day-of-week> of <time>year", -5.006180943746876),
("intersectFebruar", -5.006180943746876),
("todayat <time-of-day>", -4.718498871295094),
("dayday", -3.2715798883587692),
("dd/mmat <time-of-day>", -4.1588830833596715),
("intersect by \",\"hh:mm", -4.4953553199808844),
("dayyear", -3.7068979596166147),
("tomorrow<time-of-day> sharp", -4.1588830833596715),
("<day-of-month>(ordinal) <named-month>year",
-4.78192069773259),
-5.006180943746876),
("Onsdag<named-month> <day-of-month> (non ordinal)",
-5.187385805840755),
("Onsdagthis <time>", -4.4942386252808095),
-5.4116460518550396),
("Onsdagthis <time>", -4.718498871295094),
("absorption of , after named day<named-month> <day-of-month> (non ordinal)",
-4.088773517172645),
("tomorrowuntil <time-of-day>", -4.78192069773259),
-4.31303376318693),
("tomorrowuntil <time-of-day>", -4.1588830833596715),
("S\248ndag<day-of-month> (non ordinal) <named-month>",
-5.187385805840755),
-5.4116460518550396),
("absorption of , after named day<day-of-month> (non ordinal) <named-month>",
-4.4942386252808095),
("the <day-of-month> (ordinal)Februar", -4.78192069773259),
("after <time-of-day>at <time-of-day>", -4.78192069773259),
("the <day-of-month> (ordinal)Mars", -4.2710950739666),
-4.718498871295094),
("the <day-of-month> (ordinal)Februar", -5.006180943746876),
("after <time-of-day>at <time-of-day>", -4.1588830833596715),
("the <day-of-month> (ordinal)Mars", -4.4953553199808844),
("intersect by \",\"<day-of-month> (non ordinal) <named-month>",
-4.78192069773259),
("Mandagthe <day-of-month> (ordinal)", -5.187385805840755),
("Mandagthis <cycle>", -5.187385805840755),
("Tirsdagthis <time>", -4.78192069773259),
("tomorrowafter <time-of-day>", -4.78192069773259),
("Tirsdagthis <cycle>", -5.187385805840755),
-5.006180943746876),
("Mandagthe <day-of-month> (ordinal)", -5.4116460518550396),
("Mandagthis <cycle>", -5.4116460518550396),
("Tirsdagthis <time>", -5.006180943746876),
("tomorrowafter <time-of-day>", -4.1588830833596715),
("Tirsdagthis <cycle>", -5.4116460518550396),
("from <time-of-day> - <time-of-day> (interval)on <date>",
-4.2710950739666),
("dayminute", -2.622436448379218),
-4.4953553199808844),
("dayminute", -2.639057329615259),
("from <datetime> - <datetime> (interval)on <date>",
-4.4942386252808095),
("on <date>Mars", -4.2710950739666),
("<ordinal> <cycle> of <time>year", -4.78192069773259),
("minuteday", -2.584696120396371),
-4.718498871295094),
("on <date>Mars", -4.4953553199808844),
("<ordinal> <cycle> of <time>year", -5.006180943746876),
("minuteday", -2.521274293958875),
("absorption of , after named dayintersect",
-5.187385805840755),
("yearhh:mm", -5.187385805840755),
("Onsdagnext <cycle>", -5.187385805840755),
-5.4116460518550396),
("yearhh:mm", -5.4116460518550396),
("Onsdagnext <cycle>", -5.4116460518550396),
("absorption of , after named dayintersect by \",\"",
-4.78192069773259),
("Septemberyear", -4.2710950739666),
("at <time-of-day>on <date>", -5.187385805840755),
-5.006180943746876),
("Septemberyear", -4.4953553199808844),
("at <time-of-day>on <date>", -5.006180943746876),
("between <time-of-day> and <time-of-day> (interval)on <date>",
-5.187385805840755),
-5.4116460518550396),
("between <datetime> and <datetime> (interval)on <date>",
-5.187385805840755),
("dayweek", -4.088773517172645), ("weekyear", -4.2710950739666),
("hh:mmtomorrow", -4.4942386252808095),
("tomorrowat <time-of-day>", -3.934622837345387),
("at <time-of-day>tomorrow", -4.78192069773259),
("last <cycle> of <time>year", -4.2710950739666),
-5.4116460518550396),
("dayweek", -4.31303376318693),
("weekyear", -4.4953553199808844),
("hh:mmtomorrow", -3.907568655078766),
("tomorrowat <time-of-day>", -3.1603542532485447),
("at <time-of-day>tomorrow", -4.1588830833596715),
("last <cycle> of <time>year", -4.4953553199808844),
("<day-of-month> (non ordinal) <named-month>year",
-4.78192069773259),
("yearminute", -5.187385805840755)],
n = 139},
-5.006180943746876),
("yearminute", -5.4116460518550396)],
n = 184},
koData =
ClassData{prior = -1.1333552371119826,
unseen = -5.3612921657094255,
ClassData{prior = -1.2299482907291965, unseen = -5.4510384535657,
likelihoods =
HashMap.fromList
[("dayhour", -2.9586910018736416),
("daymonth", -2.2210920587428626),
("monthyear", -3.747148362237912),
[("dayhour", -2.6741486494265287),
("daymonth", -2.31124315573716),
("monthyear", -3.8372994592322094),
("Torsdagbetween <time-of-day> and <time-of-day> (interval)",
-4.663439094112067),
("Mandagon <date>", -4.663439094112067),
-4.7535901911063645),
("Mandagon <date>", -4.7535901911063645),
("Torsdagbetween <datetime> and <datetime> (interval)",
-4.663439094112067),
("Torsdagat <time-of-day>", -3.159361697335793),
("absorption of , after named dayFebruar", -3.970291913552122),
("Marsyear", -3.970291913552122),
-4.7535901911063645),
("Torsdagat <time-of-day>", -2.881788014204773),
("absorption of , after named dayFebruar", -4.060443010546419),
("Marsyear", -4.060443010546419),
("intersect by \"of\", \"from\", \"'s\"year",
-3.4106761256166993),
-3.5008272226109964),
("Torsdagfrom <time-of-day> - <time-of-day> (interval)",
-4.663439094112067),
-4.7535901911063645),
("Torsdagfrom <datetime> - <datetime> (interval)",
-4.663439094112067),
("OnsdagFebruar", -4.663439094112067),
("absorption of , after named dayJuli", -4.257973986003902),
("dd/mmat <time-of-day>", -3.747148362237912),
("hourhour", -3.4106761256166993),
("dayyear", -3.4106761256166993),
("Onsdagthis <time>", -3.4106761256166993),
-4.7535901911063645),
("OnsdagFebruar", -4.7535901911063645),
("absorption of , after named dayJuli", -4.3481250829982),
("dd/mmat <time-of-day>", -3.5008272226109964),
("hourhour", -3.144152278672264),
("dayyear", -3.5008272226109964),
("Onsdagthis <time>", -3.5008272226109964),
("in|during the <part-of-day>until <time-of-day>",
-4.257973986003902),
("Aprilyear", -4.663439094112067),
("Tirsdagthis <time>", -3.747148362237912),
("until <time-of-day>on <date>", -4.663439094112067),
("Torsdaghh:mm", -4.257973986003902),
("dayminute", -2.9586910018736416),
("minuteday", -3.159361697335793),
("hh:mmon <date>", -3.2771447329921766),
("this <part-of-day>until <time-of-day>", -4.257973986003902),
("S\248ndagthis <time>", -3.747148362237912),
("tomorrownoon", -4.663439094112067),
("this <time>until <time-of-day>", -4.257973986003902),
("Mandagthis <time>", -4.257973986003902)],
n = 66}}),
-4.060443010546419),
("Aprilyear", -4.7535901911063645),
("Tirsdagthis <time>", -3.8372994592322094),
("until <time-of-day>on <date>", -4.7535901911063645),
("Torsdaghh:mm", -4.3481250829982),
("dayminute", -2.881788014204773),
("minuteday", -3.2495127943300903),
("hh:mmon <date>", -3.367295829986474),
("this <part-of-day>until <time-of-day>", -4.060443010546419),
("S\248ndagthis <time>", -3.8372994592322094),
("tomorrownoon", -4.3481250829982),
("this <time>until <time-of-day>", -4.060443010546419),
("Mandagthis <time>", -4.3481250829982)],
n = 76}}),
("<ordinal> <cycle> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.890371757896165,
@ -540,13 +544,13 @@ classifiers
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
ClassData{prior = 0.0, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
n = 3}}),
n = 4}}),
("Mandag",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.639057329615259,
likelihoods = HashMap.fromList [("", 0.0)], n = 12},
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}}),
@ -593,8 +597,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("Torsdag",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.044522437723423,
likelihoods = HashMap.fromList [("", 0.0)], n = 19},
ClassData{prior = 0.0, unseen = -3.1354942159291497,
likelihoods = HashMap.fromList [("", 0.0)], n = 21},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -689,21 +693,19 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
("this <part-of-day>",
Classifier{okData =
ClassData{prior = -1.9459101490553135,
unseen = -2.0794415416798357,
ClassData{prior = -1.845826690498331, unseen = -2.3025850929940455,
likelihoods =
HashMap.fromList
[("hour", -0.8472978603872037), ("evening", -1.252762968495368),
("morning", -1.252762968495368)],
n = 2},
[("hour", -0.8109302162163288), ("evening", -1.5040773967762742),
("morning", -1.0986122886681098)],
n = 3},
koData =
ClassData{prior = -0.15415067982725836,
unseen = -3.332204510175204,
ClassData{prior = -0.17185025692665928, unseen = -3.58351893845611,
likelihoods =
HashMap.fromList
[("hour", -0.7308875085427924),
("morning", -0.7308875085427924)],
n = 12}}),
[("hour", -0.7221347174331976),
("morning", -0.7221347174331976)],
n = 16}}),
("christmas eve",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,
@ -735,12 +737,12 @@ classifiers
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -3.2188758248682006,
ClassData{prior = 0.0, unseen = -3.258096538021482,
likelihoods = HashMap.fromList [("integer (numeric)", 0.0)],
n = 23}}),
n = 24}}),
("in|during the <part-of-day>",
Classifier{okData =
ClassData{prior = -1.9459101490553135,
ClassData{prior = -2.1972245773362196,
unseen = -2.1972245773362196,
likelihoods =
HashMap.fromList
@ -749,13 +751,12 @@ classifiers
("evening", -1.3862943611198906)],
n = 2},
koData =
ClassData{prior = -0.15415067982725836,
unseen = -3.367295829986474,
ClassData{prior = -0.11778303565638351,
unseen = -3.6109179126442243,
likelihoods =
HashMap.fromList
[("hour", -0.7672551527136672),
("morning", -0.7672551527136672)],
n = 12}}),
[("hour", -0.750305594399894), ("morning", -0.750305594399894)],
n = 16}}),
("new year's eve",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
@ -765,8 +766,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("tomorrow",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.772588722239781,
likelihoods = HashMap.fromList [("", 0.0)], n = 14},
ClassData{prior = 0.0, unseen = -3.6888794541139363,
likelihoods = HashMap.fromList [("", 0.0)], n = 38},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -824,8 +825,8 @@ classifiers
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -2.1972245773362196,
likelihoods = HashMap.fromList [("", 0.0)], n = 7}}),
ClassData{prior = 0.0, unseen = -2.3025850929940455,
likelihoods = HashMap.fromList [("", 0.0)], n = 8}}),
("afternoon",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
@ -877,15 +878,15 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("about <time-of-day>",
Classifier{okData =
ClassData{prior = -0.8472978603872037,
unseen = -2.3978952727983707,
ClassData{prior = -0.6931471805599453,
unseen = -2.5649493574615367,
likelihoods =
HashMap.fromList
[("time-of-day (latent)", -0.916290731874155),
("hour", -0.916290731874155)],
n = 3},
[("time-of-day (latent)", -0.8754687373538999),
("hour", -0.8754687373538999)],
n = 4},
koData =
ClassData{prior = -0.5596157879354228,
ClassData{prior = -0.6931471805599453,
unseen = -2.5649493574615367,
likelihoods =
HashMap.fromList
@ -904,17 +905,18 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("time-of-day (latent)",
Classifier{okData =
ClassData{prior = -0.9267620317414506, unseen = -3.713572066704308,
ClassData{prior = -0.7159618583261167, unseen = -4.219507705176107,
likelihoods =
HashMap.fromList [("integer (numeric)", -2.5317807984289897e-2)],
n = 38},
HashMap.fromList [("integer (numeric)", -1.5037877364540559e-2)],
n = 65},
koData =
ClassData{prior = -0.503905180921417, unseen = -4.110873864173311,
ClassData{prior = -0.6708414230456471,
unseen = -4.2626798770413155,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.2657031657330056),
("integer (0..19)", -1.455287232606842)],
n = 58}}),
[("integer (numeric)", -0.2231435513142097),
("integer (0..19)", -1.6094379124341003)],
n = 68}}),
("year",
Classifier{okData =
ClassData{prior = -0.2231435513142097, unseen = -3.258096538021482,
@ -1003,12 +1005,12 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("relative minutes after|past <integer> (hour-of-day)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
ClassData{prior = 0.0, unseen = -2.1972245773362196,
likelihoods =
HashMap.fromList
[("hour", -0.6931471805599453),
("integer (numeric)time-of-day (latent)", -0.6931471805599453)],
n = 2},
n = 3},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
@ -1094,11 +1096,11 @@ classifiers
n = 5}}),
("hh:mm",
Classifier{okData =
ClassData{prior = -2.0619287202735703e-2,
unseen = -3.912023005428146,
likelihoods = HashMap.fromList [("", 0.0)], n = 48},
ClassData{prior = -1.7094433359300068e-2,
unseen = -4.0943445622221,
likelihoods = HashMap.fromList [("", 0.0)], n = 58},
koData =
ClassData{prior = -3.891820298110627, unseen = -1.0986122886681098,
ClassData{prior = -4.07753744390572, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("quarter after|past <integer> (hour-of-day)",
Classifier{okData =
@ -1120,13 +1122,13 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("<time-of-day> sharp",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.4849066497880004,
ClassData{prior = 0.0, unseen = -3.332204510175204,
likelihoods =
HashMap.fromList
[("at <time-of-day>", -1.2992829841302609),
("time-of-day (latent)", -1.2992829841302609),
("hour", -0.7884573603642702)],
n = 4},
[("at <time-of-day>", -1.349926716949016),
("time-of-day (latent)", -1.349926716949016),
("hour", -0.7308875085427924)],
n = 12},
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [], n = 0}}),
@ -1218,8 +1220,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("the day after tomorrow",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
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}}),
@ -1228,18 +1230,19 @@ classifiers
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}}),
ClassData{prior = 0.0, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
("until <time-of-day>",
Classifier{okData =
ClassData{prior = -0.2876820724517809, unseen = -2.890371757896165,
ClassData{prior = -0.15415067982725836,
unseen = -3.4011973816621555,
likelihoods =
HashMap.fromList
[("at <time-of-day>", -0.8873031950009028),
("hour", -0.8873031950009028)],
n = 6},
[("at <time-of-day>", -0.8023464725249373),
("hour", -0.8023464725249373)],
n = 12},
koData =
ClassData{prior = -1.3862943611198906,
ClassData{prior = -1.9459101490553135,
unseen = -2.3025850929940455,
likelihoods =
HashMap.fromList
@ -1271,8 +1274,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("evening",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3},
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}}),
@ -1592,13 +1595,11 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("morning",
Classifier{okData =
ClassData{prior = -1.9459101490553135,
unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [("", 0.0)], n = 2},
ClassData{prior = -1.6094379124341003, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
koData =
ClassData{prior = -0.15415067982725836,
unseen = -2.639057329615259,
likelihoods = HashMap.fromList [("", 0.0)], n = 12}}),
ClassData{prior = -0.2231435513142097, unseen = -2.890371757896165,
likelihoods = HashMap.fromList [("", 0.0)], n = 16}}),
("week-end",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.0794415416798357,
@ -1608,26 +1609,26 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("after <time-of-day>",
Classifier{okData =
ClassData{prior = -0.7537718023763802, unseen = -3.332204510175204,
ClassData{prior = -0.45198512374305727,
unseen = -3.9889840465642745,
likelihoods =
HashMap.fromList
[("at <time-of-day>", -1.6863989535702288),
("intersect", -2.1972245773362196),
("tomorrow", -2.1972245773362196), ("day", -2.1972245773362196),
("hour", -1.349926716949016)],
n = 8},
[("at <time-of-day>", -1.667706820558076),
("intersect", -2.0243817644968085),
("tomorrow", -2.0243817644968085), ("day", -2.0243817644968085),
("hour", -1.1977031913123406)],
n = 21},
koData =
ClassData{prior = -0.6359887667199967,
unseen = -3.4011973816621555,
ClassData{prior = -1.0116009116784799, unseen = -3.58351893845611,
likelihoods =
HashMap.fromList
[("this <part-of-day>", -2.268683541318364),
("christmas eve", -2.268683541318364),
("in|during the <part-of-day>", -2.268683541318364),
("day", -2.268683541318364), ("hh:mm", -2.6741486494265287),
("hour", -1.4213856809311607), ("minute", -2.6741486494265287),
("this <time>", -2.268683541318364)],
n = 9}}),
[("this <part-of-day>", -2.169053700369523),
("christmas eve", -2.456735772821304),
("in|during the <part-of-day>", -2.169053700369523),
("day", -2.456735772821304), ("hh:mm", -2.8622008809294686),
("hour", -1.252762968495368), ("minute", -2.8622008809294686),
("this <time>", -2.169053700369523)],
n = 12}}),
("day (grain)",
Classifier{okData =
ClassData{prior = -4.8790164169432056e-2,
@ -1659,31 +1660,33 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("this <time>",
Classifier{okData =
ClassData{prior = -1.2443240998495033, unseen = -3.891820298110627,
ClassData{prior = -1.2685113254635072,
unseen = -3.9318256327243257,
likelihoods =
HashMap.fromList
[("week", -3.1780538303479458),
("intersect", -2.772588722239781),
("season", -2.2617630984737906),
("next <cycle>", -3.1780538303479458),
("day", -1.9252908618525775),
("christmas days", -2.772588722239781),
("Oktober", -2.772588722239781), ("hour", -1.9252908618525775),
("evening", -3.1780538303479458),
("month", -2.2617630984737906),
("morning", -3.1780538303479458),
("week-end", -2.2617630984737906)],
n = 17},
[("week", -3.2188758248682006),
("intersect", -2.8134107167600364),
("season", -2.3025850929940455),
("next <cycle>", -3.2188758248682006),
("day", -1.9661128563728327),
("christmas days", -2.8134107167600364),
("Oktober", -2.8134107167600364), ("hour", -1.8325814637483102),
("evening", -3.2188758248682006),
("month", -2.3025850929940455),
("morning", -2.8134107167600364),
("week-end", -2.3025850929940455)],
n = 18},
koData =
ClassData{prior = -0.3398678256223512, unseen = -4.59511985013459,
ClassData{prior = -0.33024168687057687,
unseen = -4.672828834461907,
likelihoods =
HashMap.fromList
[("September", -2.9755295662364714),
("intersect", -2.020018121209035),
("Oktober", -2.187072205872201), ("Mars", -2.9755295662364714),
("hour", -2.020018121209035), ("month", -1.1509802741854256),
("morning", -2.020018121209035)],
n = 42}}),
[("September", -3.054001181677967),
("intersect", -2.0984897366505306),
("Oktober", -2.2655438213136967), ("Mars", -3.054001181677967),
("hour", -1.8302257500558512), ("month", -1.2294518896269209),
("morning", -1.8302257500558512)],
n = 46}}),
("within <duration>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,

View File

@ -38,6 +38,7 @@ allExamples = concat
]
, examples (datetime (2013, 2, 13, 0, 0, 0) Day)
[ "i morgen"
, "i morra"
]
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
[ "mandag"
@ -221,6 +222,7 @@ allExamples = concat
]
, examples (datetime (2013, 2, 14, 0, 0, 0) Day)
[ "i overimorgen"
, "i overimorra"
]
, examples (datetime (2013, 2, 10, 0, 0, 0) Day)
[ "i forigårs"
@ -267,6 +269,7 @@ allExamples = concat
]
, examples (datetime (2013, 2, 13, 3, 0, 0) Hour)
[ "klokken 3"
, "klokka 3"
, "kl. 3"
]
, examples (datetime (2013, 2, 13, 3, 18, 0) Minute)
@ -274,6 +277,7 @@ allExamples = concat
]
, examples (datetime (2013, 2, 12, 15, 0, 0) Hour)
[ "klokken 15"
, "klokka 15"
, "kl. 15"
, "15h"
]
@ -281,10 +285,15 @@ allExamples = concat
[ "ca. kl. 15"
, "cirka kl. 15"
, "omkring klokken 15"
, "omkring klokka 15"
]
, examples (datetime (2013, 2, 13, 17, 0, 0) Hour)
[ "imorgen klokken 17 sharp"
, "imorra klokken 17 sharp"
, "imorgen klokka 17 presis"
, "imorra klokka 17 presis"
, "imorgen kl. 17 presis"
, "imorra kl. 17 presis"
]
, examples (datetime (2013, 2, 12, 15, 15, 0) Minute)
[ "kvarter over 15"
@ -294,6 +303,7 @@ allExamples = concat
, examples (datetime (2013, 2, 12, 15, 20, 0) Minute)
[ "kl. 20 over 15"
, "klokken 20 over 15"
, "klokka 20 over 15"
, "kl. 15:20"
, "15:20"
]
@ -310,6 +320,7 @@ allExamples = concat
]
, examples (datetime (2013, 2, 16, 9, 0, 0) Hour)
[ "klokken 9 på lørdag"
, "klokka 9 på lørdag"
]
, examples (datetime (2014, 7, 18, 19, 0, 0) Minute)
[ "Fre, Jul 18, 2014 19:00"
@ -440,9 +451,11 @@ allExamples = concat
]
, examples (datetimeInterval ((2013, 2, 13, 18, 0, 0), (2013, 2, 14, 0, 0, 0)) Hour)
[ "i morgen kveld"
, "i morra kveld"
]
, examples (datetimeInterval ((2013, 2, 13, 12, 0, 0), (2013, 2, 13, 14, 0, 0)) Hour)
[ "i morgen middag"
, "i morra middag"
]
, examples (datetimeInterval ((2013, 2, 11, 18, 0, 0), (2013, 2, 12, 0, 0, 0)) Hour)
[ "i går kveld"
@ -455,6 +468,7 @@ allExamples = concat
]
, examples (datetimeInterval ((2013, 2, 18, 4, 0, 0), (2013, 2, 18, 12, 0, 0)) Hour)
[ "mandag morgen"
, "mandag morran"
]
, examples (datetimeInterval ((2013, 12, 24, 0, 0, 0), (2013, 12, 31, 0, 0, 0)) Day)
[ "i romjulen"
@ -559,40 +573,54 @@ allExamples = concat
, examples (datetimeOpenInterval Before (2013, 2, 12, 14, 0, 0) Hour)
[ "innen kl. 14"
, "innen klokken 14"
, "innen klokka 14"
]
, examples (datetime (2013, 2, 12, 13, 0, 0) Minute)
[ "16h CET"
, "kl. 16 CET"
, "klokken 16 CET"
, "klokka 16 CET"
]
, examples (datetime (2013, 2, 14, 6, 0, 0) Minute)
[ "torsdag kl. 8:00 GMT"
, "torsdag kl. 8:00 gmt"
, "torsdag klokken 8:00 GMT"
, "torsdag klokka 8:00 GMT"
, "torsdag klokken 8:00 gmt"
, "torsdag klokka 8:00 gmt"
, "torsdag 08:00 GMT"
, "torsdag 08:00 gmt"
]
, examples (datetime (2013, 2, 12, 14, 0, 0) Hour)
[ "idag kl. 14"
, "idag klokken 14"
, "idag klokka 14"
, "kl. 14"
, "klokken 14"
, "klokka 14"
]
, examples (datetime (2013, 4, 25, 16, 0, 0) Minute)
[ "25/4 kl. 16:00"
, "25/4 klokken 16:00"
, "25/4 klokka 16:00"
, "25-04 klokken 16:00"
, "25-04 klokka 16:00"
, "25-4 kl. 16:00"
]
, examples (datetime (2013, 2, 13, 15, 0, 0) Minute)
[ "15:00 i morgen"
, "15:00 i morra"
, "kl. 15:00 i morgen"
, "kl. 15:00 i morra"
, "klokken 15:00 i morgen"
, "klokken 15:00 i morra"
, "klokka 15:00 i morgen"
, "klokka 15:00 i morra"
]
, examples (datetimeOpenInterval After (2013, 2, 12, 14, 0, 0) Hour)
[ "etter kl. 14"
, "etter klokken 14"
, "etter klokka 14"
]
, examples (datetimeOpenInterval After (2013, 2, 17, 4, 0, 0) Hour)
[ "etter 5 dager"
@ -604,17 +632,30 @@ allExamples = concat
]
, examples (datetimeOpenInterval After (2013, 2, 13, 14, 0, 0) Hour)
[ "etter i morgen kl. 14"
, "etter i morra kl. 14"
, "etter i morgen klokken 14"
, "etter i morra klokken 14"
, "etter i morgen klokka 14"
, "etter i morra klokka 14"
, "i morgen etter kl. 14"
, "i morra etter kl. 14"
, "i morgen etter klokken 14"
, "i morra etter klokken 14"
, "i morgen etter klokka 14"
, "i morra etter klokka 14"
]
, examples (datetimeOpenInterval Before (2013, 2, 12, 11, 0, 0) Hour)
[ "før kl. 11"
, "før klokken 11"
, "før klokka 11"
]
, examples (datetimeOpenInterval Before (2013, 2, 13, 11, 0, 0) Hour)
[ "i morgen før kl. 11"
, "i morra før kl. 11"
, "i morgen før klokken 11"
, "i morra før klokken 11"
, "i morgen før klokka 11"
, "i morra før klokka 11"
]
, examples (datetimeInterval ((2013, 2, 12, 12, 0, 0), (2013, 2, 12, 19, 0, 0)) Hour)
[ "om ettermiddagen"
@ -622,6 +663,7 @@ allExamples = concat
, examples (datetime (2013, 2, 12, 13, 30, 0) Minute)
[ "kl. 13:30"
, "klokken 13:30"
, "klokka 13:30"
]
, examples (datetime (2013, 2, 12, 4, 45, 0) Second)
[ "om 15 minutter"
@ -634,6 +676,7 @@ allExamples = concat
]
, examples (datetimeInterval ((2013, 2, 12, 4, 0, 0), (2013, 2, 12, 12, 0, 0)) Hour)
[ "denne morgen"
, "denne morran"
]
, examples (datetime (2013, 2, 18, 0, 0, 0) Day)
[ "neste mandag"

View File

@ -32,7 +32,7 @@ ruleTheDayAfterTomorrow :: Rule
ruleTheDayAfterTomorrow = Rule
{ name = "the day after tomorrow"
, pattern =
[ regex "i overimorgen"
[ regex "i overimorgen|i overimorra"
]
, prod = \_ -> tt $ cycleNth TG.Day 2
}
@ -130,7 +130,7 @@ ruleHalfTotillbeforeIntegerHourofday :: Rule
ruleHalfTotillbeforeIntegerHourofday = Rule
{ name = "half to|till|before <integer> (hour-of-day)"
, pattern =
[ regex "halv time *på"
[ regex "halv time *på|halvtime *på|halv"
, Predicate isAnHourOfDay
]
, prod = \tokens -> case tokens of
@ -782,7 +782,7 @@ ruleExactlyTimeofday :: Rule
ruleExactlyTimeofday = Rule
{ name = "exactly <time-of-day>"
, pattern =
[ regex "presis( kl.| klokken)?"
[ regex "presis( kl.| klokken | klokka)?"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
@ -968,7 +968,7 @@ ruleAboutTimeofday :: Rule
ruleAboutTimeofday = Rule
{ name = "about <time-of-day>"
, pattern =
[ regex "(omkring|cirka|ca\\.)( kl\\.| klokken)?"
[ regex "(omkring|cirka|ca\\.)( kl\\.| klokken | klokka)?"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
@ -993,7 +993,7 @@ ruleAtTimeofday :: Rule
ruleAtTimeofday = Rule
{ name = "at <time-of-day>"
, pattern =
[ regex "klokken|kl.|@"
[ regex "klokken|klokka|kl.|@"
, Predicate isATimeOfDay
]
, prod = \tokens -> case tokens of
@ -1177,7 +1177,7 @@ ruleMorning :: Rule
ruleMorning = Rule
{ name = "morning"
, pattern =
[ regex "morgen(en)?"
[ regex "morgen(en)?|morran"
]
, prod = \_ ->
let from = hour False 4
@ -1596,7 +1596,7 @@ ruleTomorrow :: Rule
ruleTomorrow = Rule
{ name = "tomorrow"
, pattern =
[ regex "i morgen|imorgen"
[ regex "i morgen|imorgen|i morra|imorra"
]
, prod = \_ -> tt $ cycleNth TG.Day 1
}