From 01e39fac7e52688ed13db6ce3b4152a8cca64447 Mon Sep 17 00:00:00 2001 From: Alexis Hope Date: Thu, 19 May 2022 16:19:39 +1000 Subject: [PATCH 1/3] feat: add dimension for kelvin --- Duckling/Ranking/Classifiers/NB_XX.hs | 425 ++++++++++++++------------ Duckling/Ranking/Classifiers/TE_XX.hs | 2 +- Duckling/Temperature/EN/Corpus.hs | 12 +- Duckling/Temperature/EN/Rules.hs | 14 + Duckling/Temperature/Types.hs | 2 +- 5 files changed, 255 insertions(+), 200 deletions(-) diff --git a/Duckling/Ranking/Classifiers/NB_XX.hs b/Duckling/Ranking/Classifiers/NB_XX.hs index 3dd0e906d..83e8e28b7 100644 --- a/Duckling/Ranking/Classifiers/NB_XX.hs +++ b/Duckling/Ranking/Classifiers/NB_XX.hs @@ -43,11 +43,11 @@ classifiers likelihoods = HashMap.fromList [], n = 0}}), ("integer (numeric)", Classifier{okData = - ClassData{prior = -0.7378640193417415, unseen = -5.111987788356543, - likelihoods = HashMap.fromList [("", 0.0)], n = 164}, + ClassData{prior = -0.8446970786871463, unseen = -5.117993812416755, + likelihoods = HashMap.fromList [("", 0.0)], n = 165}, koData = - ClassData{prior = -0.650344641325185, unseen = -5.198497031265826, - likelihoods = HashMap.fromList [("", 0.0)], n = 179}}), + ClassData{prior = -0.561570822771226, unseen = -5.3981627015177525, + likelihoods = HashMap.fromList [("", 0.0)], n = 219}}), ("the day before yesterday", Classifier{okData = ClassData{prior = 0.0, unseen = -1.0986122886681098, @@ -98,12 +98,11 @@ classifiers n = 4}}), ("dd/mm", Classifier{okData = - ClassData{prior = -0.40546510810816444, - unseen = -2.3025850929940455, - likelihoods = HashMap.fromList [("", 0.0)], n = 8}, + ClassData{prior = -0.5108256237659907, unseen = -2.639057329615259, + likelihoods = HashMap.fromList [("", 0.0)], n = 12}, koData = - ClassData{prior = -1.0986122886681098, unseen = -1.791759469228055, - likelihoods = HashMap.fromList [("", 0.0)], n = 4}}), + ClassData{prior = -0.916290731874155, unseen = -2.3025850929940455, + likelihoods = HashMap.fromList [("", 0.0)], n = 8}}), ("today", Classifier{okData = ClassData{prior = -0.2231435513142097, unseen = -1.791759469228055, @@ -163,29 +162,28 @@ classifiers likelihoods = HashMap.fromList [], n = 0}}), ("on ", Classifier{okData = - ClassData{prior = -0.32158362412746233, - unseen = -4.248495242049359, + ClassData{prior = -0.3272129112084162, unseen = -4.330733340286331, likelihoods = HashMap.fromList - [("L\248rdag", -3.1354942159291497), - ("on ", -3.5409593240373143), - ("Mandag", -3.5409593240373143), - ("Torsdag", -2.1546649629174235), - ("the (non ordinal)", -3.1354942159291497), - ("(ordinal) ", -2.2881963555419462), - ("day", -0.832909122935104), - ("the (ordinal)", -3.5409593240373143), - (" (ordinal)", -1.9315214116032136)], - n = 29}, + [("L\248rdag", -3.2188758248682006), + ("on ", -3.624340932976365), + ("Mandag", -3.624340932976365), + ("Torsdag", -2.2380465718564744), + ("the (non ordinal)", -3.2188758248682006), + ("(ordinal) ", -2.2380465718564744), + ("day", -0.8517522107365838), + ("the (ordinal)", -3.624340932976365), + (" (ordinal)", -1.91959284073794)], + n = 31}, koData = - ClassData{prior = -1.2909841813155656, - unseen = -3.5263605246161616, + ClassData{prior = -1.276293465905562, unseen = -3.6375861597263857, likelihoods = HashMap.fromList - [("on ", -2.3978952727983707), - ("time-of-day (latent)", -1.1939224684724346), - ("hour", -1.0116009116784799)], - n = 11}}), + [("on ", -2.512305623976115), + ("year (latent)", -2.917770732084279), + ("time-of-day (latent)", -1.3083328196501787), + ("year", -2.917770732084279), ("hour", -1.126011262856224)], + n = 12}}), ("integer (0..19)", Classifier{okData = ClassData{prior = -0.13005312824819779, @@ -271,6 +269,13 @@ classifiers koData = ClassData{prior = -infinity, unseen = -0.6931471805599453, likelihoods = HashMap.fromList [], n = 0}}), + ("November", + 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 (grain)", Classifier{okData = ClassData{prior = -0.10536051565782628, @@ -280,6 +285,13 @@ classifiers ClassData{prior = -2.3025850929940455, unseen = -1.0986122886681098, likelihoods = HashMap.fromList [("", 0.0)], n = 1}}), + ("dd/m", + 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}}), (" quarter", Classifier{okData = ClassData{prior = -0.6931471805599453, @@ -308,131 +320,135 @@ classifiers likelihoods = HashMap.fromList [], n = 0}}), ("intersect", Classifier{okData = - ClassData{prior = -0.32423966818557853, - unseen = -6.124683390894205, + ClassData{prior = -0.3305637999350466, unseen = -6.156978985585555, likelihoods = HashMap.fromList - [("Onsdagthis ", -5.429345628954441), - ("Torsdag