mirror of
https://github.com/facebook/duckling.git
synced 2024-11-24 07:23:03 +03:00
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:
parent
a0ca037668
commit
436a97e738
@ -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"
|
||||
]
|
||||
]
|
||||
|
@ -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
|
||||
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
@ -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}})]
|
Loading…
Reference in New Issue
Block a user