mirror of
https://github.com/facebook/duckling.git
synced 2024-09-11 21:27:13 +03:00
add: support for specific times in HI duration (#424)
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/424 Reviewed By: girifb Differential Revision: D26411920 Pulled By: chessai fbshipit-source-id: 3f0063e4786688579f2f53f46b31bda5d222d402
This commit is contained in:
parent
590651150b
commit
37b671389c
@ -73,4 +73,10 @@ allExamples = concat
|
||||
[ "1 साल, 2 दिन, 3 घंटा और 4 सेकंड"
|
||||
, "1 साल 2 दिन 3 घंटा और 4 सेकंड"
|
||||
]
|
||||
, examples (DurationData 30 Month)
|
||||
[ "ढाई साल"
|
||||
]
|
||||
, examples (DurationData 90 Minute)
|
||||
[ "डेढ़ घंटा"
|
||||
]
|
||||
]
|
||||
|
@ -153,6 +153,7 @@ ruleSaadeDuration = Rule
|
||||
_) -> Token Duration <$> nPlusOneHalf grain (floor v)
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
ruleCompositeDuration :: Rule
|
||||
ruleCompositeDuration = Rule
|
||||
{ name = "composite <duration>"
|
||||
@ -187,6 +188,25 @@ ruleCompositeDurationCommasAnd = Rule
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
ruleNAndHalfDuration :: Rule
|
||||
ruleNAndHalfDuration = Rule
|
||||
{ name = "डेढ़|ढाई <duration>"
|
||||
, pattern =
|
||||
[ regex "(डेढ़|ढाई)"
|
||||
, dimension TimeGrain
|
||||
]
|
||||
, prod = \case
|
||||
(Token RegexMatch (GroupMatch (match:_)):
|
||||
Token TimeGrain grain:
|
||||
_) -> do
|
||||
h <- case Text.toLower match of
|
||||
"डेढ़" -> Just 1
|
||||
"ढाई" -> Just 2
|
||||
_ -> Nothing
|
||||
Token Duration <$> nPlusOneHalf grain h
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
rules :: [Rule]
|
||||
rules =
|
||||
[ ruleDurationPandrahMinat
|
||||
@ -200,4 +220,5 @@ rules =
|
||||
, ruleSaadeDuration
|
||||
, ruleCompositeDuration
|
||||
, ruleCompositeDurationCommasAnd
|
||||
, ruleNAndHalfDuration
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user