Time/AR: Periodic and Time

Summary: Adding Arabic support for periodic and rule computed holidays.

Reviewed By: patapizza

Differential Revision: D14573637

fbshipit-source-id: 84d8c42acaebc8483c641cc865e54c418c9918aa
This commit is contained in:
Nathan Hausman 2019-03-29 08:35:25 -07:00 committed by Facebook Github Bot
parent 77e88171d6
commit 830e5e3d8e
3 changed files with 262 additions and 151 deletions

View File

@ -41,10 +41,10 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("integer (numeric)",
Classifier{okData =
ClassData{prior = -0.3462762367178338, unseen = -4.0943445622221,
likelihoods = HashMap.fromList [("", 0.0)], n = 58},
ClassData{prior = -0.3184537311185346, unseen = -4.189654742026425,
likelihoods = HashMap.fromList [("", 0.0)], n = 64},
koData =
ClassData{prior = -1.2286654169163076, unseen = -3.258096538021482,
ClassData{prior = -1.2992829841302609, unseen = -3.258096538021482,
likelihoods = HashMap.fromList [("", 0.0)], n = 24}}),
("ordinals (twelveth)",
Classifier{okData =
@ -461,153 +461,173 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 39}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.6074917359814515, unseen = -5.455321115357702,
ClassData{prior = -0.569352963213281, unseen = -5.529429087511423,
likelihoods =
HashMap.fromList
[("Tuesdayon <date>", -4.757891273005756),
("in <named-month>year", -4.757891273005756),
[("Tuesdayon <date>", -4.832305758571839),
("in <named-month>year", -4.832305758571839),
("<hour-of-day> till thirdafter part of days",
-4.352426164897591),
("dayhour", -3.8416005411316), ("daymonth", -4.757891273005756),
("in <named-month>on <date>", -4.757891273005756),
("monthyear", -3.253813876229481),
("Mondayon <date>", -4.757891273005756),
("Christmasyear", -4.757891273005756),
-4.426840650463674),
("dayhour", -3.9160150266976834),
("daymonth", -4.832305758571839),
("in <named-month>on <date>", -4.832305758571839),
("monthyear", -3.3282283617955644),
("Mondayon <date>", -4.832305758571839),
("Christmasyear", -4.832305758571839),
("Monday<day-of-month> (ordinal or number) <named-month>",
-4.757891273005756),
("month (integer)year (integer)", -4.352426164897591),
-4.832305758571839),
("month (integer)year (integer)", -4.426840650463674),
("\1593\1610\1583 \1575\1604\1605\1610\1604\1575\1583year",
-4.832305758571839),
("<day-of-week> the last of <time><cycle> this|last|next",
-4.757891273005756),
("at <time-of-day>before part of days", -4.06474409244581),
("hh:mmbefore part of days", -4.757891273005756),
-4.832305758571839),
("at <time-of-day>before part of days", -4.139158578011894),
("hh:mmbefore part of days", -4.832305758571839),
("intersect by \",\", \"of\", \"from\", \"'s\"year",
-4.757891273005756),
("intersect<time> <part-of-day>", -4.352426164897591),
("month (ordinal)year (integer)", -4.757891273005756),
("dd/mm<time> <part-of-day>", -4.757891273005756),
("Thursday<time> timezone", -4.352426164897591),
-4.832305758571839),
("intersect<time> <part-of-day>", -4.426840650463674),
("month (ordinal)year (integer)", -4.832305758571839),
("\1593\1610\1583 \1575\1604\1601\1589\1581year",
-4.832305758571839),
("dd/mm<time> <part-of-day>", -4.832305758571839),
("Thursday<time> timezone", -4.426840650463674),
("<hour-of-day> till quarterthis <part-of-day>",
-4.352426164897591),
("dayday", -2.9661318037777002),
-4.426840650463674),
("dayday", -3.0405462893437836),
("absorption of , after named day<day-of-month> (ordinal or number) <named-month>",
-4.757891273005756),
("hourhour", -3.6592789843376456),
("month (integer)year", -4.757891273005756),
-4.832305758571839),
("hourhour", -3.733693469903729),
("month (integer)year", -4.832305758571839),
("\1593\1610\1583 \1575\1604\1601\1591\1585year",
-4.832305758571839),
("Thursday<day-of-month> (ordinal or number) <named-month>",
-4.757891273005756),
("dayyear", -3.505128304510387),
("Thursday<time> <part-of-day>", -4.757891273005756),
("<cycle> last of <time>year (integer)", -4.352426164897591),
("last <cycle> of <time>year (integer)", -4.757891273005756),
("<hour-of-day> quarterafter part of days", -4.757891273005756),
("minutehour", -2.4553061800117097),
-4.832305758571839),
("dayyear", -2.960503581670247),
("Thursday<time> <part-of-day>", -4.832305758571839),
("<cycle> last of <time>year (integer)", -4.426840650463674),
("last <cycle> of <time>year (integer)", -4.832305758571839),
("<hour-of-day> quarterafter part of days", -4.832305758571839),
("minutehour", -2.529720665577793),
("Thursdayfrom <datetime> - <datetime> (interval)",
-4.757891273005756),
("Monday<cycle> this|last|next", -4.757891273005756),
-4.832305758571839),
("\1585\1571\1587 \1575\1604\1587\1606\1577 \1575\1604\1607\1580\1585\1610\1577year",
-4.832305758571839),
("Monday<cycle> this|last|next", -4.832305758571839),
("<day-of-month> (ordinal or number) of <named-month>year",
-4.757891273005756),
("<cycle> <ordinal> day? of <time>year", -4.757891273005756),
("on a <named-day>dd/mm", -4.757891273005756),
("on a <named-day>on <date>", -4.757891273005756),
-4.832305758571839),
("<cycle> <ordinal> day? of <time>year", -4.832305758571839),
("\1593\1610\1583 \1575\1604\1571\1590\1581\1609year",
-4.832305758571839),
("on a <named-day>dd/mm", -4.832305758571839),
("on a <named-day>on <date>", -4.832305758571839),
("on a <named-day><day-of-month> (ordinal or number) <named-month>",
-4.757891273005756),
("Tuesday<cycle> this|last|next", -4.757891273005756),
("dayminute", -3.505128304510387),
("dd/mmintersect", -4.757891273005756),
("in <named-month><cycle> this|last|next", -4.757891273005756),
-4.832305758571839),
("Tuesday<cycle> this|last|next", -4.832305758571839),
("dayminute", -3.5795427900764705),
("dd/mmintersect", -4.832305758571839),
("in <named-month><cycle> this|last|next", -4.832305758571839),
("<hour-of-day> and integer minutesafter part of days",
-4.352426164897591),
("Saturdaydd/mm", -4.757891273005756),
("the <cycle> the <ordinal> of <time>year", -4.757891273005756),
("at <time-of-day>after part of days", -3.6592789843376456),
("<ordinal> <cycle> of <time>year", -4.757891273005756),
("Sunday<cycle> this|last|next", -4.757891273005756),
-4.426840650463674),
("Saturdaydd/mm", -4.832305758571839),
("\1585\1605\1590\1575\1606year", -4.832305758571839),
("the <cycle> the <ordinal> of <time>year", -4.832305758571839),
("at <time-of-day>after part of days", -3.733693469903729),
("<ordinal> <cycle> of <time>year", -4.832305758571839),
("Sunday<cycle> this|last|next", -4.832305758571839),
("Tuesday<day-of-month> (ordinal or number) of <named-month>",
-4.352426164897591),
("Septemberon <date>", -4.757891273005756),
-4.426840650463674),
("Septemberon <date>", -4.832305758571839),
("from <datetime> - <datetime> (interval)after part of days",
-4.757891273005756),
("intersectintersect", -4.352426164897591),
("dayweek", -4.06474409244581), ("weekyear", -3.8416005411316),
-4.832305758571839),
("intersectintersect", -4.426840650463674),
("dayweek", -4.139158578011894),
("weekyear", -3.9160150266976834),
("<datetime> - <datetime> (interval)after part of days",
-4.757891273005756),
-4.832305758571839),
("Friday<day-of-month> (ordinal or number) <named-month>",
-4.757891273005756),
-4.832305758571839),
("<hour-of-day> till quarterbefore part of days",
-4.352426164897591),
-4.426840650463674),
("<time-of-day> - <time-of-day> (interval)after part of days",
-4.757891273005756),
("at <time-of-day>this <part-of-day>", -4.757891273005756),
-4.832305758571839),
("at <time-of-day>this <part-of-day>", -4.832305758571839),
("<hour-of-day> till thirdbefore part of days",
-4.352426164897591)],
n = 67},
-4.426840650463674)],
n = 73},
koData =
ClassData{prior = -0.7868326646372683, unseen = -5.356586274672012,
ClassData{prior = -0.8344607136265229, unseen = -5.384495062789089,
likelihoods =
HashMap.fromList
[("Tuesdayon <date>", -4.658710952916121),
("dayhour", -3.154633556139847),
("daymonth", -3.5600986642480117),
("monthday", -4.658710952916121),
("monthyear", -2.78690877601453),
("hh:mmafter part of days", -4.658710952916121),
("houryear", -4.253245844807957),
("intersectat <time-of-day>", -3.742420221041966),
("intersect<time> <part-of-day>", -4.253245844807957),
("Octoberon <date>", -4.658710952916121),
("until <time-of-day>after part of days", -4.658710952916121),
("this|last <cycle>on <date>", -4.658710952916121),
("Tuesdayafter <time-of-day>", -4.658710952916121),
("Wednesdayon <date>", -4.253245844807957),
("dd/mm<time> <part-of-day>", -4.658710952916121),
("yearyear", -4.253245844807957),
[("Tuesdayon <date>", -4.686750172980514),
("dayhour", -3.18267277620424),
("daymonth", -3.5881378843124043),
("monthday", -4.686750172980514),
("monthyear", -2.814947996078923),
("hh:mmafter part of days", -4.686750172980514),
("houryear", -4.28128506487235),
("intersectat <time-of-day>", -3.770459441106359),
("intersect<time> <part-of-day>", -4.28128506487235),
("Octoberon <date>", -4.686750172980514),
("until <time-of-day>after part of days", -4.686750172980514),
("this|last <cycle>on <date>", -4.686750172980514),
("Tuesdayafter <time-of-day>", -4.686750172980514),
("Wednesdayon <date>", -4.28128506487235),
("dd/mm<time> <part-of-day>", -4.686750172980514),
("yearyear", -4.28128506487235),
("<hour-of-day> till quarterthis <part-of-day>",
-4.658710952916121),
("dayday", -3.965563772356176),
("dd/mmat <time-of-day>", -4.253245844807957),
("hourhour", -4.253245844807957),
("dayyear", -3.405947984420753),
("Thursdayat <time-of-day>", -4.253245844807957),
("Februaryyear", -4.658710952916121),
("minutemonth", -4.658710952916121),
("minutehour", -4.253245844807957),
("for <duration> from <time>on <date>", -4.658710952916121),
-4.686750172980514),
("dayday", -3.993602992420569),
("dd/mmat <time-of-day>", -4.28128506487235),
("hourhour", -4.28128506487235),
("dayyear", -3.4339872044851463),
("Thursdayat <time-of-day>", -4.28128506487235),
("Februaryyear", -4.686750172980514),
("minutemonth", -4.686750172980514),
("minutehour", -4.28128506487235),
("for <duration> from <time>on <date>", -4.686750172980514),
("<day-of-month> (ordinal or number) of <named-month>year",
-4.253245844807957),
("March<cycle> this|last|next", -4.658710952916121),
("nth <time> of <time>year", -4.658710952916121),
-4.28128506487235),
("March<cycle> this|last|next", -4.686750172980514),
("nth <time> of <time>year", -4.686750172980514),
("Wednesday<day-of-month> (ordinal or number) of <named-month>",
-4.658710952916121),
("secondyear", -4.253245844807957),
-4.686750172980514),
("secondyear", -4.28128506487235),
("Wednesdayintersect by \",\", \"of\", \"from\", \"'s\"",
-4.658710952916121),
("on <date>year (integer)", -4.658710952916121),
("<time> for <duration>year", -3.5600986642480117),
-4.686750172980514),
("on <date>year (integer)", -4.686750172980514),
("<time> for <duration>year", -3.5881378843124043),
("<duration> after|before|from <time>on <date>",
-4.658710952916121),
("dayminute", -3.154633556139847),
("Julyuntil <time-of-day>", -4.658710952916121),
("intersecton <date>", -4.658710952916121),
("at <time-of-day>after part of days", -4.658710952916121),
("Octoberyear", -4.658710952916121),
("in|within|after <duration>year", -4.253245844807957),
-4.686750172980514),
("dayminute", -3.18267277620424),
("Julyuntil <time-of-day>", -4.686750172980514),
("intersecton <date>", -4.686750172980514),
("at <time-of-day>after part of days", -4.686750172980514),
("Octoberyear", -4.686750172980514),
("in|within|after <duration>year", -4.28128506487235),
("Tuesday<day-of-month> (ordinal or number) of <named-month>",
-4.658710952916121),
("on a <named-day>intersect", -4.253245844807957),
("Saturdayintersect", -4.253245844807957),
("at <time-of-day>year", -4.658710952916121),
("on <date>year", -4.253245844807957),
("on <date>on <date>", -4.658710952916121),
("weekday", -4.658710952916121),
("Tuesdaynth <time> of <time>", -4.658710952916121),
("weekyear", -4.658710952916121),
("Tuesdayintersect", -4.658710952916121),
("after <time-of-day>year", -4.658710952916121),
("in <number> (implicit minutes)February", -4.658710952916121),
("last <cycle> of <time>year", -4.658710952916121),
-4.686750172980514),
("on a <named-day>intersect", -4.28128506487235),
("Saturdayintersect", -4.28128506487235),
("at <time-of-day>year", -4.686750172980514),
("on <date>year", -4.28128506487235),
("on <date>on <date>", -4.686750172980514),
("weekday", -4.686750172980514),
("Tuesdaynth <time> of <time>", -4.686750172980514),
("weekyear", -4.686750172980514),
("Tuesdayintersect", -4.686750172980514),
("after <time-of-day>year", -4.686750172980514),
("in <number> (implicit minutes)February", -4.686750172980514),
("last <cycle> of <time>year", -4.686750172980514),
("<day-of-month> (ordinal or number) of <named-month>on <date>",
-4.658710952916121)],
-4.686750172980514)],
n = 56}}),
("\1585\1605\1590\1575\1606",
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}}),
("the <cycle> the <ordinal> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.833213344056216,
@ -654,13 +674,12 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("year (grain)",
Classifier{okData =
ClassData{prior = -1.0986122886681098,
ClassData{prior = -1.2237754316221157,
unseen = -1.9459101490553135,
likelihoods = HashMap.fromList [("", 0.0)], n = 5},
koData =
ClassData{prior = -0.40546510810816444,
unseen = -2.4849066497880004,
likelihoods = HashMap.fromList [("", 0.0)], n = 10}}),
ClassData{prior = -0.3483066942682157, unseen = -2.639057329615259,
likelihoods = HashMap.fromList [("", 0.0)], n = 12}}),
("from <datetime> - <datetime> (interval)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.5649493574615367,
@ -792,6 +811,13 @@ classifiers
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("\1593\1610\1583 \1575\1604\1571\1590\1581\1609",
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}}),
("ordinals (twenty, thirty..ninety)",
Classifier{okData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
@ -888,6 +914,13 @@ classifiers
koData =
ClassData{prior = -infinity, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [], n = 0}}),
("\1585\1571\1587 \1575\1604\1587\1606\1577 \1575\1604\1607\1580\1585\1610\1577",
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}}),
("April",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
@ -1019,8 +1052,8 @@ classifiers
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
ClassData{prior = 0.0, unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6}}),
("Friday",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
@ -1122,6 +1155,13 @@ classifiers
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("\1593\1610\1583 \1575\1604\1601\1591\1585",
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}}),
("minute (grain)",
Classifier{okData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
@ -1161,18 +1201,19 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("year",
Classifier{okData =
ClassData{prior = -1.4469189829363254,
unseen = -1.9459101490553135,
ClassData{prior = -0.9932517730102834,
unseen = -2.5649493574615367,
likelihoods =
HashMap.fromList [("integer (numeric)", -0.1823215567939546)],
n = 4},
HashMap.fromList [("integer (numeric)", -8.701137698962981e-2)],
n = 10},
koData =
ClassData{prior = -0.2682639865946794, unseen = -2.772588722239781,
ClassData{prior = -0.46262352194811296,
unseen = -2.995732273553991,
likelihoods =
HashMap.fromList
[("integer (numeric)", -0.2231435513142097),
("powers of tens", -1.6094379124341003)],
n = 13}}),
[("integer (numeric)", -0.4595323293784402),
("powers of tens", -0.9985288301111273)],
n = 17}}),
("last <day-of-week> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.0794415416798357,
@ -1302,6 +1343,13 @@ classifiers
koData =
ClassData{prior = 0.0, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
("\1593\1610\1583 \1575\1604\1601\1589\1581",
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}}),
("the <cycle> after|before <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.4849066497880004,
@ -1539,6 +1587,13 @@ classifiers
("<integer> <unit-of-duration>part of days",
-2.3513752571634776)],
n = 5}}),
("\1593\1610\1583 \1575\1604\1605\1610\1604\1575\1583",
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}}),
("before part of days",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
@ -1607,6 +1662,13 @@ classifiers
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("New Year's Day",
Classifier{okData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0},
koData =
ClassData{prior = 0.0, unseen = -1.3862943611198906,
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
("this|last the <cycle>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.9444389791664407,
@ -1881,31 +1943,32 @@ classifiers
n = 14}}),
("single <unit-of-duration>",
Classifier{okData =
ClassData{prior = -4.248495242049359, unseen = -2.9444389791664407,
ClassData{prior = -4.2626798770413155,
unseen = -2.9444389791664407,
likelihoods =
HashMap.fromList
[("day", -1.791759469228055),
("day (grain)", -1.791759469228055)],
n = 2},
koData =
ClassData{prior = -1.4388737452099556e-2,
unseen = -5.673323267171493,
ClassData{prior = -1.4184634991956413e-2,
unseen = -5.68697535633982,
likelihoods =
HashMap.fromList
[("week", -2.6253584852570966),
("month (grain)", -2.2358937184953733),
("hour (grain)", -1.9810014688665833),
("year (grain)", -2.8972922007407385),
("second", -4.060443010546419),
("week (grain)", -2.6253584852570966),
("day", -2.578838469622204),
("minute (grain)", -3.367295829986474),
("year", -2.8972922007407385),
("second (grain) ", -4.060443010546419),
("hour", -1.9810014688665833), ("month", -2.2358937184953733),
("minute", -3.367295829986474),
("day (grain)", -2.578838469622204)],
n = 138}}),
[("week", -2.639057329615259),
("month (grain)", -2.249592562853535),
("hour (grain)", -1.9947003132247452),
("year (grain)", -2.793208009442517),
("second", -4.074141854904581),
("week (grain)", -2.639057329615259),
("day", -2.592537313980366),
("minute (grain)", -3.380994674344636),
("year", -2.793208009442517),
("second (grain) ", -4.074141854904581),
("hour", -1.9947003132247452), ("month", -2.249592562853535),
("minute", -3.380994674344636),
("day (grain)", -2.592537313980366)],
n = 140}}),
("dd-dd <month> (interval)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.3025850929940455,

View File

@ -328,5 +328,28 @@ allExamples = concat
[ "اغسطس 27 الى 29"
, "من 27-29 من الشهر الثامن"
]
, examples (datetimeHoliday (2020, 12, 25, 0, 0, 0) Day "عيد الميلاد")
[ "عيد الميلاد 2020"
]
, examples (datetimeHoliday (2013, 10, 15, 0, 0, 0) Day "عيد الأضحى")
[ "عيد الأضحى"
, "عيد الأضحى 2013"
]
, examples (datetimeHoliday (2013, 8, 8, 0, 0, 0) Day "عيد الفطر")
[ "عيد الفطر"
, "عيد الفطر 2013"
]
, examples (datetimeHoliday (2013, 3, 31, 0, 0, 0) Day "عيد الفصح")
[ "عيد الفصح"
, "عيد الفصح 2013"
]
, examples (datetimeHoliday (2013, 11, 4, 0, 0, 0) Day "رأس السنة الهجرية")
[ "رأس السنة الهجرية"
]
, examples (datetimeHoliday (2019, 8, 31, 0, 0, 0) Day "رأس السنة الهجرية")
[ "رأس السنة الهجرية 2019"
]
, examples (datetimeIntervalHoliday ((2019, 5, 6, 0, 0, 0), (2019, 6, 4, 0, 0, 0)) Day "رمضان")
[ "رمضان 2019"
]
]

View File

@ -26,6 +26,7 @@ import Duckling.Duration.Helpers (duration)
import Duckling.Numeral.Helpers (parseInt)
import Duckling.Numeral.Types (NumeralData (..))
import Duckling.Regex.Types
import Duckling.Time.Computed
import Duckling.Time.Helpers
import Duckling.Time.Types (TimeData (..))
import Duckling.Types
@ -1711,6 +1712,27 @@ ruleTimezone = Rule
_ -> Nothing
}
rulePeriodicHolidays :: [Rule]
rulePeriodicHolidays = mkRuleHolidays
[ ( "عيد الميلاد" ,"عيد الميلاد", monthDay 12 25 )
]
ruleComputedHolidays :: [Rule]
ruleComputedHolidays = mkRuleHolidays
[ ( "عيد الأضحى" ,"عيد الأضحى", eidalAdha )
, ( "عيد الفطر" ,"عيد الفطر", eidalFitr )
, ( "عيد الفصح" ,"عيد الفصح", easterSunday )
, ( "رأس السنة الهجرية" ,"رأس السنة الهجرية", muharram )
]
ruleComputedHolidays' :: [Rule]
ruleComputedHolidays' = mkRuleHolidays'
[ ( "رمضان", "رمضان"
, let start = ramadan
end = cycleNthAfter False TG.Day (-1) eidalFitr
in interval TTime.Open start end )
]
rules :: [Rule]
rules =
[ ruleIntersect
@ -1827,3 +1849,6 @@ rules =
++ ruleDaysOfWeek
++ ruleMonths
++ ruleUSHolidays
++ rulePeriodicHolidays
++ ruleComputedHolidays
++ ruleComputedHolidays'