Time/EN: afternoonish

Summary: Apparently it's a thing.

Reviewed By: blandinw

Differential Revision: D5199823

fbshipit-source-id: d2ed2aa
This commit is contained in:
Julien Odent 2017-06-09 09:21:03 -07:00 committed by Facebook Github Bot
parent 486ab645fc
commit cd3f3dd2f4
3 changed files with 38 additions and 33 deletions

View File

@ -169,42 +169,41 @@ classifiers
n = 3}}),
("<time> <part-of-day>",
Classifier{okData =
ClassData{prior = -0.10536051565782628,
unseen = -4.382026634673881,
ClassData{prior = -9.844007281325252e-2,
unseen = -4.430816798843313,
likelihoods =
HashMap.fromList
[("<day-of-month> (ordinal)in|during the <part-of-day>",
-3.676300671907076),
("dayhour", -1.5968591302272404),
("Mondayearly morning", -3.270835563798912),
("time-of-day (latent)tonight", -3.270835563798912),
("hourhour", -2.2900063107871858),
-3.7256934272366524),
("dayhour", -1.5284688499004333),
("Mondayearly morning", -3.3202283191284883),
("time-of-day (latent)tonight", -3.3202283191284883),
("hourhour", -2.339399066116762),
("<time-of-day> o'clockin|during the <part-of-day>",
-3.676300671907076),
("todaypart of days", -3.676300671907076),
("minutehour", -2.5776883832389665),
-3.7256934272366524),
("todaypart of days", -3.7256934272366524),
("minutehour", -2.627081138568543),
("at <time-of-day>in|during the <part-of-day>",
-3.270835563798912),
("time-of-day (latent)this <part-of-day>", -3.676300671907076),
("Mondayin|during the <part-of-day>", -3.676300671907076),
("intersectpart of days", -3.676300671907076),
("intersectin|during the <part-of-day>", -3.676300671907076),
-3.3202283191284883),
("time-of-day (latent)this <part-of-day>", -3.7256934272366524),
("Mondayin|during the <part-of-day>", -3.7256934272366524),
("intersectpart of days", -3.7256934272366524),
("intersectin|during the <part-of-day>", -3.7256934272366524),
("<day-of-month> (ordinal or number) of <named-month>in|during the <part-of-day>",
-3.676300671907076),
-3.7256934272366524),
("the <day-of-month> (ordinal)in|during the <part-of-day>",
-3.676300671907076),
("tomorrowpart of days", -2.5776883832389665),
("hh:mmin|during the <part-of-day>", -2.9831534913471307),
-3.7256934272366524),
("tomorrowpart of days", -2.339399066116762),
("hh:mmin|during the <part-of-day>", -3.0325462466767075),
("time-of-day (latent)in|during the <part-of-day>",
-3.676300671907076),
-3.7256934272366524),
("hhmm (latent)in|during the <part-of-day>",
-3.676300671907076),
("yesterdaypart of days", -3.676300671907076),
("Mondaypart of days", -3.676300671907076)],
n = 27},
-3.7256934272366524),
("yesterdaypart of days", -3.7256934272366524),
("Mondaypart of days", -3.7256934272366524)],
n = 29},
koData =
ClassData{prior = -2.3025850929940455,
unseen = -3.4657359027997265,
ClassData{prior = -2.367123614131617, unseen = -3.4657359027997265,
likelihoods =
HashMap.fromList
[("yearhour", -2.740840023925201),
@ -1102,8 +1101,8 @@ classifiers
n = 1}}),
("tomorrow",
Classifier{okData =
ClassData{prior = 0.0, unseen = -2.833213344056216,
likelihoods = HashMap.fromList [("", 0.0)], n = 15},
ClassData{prior = 0.0, unseen = -2.9444389791664407,
likelihoods = HashMap.fromList [("", 0.0)], n = 17},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}}),
@ -2100,11 +2099,11 @@ classifiers
likelihoods = HashMap.fromList [], n = 0}}),
("part of days",
Classifier{okData =
ClassData{prior = -4.445176257083381e-2,
unseen = -3.1780538303479458,
likelihoods = HashMap.fromList [("", 0.0)], n = 22},
ClassData{prior = -4.0821994520255166e-2,
unseen = -3.258096538021482,
likelihoods = HashMap.fromList [("", 0.0)], n = 24},
koData =
ClassData{prior = -3.1354942159291497,
ClassData{prior = -3.2188758248682006,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}}),
("this <time>",

View File

@ -756,6 +756,10 @@ allExamples = concat
, "at 5pm tomorrow"
, "tomorrow at 5pm"
]
, examples (datetimeInterval ((2013, 2, 13, 12, 0, 0), (2013, 2, 13, 19, 0, 0)) Hour)
[ "tomorrow afternoon"
, "tomorrow afternoonish"
]
, examples (datetimeInterval ((2013, 2, 13, 13, 0, 0), (2013, 2, 13, 15, 0, 0)) Hour)
[ "1pm-2pm tomorrow"
]

View File

@ -721,7 +721,9 @@ ruleNoonMidnightEOD = Rule
rulePartOfDays :: Rule
rulePartOfDays = Rule
{ name = "part of days"
, pattern = [regex "(morning|after ?noo?n|evening|night|(at )?lunch)"]
, pattern =
[ regex "(morning|after ?noo?n(ish)?|evening|night|(at )?lunch)"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (match:_)):_) -> do
let (start, end) = case Text.toLower match of