Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CA time improvements #666

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 65 additions & 62 deletions Duckling/Ranking/Classifiers/CA_XX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("integer (numeric)",
Classifier{okData =
ClassData{prior = -0.6644370746775139, unseen = -4.007333185232471,
likelihoods = HashMap.fromList [("", 0.0)], n = 53},
ClassData{prior = -0.6216882165778003, unseen = -4.0943445622221,
likelihoods = HashMap.fromList [("", 0.0)], n = 58},
koData =
ClassData{prior = -0.7227059828014897, unseen = -3.951243718581427,
ClassData{prior = -0.7701082216960736, unseen = -3.951243718581427,
likelihoods = HashMap.fromList [("", 0.0)], n = 50}}),
("the day before yesterday",
Classifier{okData =
Expand Down Expand Up @@ -63,8 +63,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("Febrer",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
ClassData{prior = 0.0, unseen = -2.3025850929940455,
likelihoods = HashMap.fromList [("", 0.0)], n = 8},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
Expand Down Expand Up @@ -198,26 +198,26 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("<day-of-month> de <named-month>",
Classifier{okData =
ClassData{prior = -8.004270767353637e-2,
unseen = -4.127134385045092,
ClassData{prior = -7.145896398214498e-2,
unseen = -4.219507705176107,
likelihoods =
HashMap.fromList
[("number (0..15)Maig", -2.7245795030534206),
("integer (numeric)Gener", -3.417726683613366),
("integer (numeric)Mar\231", -2.3191143949452564),
("integer (numeric)Juliol", -3.417726683613366),
("integer (numeric)Febrer", -2.501435951739211),
("integer (numeric)Abril", -3.012261575505202),
("integer (numeric)Maig", -3.417726683613366),
("integer (numeric)Octubre", -3.417726683613366),
("number (0..15)Mar\231", -3.012261575505202),
("integer (numeric)Agost", -3.417726683613366),
("month", -0.8919980393051105),
("integer (numeric)Setembre", -3.012261575505202),
("integer (numeric)Desembre", -3.417726683613366)],
n = 24},
koData =
ClassData{prior = -2.5649493574615367, unseen = -2.890371757896165,
[("number (0..15)Maig", -2.8183982582710754),
("integer (numeric)Gener", -3.5115454388310208),
("integer (numeric)Mar\231", -2.412933150162911),
("integer (numeric)Juliol", -3.5115454388310208),
("integer (numeric)Febrer", -2.12525107771113),
("integer (numeric)Abril", -3.1060803307228566),
("integer (numeric)Maig", -3.5115454388310208),
("integer (numeric)Octubre", -3.5115454388310208),
("number (0..15)Mar\231", -3.1060803307228566),
("integer (numeric)Agost", -3.5115454388310208),
("month", -0.8724881092157621),
("integer (numeric)Setembre", -3.1060803307228566),
("integer (numeric)Desembre", -3.5115454388310208)],
n = 27},
koData =
ClassData{prior = -2.6741486494265287, unseen = -2.890371757896165,
likelihoods =
HashMap.fromList
[("integer (numeric)Juliol", -1.7346010553881064),
Expand Down Expand Up @@ -263,49 +263,51 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.25593337413720063,
unseen = -4.276666119016055,
ClassData{prior = -0.23841102344499823,
unseen = -4.356708826689592,
likelihoods =
HashMap.fromList
[("<day-of-month> de <named-month>in the <part-of-day>",
-3.56953269648137),
("dayhour", -1.5546296759391054),
("monthyear", -3.56953269648137),
("tomorrowin the <part-of-day>", -2.316769727986002),
("Maigdel <year>", -3.56953269648137),
-3.6506582412937383),
("dayhour", -1.6357552207514738),
("daymonth", -3.245193133185574),
("monthyear", -3.6506582412937383),
("tomorrowin the <part-of-day>", -2.3978952727983707),
("Maigdel <year>", -3.6506582412937383),
("el <day-of-month> de <named-month>in the <part-of-day>",
-3.56953269648137),
("Dillunsin the <part-of-day>", -3.56953269648137),
("dayyear", -2.065455299705096),
("quarteryear", -3.56953269648137),
("intersect by `de`in the <part-of-day>", -3.56953269648137),
-3.6506582412937383),
("Dillunsin the <part-of-day>", -3.6506582412937383),
("dayyear", -2.1465808445174646),
("quarteryear", -3.6506582412937383),
("intersect by `de`in the <part-of-day>", -3.6506582412937383),
("Dia Internacional de les Cooperativesel <time>",
-3.56953269648137),
("intersect by `de`del <year>", -3.56953269648137),
-3.6506582412937383),
("intersect by `de`del <year>", -3.6506582412937383),
("<day-of-month> de <named-month>del <year>",
-3.56953269648137),
-3.6506582412937383),
("Dia Internacional de les Cooperativesdel <year>",
-3.56953269648137),
("<ordinal> quarterdel <year>", -3.56953269648137),
("el <time>in the <part-of-day>", -3.56953269648137),
-3.6506582412937383),
("el <day-of-month> (non ordinal)Agost", -3.245193133185574),
("<ordinal> quarterdel <year>", -3.6506582412937383),
("el <time>in the <part-of-day>", -3.6506582412937383),
("el <day-of-month> de <named-month>del <year>",
-3.56953269648137),
("el <time>del <year>", -3.56953269648137),
("yesterdayin the <part-of-day>", -2.8763855159214247),
("dd-dd <month>(interval)del <year>", -3.164067588373206)],
n = 24},
-3.6506582412937383),
("el <time>del <year>", -3.6506582412937383),
("yesterdayin the <part-of-day>", -2.9575110607337933),
("dd-dd <month>(interval)del <year>", -3.245193133185574)],
n = 26},
koData =
ClassData{prior = -1.488077055429833, unseen = -3.6375861597263857,
ClassData{prior = -1.550597412411167, unseen = -3.6888794541139363,
likelihoods =
HashMap.fromList
[("monthyear", -2.2246235515243336),
("Maigdel <year>", -2.917770732084279),
("Febrerin the <part-of-day>", -2.917770732084279),
("monthhour", -2.917770732084279),
("dayyear", -2.2246235515243336),
[("monthyear", -2.277267285009756),
("Maigdel <year>", -2.9704144655697013),
("Febrerin the <part-of-day>", -2.9704144655697013),
("monthhour", -2.9704144655697013),
("dayyear", -2.277267285009756),
("<day-of-month> de <named-month>del <year>",
-2.2246235515243336),
("Julioldel <year>", -2.512305623976115)],
-2.277267285009756),
("Julioldel <year>", -2.5649493574615367)],
n = 7}}),
("Dilluns",
Classifier{okData =
Expand Down Expand Up @@ -452,8 +454,8 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("Agost",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1},
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}}),
Expand Down Expand Up @@ -996,15 +998,16 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("el <day-of-month> (non ordinal)",
Classifier{okData =
ClassData{prior = -0.19105523676270922,
unseen = -3.0910424533583156,
ClassData{prior = -0.1743533871447778,
unseen = -3.1780538303479458,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.2113090936672069),
("number (0..15)", -1.6582280766035324)],
n = 19},
[("integer (numeric)", -0.19105523676270922),
("number (0..15)", -1.749199854809259)],
n = 21},
koData =
ClassData{prior = -1.749199854809259, unseen = -1.9459101490553135,
ClassData{prior = -1.8325814637483102,
unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList [("integer (numeric)", -0.1823215567939546)],
n = 4}}),
Expand Down
5 changes: 5 additions & 0 deletions Duckling/Time/CA/Corpus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ allExamples = concat
, examples (datetime (2013, 8, 4, 0, 0, 0) Day)
[ "el 4 d'agost"
, "el 4/8"
, "el 4 ago"
, "el 4 ag"
]
, examples (datetime (2013, 3, 3, 0, 0, 0) Day)
[ "el 3 de març"
Expand Down Expand Up @@ -152,6 +154,9 @@ allExamples = concat
, examples (datetime (2013, 2, 16, 0, 0, 0) Day)
[ "el 16"
, "16 de febrer"
, "16 de febr."
, "16 de febr"
, "16 de feb"
]
, examples (datetime (2013, 2, 17, 0, 0, 0) Day)
[ "el 17"
Expand Down
4 changes: 2 additions & 2 deletions Duckling/Time/CA/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ ruleDaysOfWeek = mkRuleDaysOfWeek
ruleMonths :: [Rule]
ruleMonths = mkRuleMonths
[ ( "Gener" , "gener|gen\\.?")
, ( "Febrer" , "febrer|feb\\.?")
, ( "Febrer" , "febrer|febr?\\.?")
, ( "Març" , "març|mar\\.?")
, ( "Abril" , "abril|abr\\.?")
, ( "Maig" , "maig?\\.?")
, ( "Juny" , "juny?\\.?")
, ( "Juliol" , "juliol|jul\\.?")
, ( "Agost" , "agost|ago\\.?")
, ( "Agost" , "agost|ago?\\.?")
, ( "Setembre" , "setembre|set\\.?")
, ( "Octubre" , "octubre|oct\\.?")
, ( "Novembre" , "novembre|nov\\.?")
Expand Down