FR: add nth <time> of <time> rules (#596)

Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/596

Reviewed By: stroxler

Differential Revision: D27722743

Pulled By: chessai

fbshipit-source-id: a9136fef2a26e87269bca8212ae07d3d7fe04977
This commit is contained in:
chessai 2021-05-11 11:19:29 -07:00 committed by Facebook GitHub Bot
parent 59cb9e0879
commit ccdf27ad1d
3 changed files with 414 additions and 344 deletions

View File

@ -494,8 +494,8 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 4}}),
("mois (grain)",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.3978952727983707,
likelihoods = HashMap.fromList [("", 0.0)], n = 9},
ClassData{prior = 0.0, unseen = -2.5649493574615367,
likelihoods = HashMap.fromList [("", 0.0)], n = 11},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -514,6 +514,18 @@ classifiers
koData =
ClassData{prior = -infinity, unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [], n = 0}}),
("the nth <time> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.6094379124341003,
likelihoods =
HashMap.fromList
[("ordinals (premier..seizieme)Mercredi<cycle> prochain|suivant|d'apr\232s",
-0.6931471805599453),
("daymonth", -0.6931471805599453)],
n = 1},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("de <datetime> - <datetime> (interval)",
Classifier{okData =
ClassData{prior = -1.0560526742493137,
@ -604,326 +616,329 @@ classifiers
n = 2}}),
("intersect",
Classifier{okData =
ClassData{prior = -0.21850556309818536, unseen = -6.90975328164481,
ClassData{prior = -0.22468477946414347,
unseen = -6.911747300251674,
likelihoods =
HashMap.fromList
[("intersect<dim time> du matin", -6.215607598755275),
[("intersect<dim time> du matin", -6.2176036074019905),
("<hour-of-day> <integer> (as relative minutes)intersect",
-5.810142490647111),
-5.812138499293826),
("<day-of-month> <named-month>d\233but de journ\233e",
-6.215607598755275),
("hourday", -3.96431580014878),
("<day-of-month> <named-month>year", -5.52246041819533),
("apr\232s <time-of-day|day>le <time>", -5.29931686688112),
("dayhour", -1.9887738534870956),
-6.2176036074019905),
("hourday", -3.966311808795495),
("<day-of-month> <named-month>year", -5.524456426842045),
("apr\232s <time-of-day|day>le <time>", -5.301312875527835),
("dayhour", -1.9907698621338108),
("<datetime> - <datetime> (interval)Juillet",
-5.116995310087166),
("daymonth", -2.749871695955549),
("monthyear", -4.711530201979001),
-5.1189913187338805),
("daymonth", -2.751867704602264),
("monthyear", -4.713526210625716),
("<day-of-month> <named-month>d\233but de matin\233e",
-6.215607598755275),
("dernier <cycle> de <time> (latent)year", -5.29931686688112),
("apr\232s <time-of-day|day>intersect", -5.810142490647111),
("aujourd'huimilieu d'apr\232s-midi", -6.215607598755275),
-6.2176036074019905),
("dernier <cycle> de <time> (latent)year", -5.301312875527835),
("apr\232s <time-of-day|day>intersect", -5.812138499293826),
("aujourd'huimilieu d'apr\232s-midi", -6.2176036074019905),
("<day-of-month> <named-month>\224|vers <time-of-day>",
-4.711530201979001),
("dd mmyear", -4.962844630259907),
("Vendredi\224|vers <time-of-day>", -5.810142490647111),
("Mercredidu|dans le <part-of-day>", -6.215607598755275),
("aujourd'huifin d'apr\232s-midi", -6.215607598755275),
("day of month (premier)Novembre", -5.52246041819533),
-4.713526210625716),
("dd mmyear", -4.964840638906622),
("Vendredi\224|vers <time-of-day>", -5.812138499293826),
("Mercredidu|dans le <part-of-day>", -6.2176036074019905),
("aujourd'huifin d'apr\232s-midi", -6.2176036074019905),
("day of month (premier)Novembre", -5.524456426842045),
("le <day-of-month> (non ordinal)<dim time> du matin",
-6.215607598755275),
("aujourd'huimilieu de matin\233e", -6.215607598755275),
-6.2176036074019905),
("aujourd'huimilieu de matin\233e", -6.2176036074019905),
("hh(:|h)mm (time-of-day)<day-of-week> <day-of-month>",
-6.215607598755275),
("le <day-of-month> (non ordinal)Fevrier", -4.13616605707544),
("Lundiday of month (premier)", -5.810142490647111),
-6.2176036074019905),
("le <day-of-month> (non ordinal)Fevrier", -4.138162065722154),
("Lundiday of month (premier)", -5.812138499293826),
("<time-of-day> heuresdu|dans le <part-of-day>",
-5.52246041819533),
-5.524456426842045),
("<hour-of-day> et quart<dim time> <part-of-day>",
-5.810142490647111),
("le <time>du|dans le <part-of-day>", -5.52246041819533),
("aujourd'huifin de matin\233e", -6.215607598755275),
("Marsyear", -5.810142490647111),
("aujourd'huifin de soir\233e", -6.215607598755275),
("\224|vers <time-of-day>ce <part-of-day>", -5.52246041819533),
-5.812138499293826),
("le <time>du|dans le <part-of-day>", -5.524456426842045),
("aujourd'huifin de matin\233e", -6.2176036074019905),
("Marsyear", -5.812138499293826),
("aujourd'huifin de soir\233e", -6.2176036074019905),
("\224|vers <time-of-day>ce <part-of-day>", -5.524456426842045),
("<day-of-month> <named-month>d\233but d'apr\232s-midi",
-6.215607598755275),
-6.2176036074019905),
("le <day-of-month> (non ordinal)<dim time> du soir",
-5.52246041819533),
("intersectSeptembre", -5.810142490647111),
("aujourd'huid\233but de soir\233e", -6.215607598755275),
("<day-of-week> <day-of-month>Fevrier", -5.810142490647111),
("<hour-of-day> et demice <part-of-day>", -5.810142490647111),
-5.524456426842045),
("intersectSeptembre", -5.812138499293826),
("aujourd'huid\233but de soir\233e", -6.2176036074019905),
("<day-of-week> <day-of-month>Fevrier", -5.812138499293826),
("<hour-of-day> et demice <part-of-day>", -5.812138499293826),
("<dim time> <part-of-day>apr\232s <time-of-day|day>",
-6.215607598755275),
("le <time>fin de matin\233e", -6.215607598755275),
-6.2176036074019905),
("le <time>fin de matin\233e", -6.2176036074019905),
("Jeudide <time-of-day> - <time-of-day> (interval)",
-5.810142490647111),
("day of month (premier)Mars", -5.29931686688112),
("intersectmilieu de journ\233e", -6.215607598755275),
("intersectfin de journ\233e", -6.215607598755275),
-5.812138499293826),
("day of month (premier)Mars", -5.301312875527835),
("intersectmilieu de journ\233e", -6.2176036074019905),
("intersectfin de journ\233e", -6.2176036074019905),
("le <day-of-month> (non ordinal)<time-of-day> heures",
-6.215607598755275),
("Octobreyear", -5.29931686688112),
("Jeudiapr\232s <time-of-day|day>", -5.29931686688112),
("Fevrierd\233but de matin\233e", -6.215607598755275),
-6.2176036074019905),
("Octobreyear", -5.301312875527835),
("Jeudiapr\232s <time-of-day|day>", -5.301312875527835),
("Fevrierd\233but de matin\233e", -6.2176036074019905),
("de <datetime> - <datetime> (interval)Juillet",
-5.810142490647111),
-5.812138499293826),
("<hour-of-day> <integer> (as relative minutes)<day-of-week> <day-of-month>",
-6.215607598755275),
("monthhour", -4.075541435259004),
("Marsintersect", -6.215607598755275),
-6.2176036074019905),
("monthhour", -4.07753744390572),
("Marsintersect", -6.2176036074019905),
("Lundile <cycle> prochain|suivant|d'apr\232s",
-6.215607598755275),
("le <time>fin d'apr\232s-midi", -6.215607598755275),
("hourmonth", -4.711530201979001),
("<time-of-day> heuresle <time>", -4.711530201979001),
("dayday", -3.8642323415917974),
("Septembreyear", -5.810142490647111),
-6.2176036074019905),
("le <time>fin d'apr\232s-midi", -6.2176036074019905),
("hourmonth", -4.713526210625716),
("<time-of-day> heuresle <time>", -4.713526210625716),
("dayday", -3.8662283502385124),
("Septembreyear", -5.812138499293826),
("aujourd'hui<hour-of-day> <integer> (as relative minutes)",
-5.810142490647111),
("hourhour", -3.68987895444702),
("Fevrierd\233but d'apr\232s-midi", -6.215607598755275),
-5.812138499293826),
("hourhour", -3.691874963093735),
("Fevrierd\233but d'apr\232s-midi", -6.2176036074019905),
("<day-of-week> <day-of-month>\224|vers <time-of-day>",
-5.116995310087166),
("<day-of-week> <day-of-month>Septembre", -6.215607598755275),
("le <time>intersect", -5.810142490647111),
-5.1189913187338805),
("<day-of-week> <day-of-month>Septembre", -6.2176036074019905),
("le <time>intersect", -5.812138499293826),
("\224|vers <time-of-day><dim time> <part-of-day>",
-6.215607598755275),
("aujourd'huiau d\233jeuner", -6.215607598755275),
-6.2176036074019905),
("aujourd'huiau d\233jeuner", -6.2176036074019905),
("du dd au dd (interval) (latent month)Juillet",
-5.52246041819533),
("Vendrediday of month (premier)", -6.215607598755275),
("le <day-of-month> (non ordinal)Avril", -6.215607598755275),
("<time-of-day> heuresintersect", -5.29931686688112),
("<hour-of-day> et quartce <part-of-day>", -5.810142490647111),
("Jeudi\224|vers <time-of-day>", -6.215607598755275),
("dayyear", -3.817712325956905),
("le <day-of-month> (non ordinal)Juin", -6.215607598755275),
("Lundice|dans le <cycle>", -6.215607598755275),
("apr\232s-demain\224|vers <time-of-day>", -5.810142490647111),
("intersectfin d'apr\232s-midi", -6.215607598755275),
("le <ordinal> <cycle> de <time>year", -6.215607598755275),
("intersectmilieu d'apr\232s-midi", -6.215607598755275),
-5.524456426842045),
("Vendrediday of month (premier)", -6.2176036074019905),
("le <day-of-month> (non ordinal)Avril", -6.2176036074019905),
("<time-of-day> heuresintersect", -5.301312875527835),
("<hour-of-day> et quartce <part-of-day>", -5.812138499293826),
("Jeudi\224|vers <time-of-day>", -6.2176036074019905),
("dayyear", -3.81970833460362),
("le <day-of-month> (non ordinal)Juin", -6.2176036074019905),
("Lundice|dans le <cycle>", -6.2176036074019905),
("apr\232s-demain\224|vers <time-of-day>", -5.812138499293826),
("intersectfin d'apr\232s-midi", -6.2176036074019905),
("le <ordinal> <cycle> de <time>year", -6.2176036074019905),
("intersectmilieu d'apr\232s-midi", -6.2176036074019905),
("<hour-of-day> <integer> (as relative minutes)Jeudi",
-6.215607598755275),
("le <time>milieu de journ\233e", -6.215607598755275),
("aujourd'huid\233but de journ\233e", -6.215607598755275),
("demain\224|vers <time-of-day>", -5.810142490647111),
("le <day-of-month> (non ordinal)Mars", -4.829313237635384),
-6.2176036074019905),
("le <time>milieu de journ\233e", -6.2176036074019905),
("aujourd'huid\233but de journ\233e", -6.2176036074019905),
("demain\224|vers <time-of-day>", -5.812138499293826),
("le <day-of-month> (non ordinal)Mars", -4.8313092462821),
("le <day-of-month> (non ordinal)intersect",
-3.7732605633860707),
("hourminute", -6.215607598755275),
("dd-dd <month>(interval)year", -6.215607598755275),
("intersect<day-of-month> <named-month>", -5.810142490647111),
-3.7752565720327858),
("hourminute", -6.2176036074019905),
("dd-dd <month>(interval)year", -6.2176036074019905),
("intersect<day-of-month> <named-month>", -5.812138499293826),
("<hour-of-day> <integer> (as relative minutes)Samedi",
-6.215607598755275),
("minutemonth", -5.810142490647111),
("minutehour", -4.6061696863211745),
("Lundidu|dans le <part-of-day>", -6.215607598755275),
("aujourd'huimilieu de journ\233e", -6.215607598755275),
("Vendrediapr\232s <time-of-day|day>", -6.215607598755275),
("Mars\224|vers <time-of-day>", -5.52246041819533),
("intersectd\233but de soir\233e", -6.215607598755275),
-6.2176036074019905),
("minutemonth", -5.812138499293826),
("minutehour", -4.60816569496789),
("Lundidu|dans le <part-of-day>", -6.2176036074019905),
("aujourd'huimilieu de journ\233e", -6.2176036074019905),
("Vendrediapr\232s <time-of-day|day>", -6.2176036074019905),
("Mars\224|vers <time-of-day>", -5.524456426842045),
("intersectd\233but de soir\233e", -6.2176036074019905),
("Mardile <cycle> prochain|suivant|d'apr\232s",
-5.52246041819533),
("aujourd'huifin de journ\233e", -6.215607598755275),
("le <day-of-month> (non ordinal)Octobre", -6.215607598755275),
("intersectdu|dans le <part-of-day>", -4.4238481295272205),
-5.524456426842045),
("aujourd'huifin de journ\233e", -6.2176036074019905),
("le <day-of-month> (non ordinal)Octobre", -6.2176036074019905),
("intersectdu|dans le <part-of-day>", -4.425844138173935),
("le <day-of-month> \224 <datetime>du|dans le <part-of-day>",
-5.810142490647111),
("hh(:|h)mm (time-of-day)Jeudi", -6.215607598755275),
("le <time>Juillet", -6.215607598755275),
("Lundi<day-of-month> <named-month>", -6.215607598755275),
-5.812138499293826),
("hh(:|h)mm (time-of-day)Jeudi", -6.2176036074019905),
("le <time>Juillet", -6.2176036074019905),
("Lundi<day-of-month> <named-month>", -6.2176036074019905),
("Mercredile <cycle> prochain|suivant|d'apr\232s",
-5.52246041819533),
("Lundifin d'apr\232s-midi", -5.810142490647111),
("Lundile <time>", -5.810142490647111),
-5.524456426842045),
("Lundifin d'apr\232s-midi", -5.812138499293826),
("Lundile <time>", -5.812138499293826),
("Mardi<named-month|named-day> suivant|d'apr\232s",
-5.810142490647111),
("Mars<dim time> du matin", -6.215607598755275),
("le <time>Novembre", -5.52246041819533),
("intersectd\233but d'apr\232s-midi", -6.215607598755275),
("<datetime> - <datetime> (interval)Jeudi", -5.29931686688112),
-5.812138499293826),
("Mars<dim time> du matin", -6.2176036074019905),
("le <time>Novembre", -5.524456426842045),
("intersectd\233but d'apr\232s-midi", -6.2176036074019905),
("<datetime> - <datetime> (interval)Jeudi", -5.301312875527835),
("Mercredi<named-month|named-day> suivant|d'apr\232s",
-5.810142490647111),
-5.812138499293826),
("<time-of-day> - <time-of-day> (interval)Jeudi",
-4.962844630259907),
("Samedi<day-of-month> <named-month>", -6.215607598755275),
("<time-of-day> heuresce <time>", -6.215607598755275),
("le <time>d\233but d'apr\232s-midi", -6.215607598755275),
("day of month (premier)Juillet", -5.52246041819533),
-4.964840638906622),
("Samedi<day-of-month> <named-month>", -6.2176036074019905),
("<time-of-day> heuresce <time>", -6.2176036074019905),
("le <time>d\233but d'apr\232s-midi", -6.2176036074019905),
("day of month (premier)Juillet", -5.524456426842045),
("<day-of-month> <named-month>du|dans le <part-of-day>",
-5.810142490647111),
("Fevriermilieu d'apr\232s-midi", -6.215607598755275),
("Mercredi\224|vers <time-of-day>", -6.215607598755275),
("intersectNovembre", -4.962844630259907),
("le <time><dim time> du matin", -6.215607598755275),
("Fevrierfin d'apr\232s-midi", -6.215607598755275),
-5.812138499293826),
("Fevriermilieu d'apr\232s-midi", -6.2176036074019905),
("Mercredi\224|vers <time-of-day>", -6.2176036074019905),
("intersectNovembre", -4.964840638906622),
("le <time><dim time> du matin", -6.2176036074019905),
("Fevrierfin d'apr\232s-midi", -6.2176036074019905),
("le <day-of-month> (non ordinal)\224|vers <time-of-day>",
-4.711530201979001),
-4.713526210625716),
("<day-of-month> <named-month>d\233but de soir\233e",
-6.215607598755275),
("hierdu|dans le <part-of-day>", -6.215607598755275),
("le <time>d\233but de soir\233e", -6.215607598755275),
("Mercredice|dans le <cycle>", -6.215607598755275),
("Fevrierfin de soir\233e", -6.215607598755275),
("Mardice|dans le <cycle>", -6.215607598755275),
("dayminute", -4.6061696863211745),
("intersectd\233but de journ\233e", -6.215607598755275),
("<ordinal> <cycle> de <time>year", -5.810142490647111),
("Fevriermilieu de matin\233e", -6.215607598755275),
("le <time>\224|vers <time-of-day>", -5.116995310087166),
-6.2176036074019905),
("hierdu|dans le <part-of-day>", -6.2176036074019905),
("le <time>d\233but de soir\233e", -6.2176036074019905),
("Mercredice|dans le <cycle>", -6.2176036074019905),
("Fevrierfin de soir\233e", -6.2176036074019905),
("Mardice|dans le <cycle>", -6.2176036074019905),
("dayminute", -4.60816569496789),
("intersectd\233but de journ\233e", -6.2176036074019905),
("<ordinal> <cycle> de <time>year", -5.812138499293826),
("Fevriermilieu de matin\233e", -6.2176036074019905),
("le <time>\224|vers <time-of-day>", -5.1189913187338805),
("<day-of-month> <named-month><dim time> du matin",
-6.215607598755275),
("intersectyear", -5.52246041819533),
("Fevrierfin de matin\233e", -6.215607598755275),
("minuteday", -3.4747675748300746),
("le <time>d\233but de matin\233e", -6.215607598755275),
("Mardile <time>", -4.829313237635384),
("aujourd'hui\224|vers <time-of-day>", -5.29931686688112),
-6.2176036074019905),
("intersectyear", -5.524456426842045),
("Fevrierfin de matin\233e", -6.2176036074019905),
("minuteday", -3.476763583476789),
("le <time>d\233but de matin\233e", -6.2176036074019905),
("Mardile <time>", -4.8313092462821),
("aujourd'hui\224|vers <time-of-day>", -5.301312875527835),
("<day-of-month> <named-month>milieu d'apr\232s-midi",
-6.215607598755275),
("day of month (premier)intersect", -6.215607598755275),
-6.2176036074019905),
("day of month (premier)intersect", -6.2176036074019905),
("<day-of-month> <named-month>fin d'apr\232s-midi",
-6.215607598755275),
("day of month (premier)Janvier", -6.215607598755275),
("le <time>milieu de matin\233e", -6.215607598755275),
("aujourd'huid\233but de matin\233e", -5.116995310087166),
("Fevrierd\233but de soir\233e", -6.215607598755275),
("apr\232s <time-of-day|day>Jeudi", -5.810142490647111),
("Mercredile <time>", -4.829313237635384),
("le <time>fin de soir\233e", -6.215607598755275),
-6.2176036074019905),
("day of month (premier)Janvier", -6.2176036074019905),
("le <time>milieu de matin\233e", -6.2176036074019905),
("aujourd'huid\233but de matin\233e", -5.1189913187338805),
("Fevrierd\233but de soir\233e", -6.2176036074019905),
("apr\232s <time-of-day|day>Jeudi", -5.812138499293826),
("Mercredile <time>", -4.8313092462821),
("le <time>fin de soir\233e", -6.2176036074019905),
("de <time-of-day> - <time-of-day> (interval)Jeudi",
-5.29931686688112),
-5.301312875527835),
("<day-of-month> <named-month>milieu de matin\233e",
-6.215607598755275),
-6.2176036074019905),
("<day-of-month> <named-month>fin de soir\233e",
-6.215607598755275),
-6.2176036074019905),
("<day-of-month> <named-month>fin de matin\233e",
-6.215607598755275),
("<time-of-day> heuresce <part-of-day>", -5.810142490647111),
("Mercredi<day-of-month> <named-month>", -6.215607598755275),
("aujourd'huid\233but d'apr\232s-midi", -6.215607598755275),
("le <time>milieu d'apr\232s-midi", -6.215607598755275),
("apr\232s <time-of-day|day>Novembre", -5.52246041819533),
-6.2176036074019905),
("<time-of-day> heuresce <part-of-day>", -5.812138499293826),
("Mercredi<day-of-month> <named-month>", -6.2176036074019905),
("aujourd'huid\233but d'apr\232s-midi", -6.2176036074019905),
("le <time>milieu d'apr\232s-midi", -6.2176036074019905),
("apr\232s <time-of-day|day>Novembre", -5.524456426842045),
("\224|vers <time-of-day>du|dans le <part-of-day>",
-5.116995310087166),
-5.1189913187338805),
("entre <time-of-day> et <time-of-day> (interval)Jeudi",
-5.810142490647111),
("intersectintersect", -6.215607598755275),
("dayweek", -4.018383021419056),
-5.812138499293826),
("intersectintersect", -6.2176036074019905),
("dayweek", -4.0203790300657705),
("entre <datetime> et <datetime> (interval)Juillet",
-5.810142490647111),
("intersectMars", -6.215607598755275),
("weekyear", -4.829313237635384),
("le <time>Mars", -5.810142490647111),
("apr\232s le <day-of-month>Mars", -6.215607598755275),
("hh(:|h)mm (time-of-day)intersect", -5.810142490647111),
-5.812138499293826),
("intersectMars", -6.2176036074019905),
("weekyear", -4.8313092462821),
("le <time>Mars", -5.812138499293826),
("apr\232s le <day-of-month>Mars", -6.2176036074019905),
("hh(:|h)mm (time-of-day)intersect", -5.812138499293826),
("<day-of-month> <named-month>fin de journ\233e",
-6.215607598755275),
-6.2176036074019905),
("<day-of-month> <named-month>milieu de journ\233e",
-6.215607598755275),
("le <time>fin de journ\233e", -6.215607598755275),
("dd/-mm\224|vers <time-of-day>", -5.810142490647111),
("intersectfin de matin\233e", -6.215607598755275),
("Fevrierd\233but de journ\233e", -6.215607598755275),
("Vendrediintersect", -6.215607598755275),
("<day-of-month> <named-month>intersect", -6.215607598755275),
("intersectfin de soir\233e", -6.215607598755275),
("intersectmilieu de matin\233e", -6.215607598755275),
("intersect\224|vers <time-of-day>", -5.52246041819533),
("le <time>year", -4.711530201979001),
("hh(:|h)mm (time-of-day)Samedi", -6.215607598755275),
-6.2176036074019905),
("le <time>fin de journ\233e", -6.2176036074019905),
("dd/-mm\224|vers <time-of-day>", -5.812138499293826),
("intersectfin de matin\233e", -6.2176036074019905),
("Fevrierd\233but de journ\233e", -6.2176036074019905),
("Vendrediintersect", -6.2176036074019905),
("<day-of-month> <named-month>intersect", -6.2176036074019905),
("intersectfin de soir\233e", -6.2176036074019905),
("intersectmilieu de matin\233e", -6.2176036074019905),
("intersect\224|vers <time-of-day>", -5.524456426842045),
("le <time>year", -4.713526210625716),
("hh(:|h)mm (time-of-day)Samedi", -6.2176036074019905),
("le <day-of-month> (non ordinal)apr\232s <time-of-day|day>",
-6.215607598755275),
("Fevrierfin de journ\233e", -6.215607598755275),
("Fevriermilieu de journ\233e", -6.215607598755275),
("le <time>d\233but de journ\233e", -6.215607598755275),
("intersectd\233but de matin\233e", -6.215607598755275)],
-6.2176036074019905),
("Fevrierfin de journ\233e", -6.2176036074019905),
("Fevriermilieu de journ\233e", -6.2176036074019905),
("le <time>d\233but de journ\233e", -6.2176036074019905),
("intersectd\233but de matin\233e", -6.2176036074019905)],
n = 389},
koData =
ClassData{prior = -1.6282080151160907, unseen = -6.025865973825314,
ClassData{prior = -1.6032966444120178, unseen = -6.045005314036012,
likelihoods =
HashMap.fromList
[("demain<time-of-day> heures", -5.330300412401088),
("hourday", -3.1902342489048165),
("<day-of-month> <named-month>year", -5.330300412401088),
("demainavant <time-of-day>", -5.330300412401088),
("dayhour", -2.804571768092832),
[("demain<time-of-day> heures", -5.349485653122436),
("hourday", -3.2094194896261654),
("<day-of-month> <named-month>year", -5.349485653122436),
("demainavant <time-of-day>", -5.349485653122436),
("dayhour", -2.8237570088141806),
("<time-of-day> - <time-of-day> (interval)Juillet",
-4.414009680526933),
-4.433194921248281),
("Jeudi<time-of-day> - <time-of-day> (interval)",
-4.924835304292923),
("daymonth", -3.944006051281197),
("monthyear", -4.637153231841142),
("le <cycle> de <time>Octobre", -4.924835304292923),
("houryear", -5.330300412401088),
-4.944020545014272),
("daymonth", -3.9631912920025454),
("monthyear", -4.65633847256249),
("le <cycle> de <time>Octobre", -4.944020545014272),
("houryear", -5.349485653122436),
("<time-of-day> heuresdu|dans le <part-of-day>",
-4.637153231841142),
("le <time>du|dans le <part-of-day>", -4.924835304292923),
("Marsyear", -5.330300412401088),
("Dimanche<day-of-month> <named-month>", -4.924835304292923),
-4.65633847256249),
("le <time>du|dans le <part-of-day>", -4.944020545014272),
("Marsyear", -5.349485653122436),
("Dimanche<day-of-month> <named-month>", -4.944020545014272),
("le <time>Mercredi", -5.349485653122436),
("<time-of-day> heuresle <day-of-month> (non ordinal)",
-4.414009680526933),
-4.433194921248281),
("<dim time> <part-of-day>apr\232s <time-of-day|day>",
-5.330300412401088),
-5.349485653122436),
("le <day-of-month> (non ordinal)<time-of-day> heures",
-5.330300412401088),
("Jeudiapr\232s <time-of-day|day>", -4.924835304292923),
("aujourd'huidu|dans le <part-of-day>", -4.924835304292923),
-5.349485653122436),
("Jeudiapr\232s <time-of-day|day>", -4.944020545014272),
("aujourd'huidu|dans le <part-of-day>", -4.944020545014272),
("de <datetime> - <datetime> (interval)Juillet",
-4.924835304292923),
("monthhour", -3.944006051281197),
("hourmonth", -3.944006051281197),
-4.944020545014272),
("monthhour", -3.9631912920025454),
("hourmonth", -3.9631912920025454),
("Vendredi<time-of-day> - <time-of-day> (interval)",
-4.07753744390572),
("dayday", -3.7208624999669873),
("Septembreyear", -5.330300412401088),
("hourhour", -3.7208624999669873),
("\224|vers <time-of-day>Jeudi", -4.637153231841142),
("dayyear", -4.231688123732978),
("demain\224|vers <time-of-day>", -4.924835304292923),
("\224|vers <time-of-day>demain", -5.330300412401088),
("Mars\224|vers <time-of-day>", -4.231688123732978),
("Lundi<datetime> - <datetime> (interval)", -4.924835304292923),
("intersect by 'de' or ','year", -4.924835304292923),
-4.096722684627068),
("dayday", -3.477683476220845),
("Septembreyear", -5.349485653122436),
("hourhour", -3.7400477406883357),
("\224|vers <time-of-day>Jeudi", -4.65633847256249),
("dayyear", -4.250873364454327),
("demain\224|vers <time-of-day>", -4.944020545014272),
("\224|vers <time-of-day>demain", -5.349485653122436),
("Mars\224|vers <time-of-day>", -4.250873364454327),
("Lundi<datetime> - <datetime> (interval)", -4.944020545014272),
("intersect by 'de' or ','year", -4.944020545014272),
("apr\232s <time-of-day|day>le <day-of-month> (non ordinal)",
-4.924835304292923),
("hh(:|h)mm (time-of-day)Jeudi", -5.330300412401088),
("weekmonth", -4.924835304292923),
("le <day-of-month> (non ordinal)Juillet", -4.924835304292923),
("le <day-of-month> (non ordinal)year", -4.924835304292923),
-4.944020545014272),
("hh(:|h)mm (time-of-day)Jeudi", -5.349485653122436),
("weekmonth", -4.944020545014272),
("le <day-of-month> (non ordinal)Juillet", -4.944020545014272),
("le <day-of-month> (non ordinal)year", -4.944020545014272),
("<time-of-day> - <time-of-day> (interval)Septembre",
-5.330300412401088),
-5.349485653122436),
("Samedi<time-of-day> - <time-of-day> (interval)",
-4.924835304292923),
("<time-of-day> heuresdd/-mm", -5.330300412401088),
("<hour-of-day> et quartdemain", -4.924835304292923),
-4.944020545014272),
("<time-of-day> heuresdd/-mm", -5.349485653122436),
("<hour-of-day> et quartdemain", -4.944020545014272),
("<time-of-day> - <time-of-day> (interval)du|dans le <part-of-day>",
-4.924835304292923),
("yearmonth", -5.330300412401088),
("intersectyear", -5.330300412401088),
("minuteday", -4.414009680526933),
("Mardile <time>", -5.330300412401088),
("Fevrierdu|dans le <part-of-day>", -4.924835304292923),
("aujourd'hui\224|vers <time-of-day>", -4.924835304292923),
("Mercredile <time>", -5.330300412401088),
-4.944020545014272),
("yearmonth", -5.349485653122436),
("intersectyear", -5.349485653122436),
("minuteday", -4.433194921248281),
("Mardile <time>", -5.349485653122436),
("Fevrierdu|dans le <part-of-day>", -4.944020545014272),
("aujourd'hui\224|vers <time-of-day>", -4.944020545014272),
("Mercredile <time>", -5.349485653122436),
("le <day-of-month> (non ordinal)avant <time-of-day>",
-5.330300412401088),
("Mercredi<day-of-month> <named-month>", -4.637153231841142),
("<day-of-week> <day-of-month>Juillet", -4.231688123732978),
-5.349485653122436),
("Mercredi<day-of-month> <named-month>", -4.65633847256249),
("<day-of-week> <day-of-month>Juillet", -4.250873364454327),
("day of month (premier)Mercredi", -4.944020545014272),
("<time-of-day> - <time-of-day> (interval)intersect",
-5.330300412401088),
("Fevrieryear", -5.330300412401088),
("Jeudi<time-of-day> heures", -4.924835304292923),
("avant <time-of-day>Jeudi", -5.330300412401088),
-5.349485653122436),
("Fevrieryear", -5.349485653122436),
("Jeudi<time-of-day> heures", -4.944020545014272),
("avant <time-of-day>Jeudi", -5.349485653122436),
("<dim time> <part-of-day><time-of-day> heures",
-5.330300412401088),
("<time-of-day> heuresJeudi", -4.231688123732978)],
n = 95}}),
-5.349485653122436),
("<time-of-day> heuresJeudi", -4.250873364454327)],
n = 98}}),
("Janvier",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.0986122886681098,
@ -1162,11 +1177,23 @@ classifiers
n = 9}}),
("Mercredi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -3.2188758248682006,
likelihoods = HashMap.fromList [("", 0.0)], n = 23},
ClassData{prior = 0.0, unseen = -3.295836866004329,
likelihoods = HashMap.fromList [("", 0.0)], n = 25},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
("nth <time> of <time>",
Classifier{okData =
ClassData{prior = 0.0, unseen = -1.9459101490553135,
likelihoods =
HashMap.fromList
[("ordinals (premier..seizieme)Mercredi<cycle> prochain|suivant|d'apr\232s",
-0.6931471805599453),
("daymonth", -0.6931471805599453)],
n = 2},
koData =
ClassData{prior = -infinity, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [], n = 0}}),
("Mardi",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.833213344056216,
@ -1188,51 +1215,53 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("intersect by 'de' or ','",
Classifier{okData =
ClassData{prior = -0.26469255422708216,
unseen = -4.499809670330265,
ClassData{prior = -0.2578291093020998, unseen = -4.532599493153256,
likelihoods =
HashMap.fromList
[("dayhour", -3.39002408106403),
[("dayhour", -3.4231762883809305),
("Jeudi<time-of-day> - <time-of-day> (interval)",
-3.39002408106403),
("daymonth", -3.7954891891721947),
("Dimanchele <time>", -3.7954891891721947),
("fin du moisMars", -3.7954891891721947),
-3.4231762883809305),
("daymonth", -3.4231762883809305),
("Dimanchele <time>", -3.828641396489095),
("fin du moisMars", -3.828641396489095),
("Lundile <cycle> prochain|suivant|d'apr\232s",
-3.7954891891721947),
("hourmonth", -3.7954891891721947),
("dayday", -1.8495790401168812),
-3.828641396489095),
("hourmonth", -3.828641396489095),
("dayday", -1.8827312474337816),
("Mardile <cycle> prochain|suivant|d'apr\232s",
-3.1023420086122493),
-3.1354942159291497),
("Mercredile <cycle> prochain|suivant|d'apr\232s",
-3.1023420086122493),
("Lundile <time>", -3.39002408106403),
-3.1354942159291497),
("Lundile <time>", -3.4231762883809305),
("Mardi<named-month|named-day> suivant|d'apr\232s",
-3.39002408106403),
-3.4231762883809305),
("Mercredi<named-month|named-day> suivant|d'apr\232s",
-3.39002408106403),
("Mardile <time>", -2.409194828052304),
("Mercredile <time>", -2.409194828052304),
("dayweek", -1.6554230256759237),
("week-endSeptembre", -3.7954891891721947),
("Dimanchele <cycle> dernier", -3.7954891891721947)],
n = 33},
-3.4231762883809305),
("Mardile <time>", -2.4423470353692043),
("Mercredile <time>", -2.4423470353692043),
("Mercredi<cycle> prochain|suivant|d'apr\232s",
-3.828641396489095),
("dayweek", -1.6885752329928243),
("week-endSeptembre", -3.828641396489095),
("Dimanchele <cycle> dernier", -3.828641396489095)],
n = 34},
koData =
ClassData{prior = -1.4586150226995167, unseen = -3.784189633918261,
ClassData{prior = -1.4816045409242156,
unseen = -3.8066624897703196,
likelihoods =
HashMap.fromList
[("en semaineSeptembre", -2.662587827025453),
("hourday", -3.068052935133617),
("dayhour", -3.068052935133617),
("daymonth", -2.151762203259462),
("du|dans le <part-of-day>noel", -3.068052935133617),
("hourmonth", -2.662587827025453),
("dayday", -2.662587827025453),
("en semaineintersect", -2.662587827025453),
("Mardile <time>", -3.068052935133617),
("Mercredile <time>", -3.068052935133617),
("Jeudi<time-of-day> heures", -3.068052935133617),
("week-endSeptembre", -2.662587827025453)],
[("en semaineSeptembre", -2.6855773452501515),
("hourday", -3.0910424533583156),
("dayhour", -3.0910424533583156),
("daymonth", -2.174751721484161),
("du|dans le <part-of-day>noel", -3.0910424533583156),
("hourmonth", -2.6855773452501515),
("dayday", -2.6855773452501515),
("en semaineintersect", -2.6855773452501515),
("Mardile <time>", -3.0910424533583156),
("Mercredile <time>", -3.0910424533583156),
("Jeudi<time-of-day> heures", -3.0910424533583156),
("week-endSeptembre", -2.6855773452501515)],
n = 10}}),
("milieu d'apr\232s-midi",
Classifier{okData =
@ -1508,10 +1537,11 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("ordinals (premier..seizieme)",
Classifier{okData =
ClassData{prior = -0.916290731874155, unseen = -1.791759469228055,
likelihoods = HashMap.fromList [("", 0.0)], n = 4},
ClassData{prior = -0.6931471805599453,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -0.5108256237659907,
ClassData{prior = -0.6931471805599453,
unseen = -2.0794415416798357,
likelihoods = HashMap.fromList [("", 0.0)], n = 6}}),
("minute (grain)",
@ -2037,12 +2067,13 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("day of month (premier)",
Classifier{okData =
ClassData{prior = -5.715841383994864e-2,
ClassData{prior = -0.16251892949777494,
unseen = -2.9444389791664407,
likelihoods = HashMap.fromList [("", 0.0)], n = 17},
koData =
ClassData{prior = -2.890371757896165, unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
ClassData{prior = -1.8971199848858813,
unseen = -1.6094379124341003,
likelihoods = HashMap.fromList [("", 0.0)], n = 3}}),
("jour (grain)",
Classifier{okData =
ClassData{prior = -0.2744368457017603, unseen = -3.044522437723423,
@ -2220,20 +2251,20 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("<cycle> prochain|suivant|d'apr\232s",
Classifier{okData =
ClassData{prior = -8.338160893905101e-2,
unseen = -4.007333185232471,
ClassData{prior = -7.696104113612832e-2,
unseen = -4.07753744390572,
likelihoods =
HashMap.fromList
[("week", -1.0986122886681098),
("ann\233e (grain)", -3.295836866004329),
("semaine (grain)", -1.0986122886681098),
("mois (grain)", -2.890371757896165),
("day", -2.6026896854443837), ("year", -3.295836866004329),
("jour (grain)", -2.6026896854443837),
("month", -2.890371757896165)],
n = 23},
[("week", -1.1700712526502546),
("ann\233e (grain)", -3.367295829986474),
("semaine (grain)", -1.1700712526502546),
("mois (grain)", -2.451005098112319),
("day", -2.6741486494265287), ("year", -3.367295829986474),
("jour (grain)", -2.6741486494265287),
("month", -2.451005098112319)],
n = 25},
koData =
ClassData{prior = -2.5257286443082556,
ClassData{prior = -2.6026896854443837,
unseen = -2.5649493574615367,
likelihoods =
HashMap.fromList
@ -2421,52 +2452,54 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 2}}),
("le <time>",
Classifier{okData =
ClassData{prior = -0.22440062250426085, unseen = -5.84354441703136,
ClassData{prior = -0.23309388216737778,
unseen = -5.8522024797744745,
likelihoods =
HashMap.fromList
[("week", -2.5825451193519164),
[("week", -2.591228241925377),
("<named-month|named-day> suivant|d'apr\232s",
-3.643417080037179),
("<ordinal> <cycle> de <time>", -4.454347296253507),
-3.6521002026106397),
("<ordinal> <cycle> de <time>", -4.4630304188269685),
("premi\232re quinzaine de <named-month>(interval)",
-5.147494476813453),
("intersect", -2.229723744729174),
("soir de no\235l", -5.147494476813453),
("en semaine", -3.442746384575028),
("toussaint", -4.742029368705289), ("day", -1.2973468751033945),
-5.156177599386914),
("intersect", -2.238406867302635),
("soir de no\235l", -5.156177599386914),
("en semaine", -3.4514295071484886),
("nth <time> of <time>", -5.156177599386914),
("toussaint", -4.750712491278749), ("day", -1.2954478883463185),
("deuxi\232me quinzaine de <named-month>(interval)",
-5.147494476813453),
("<dim time> <part-of-day>", -3.2015843277581397),
("dd/-mm", -3.894731508318085),
("dd/-mm/-yyyy", -4.454347296253507),
("dd mm yyyy", -3.894731508318085),
("day of month (premier)", -3.894731508318085),
("dd mm", -3.894731508318085), ("hour", -2.177080011243752),
("month", -4.454347296253507),
("dernier <cycle> de <time> (latent)", -4.231203744939298),
("<day-of-month> <named-month>", -2.5825451193519164),
("<cycle> prochain|suivant|d'apr\232s", -2.7961192196499756),
("dernier week-end de <time>", -5.147494476813453),
("<ordinal> week-end de <time>", -4.742029368705289),
("<cycle> dernier", -4.048882188145344)],
n = 159},
-5.156177599386914),
("<dim time> <part-of-day>", -3.2102674503316004),
("dd/-mm", -3.903414630891546),
("dd/-mm/-yyyy", -4.4630304188269685),
("dd mm yyyy", -3.903414630891546),
("day of month (premier)", -3.903414630891546),
("dd mm", -3.903414630891546), ("hour", -2.1857631338172125),
("month", -4.4630304188269685),
("dernier <cycle> de <time> (latent)", -4.239886867512759),
("<day-of-month> <named-month>", -2.591228241925377),
("<cycle> prochain|suivant|d'apr\232s", -2.8048023422234363),
("dernier week-end de <time>", -5.156177599386914),
("<ordinal> week-end de <time>", -4.750712491278749),
("<cycle> dernier", -4.057565310718804)],
n = 160},
koData =
ClassData{prior = -1.604425370610556, unseen = -4.672828834461907,
ClassData{prior = -1.5705980791178364, unseen = -4.718498871295094,
likelihoods =
HashMap.fromList
[("<named-month|named-day> suivant|d'apr\232s",
-3.970291913552122),
("intersect", -3.5648268054439574),
("en semaine", -1.890850371872286),
("day", -1.3312345839368633), ("dd/-mm", -3.2771447329921766),
-4.0163830207523885),
("intersect", -3.3232358401924436),
("en semaine", -1.936941479072553),
("day", -1.3083328196501787), ("dd/-mm", -3.3232358401924436),
("<named-month|named-day> dernier|pass\233",
-3.5648268054439574),
("day of month (premier)", -3.970291913552122),
("dd mm", -3.2771447329921766), ("hour", -2.0243817644968085),
("<day-of-month> <named-month>", -3.5648268054439574),
-3.6109179126442243),
("day of month (premier)", -3.6109179126442243),
("dd mm", -3.3232358401924436), ("hour", -2.0704728716970755),
("<day-of-month> <named-month>", -3.6109179126442243),
("<time-of-day> - <time-of-day> (interval)",
-2.178532444324067)],
n = 40}}),
-2.2246235515243336)],
n = 42}}),
("apr\232s le <day-of-month>",
Classifier{okData =
ClassData{prior = -0.40546510810816444,

View File

@ -866,4 +866,8 @@ allExamples = concat
[ "plus tard dans la soirée"
, "un peu plus tard dans la soirée"
]
, examples (datetime (2013, 3, 6, 0, 0, 0) Day)
[ "le premier mercredi de mois prochain"
, "premier mercredi du mois prochain"
]
]

View File

@ -14,7 +14,6 @@ module Duckling.Time.FR.Rules
( rules
) where
import Data.Text (Text)
import Prelude
import qualified Data.Text as Text
@ -24,6 +23,7 @@ import Duckling.Regex.Types
import Duckling.Time.Helpers
import Duckling.Time.Types (TimeData (..))
import Duckling.Types
import qualified Duckling.Ordinal.Types as TOrdinal
import qualified Duckling.Time.Types as TTime
import qualified Duckling.TimeGrain.Types as TG
@ -317,6 +317,37 @@ ruleNDerniersCycle = Rule
_ -> Nothing
}
ruleNthTimeOfTime :: Rule
ruleNthTimeOfTime = Rule
{ name = "nth <day-of-week> of <month-or-greater>"
, pattern =
[ dimension Ordinal
, Predicate isADayOfWeek
, regex "d[eu]"
, Predicate $ not . isGrainFinerThan TG.Month
]
, prod = \tokens -> case tokens of
(Token Ordinal od:Token Time td1:_:Token Time td2:_) -> Token Time .
predNth (TOrdinal.value od - 1) False <$> intersect td2 td1
_ -> Nothing
}
ruleTheNthTimeOfTime :: Rule
ruleTheNthTimeOfTime = Rule
{ name = "the nth <day-of-week> of <month-or-greater>"
, pattern =
[ regex "le"
, dimension Ordinal
, Predicate isADayOfWeek
, regex "d[eu]"
, Predicate $ not . isGrainFinerThan TG.Month
]
, prod = \tokens -> case tokens of
(_:Token Ordinal od:Token Time td1:_:Token Time td2:_) -> Token Time .
predNth (TOrdinal.value od - 1) False <$> intersect td2 td1
_ -> Nothing
}
ruleAvantTimeofday :: Rule
ruleAvantTimeofday = Rule
{ name = "avant <time-of-day>"
@ -2070,6 +2101,8 @@ rules =
, ruleDbutDAnnee
, rulePlusTard
, rulePlusTardPartofday
, ruleNthTimeOfTime
, ruleTheNthTimeOfTime
]
++ ruleMonths
++ ruleDaysOfWeek