Duration/EN: <integer> and a half minutes

Summary: Add rule for "<integer> and a half minutes"

Differential Revision: D17108126

fbshipit-source-id: beaf3eea976572fdec292df6c17303abeb8fcdbf
This commit is contained in:
Chinmay Deshmukh 2019-08-30 13:23:09 -07:00 committed by Facebook Github Bot
parent a0ca037668
commit 436a97e738
15 changed files with 32 additions and 13 deletions

View File

@ -97,4 +97,9 @@ allExamples = concat
-- Oxford comma not supported:
-- , "1 year, 2 days, 3 hours, and 4 seconds"
]
, examples (DurationData 330 Second)
[ "5 and a half minutes"
, "five and half min"
, "5 and an half minute"
]
]

View File

@ -125,6 +125,19 @@ ruleDurationAndHalfHour = Rule
_ -> Nothing
}
ruleDurationAndHalfMinute :: Rule
ruleDurationAndHalfMinute = Rule
{ name = "<integer> and a half minutes"
, pattern =
[ Predicate isNatural
, regex "and (an? )?half min(ute)?s?"
]
, prod = \case
(Token Numeral NumeralData{TNumeral.value = v}:_) ->
Just . Token Duration . duration TG.Second $ 30 + 60 * floor v
_ -> Nothing
}
ruleDurationA :: Rule
ruleDurationA = Rule
{ name = "a <unit-of-duration>"
@ -218,6 +231,7 @@ rules =
, ruleDurationNumeralMore
, ruleDurationDotNumeralHours
, ruleDurationAndHalfHour
, ruleDurationAndHalfMinute
, ruleDurationA
, ruleDurationHalfATimeGrain
, ruleDurationOneGrainAndHalf

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3891,4 +3891,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3824,4 +3824,4 @@ classifiers
koData =
ClassData{prior = -1.9459101490553135,
unseen = -1.0986122886681098,
likelihoods = HashMap.fromList [("", 0.0)], n = 1}})]
likelihoods = HashMap.fromList [("", 0.0)], n = 1}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3966,4 +3966,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3795,4 +3795,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]

View File

@ -3739,4 +3739,4 @@ classifiers
likelihoods = HashMap.fromList [("", 0.0)], n = 6},
koData =
ClassData{prior = -infinity, unseen = -0.6931471805599453,
likelihoods = HashMap.fromList [], n = 0}})]
likelihoods = HashMap.fromList [], n = 0}})]