diff --git a/Duckling/Distance/ZH/Corpus.hs b/Duckling/Distance/ZH/Corpus.hs index 9dc2ed8f..79b3cae0 100644 --- a/Duckling/Distance/ZH/Corpus.hs +++ b/Duckling/Distance/ZH/Corpus.hs @@ -72,6 +72,7 @@ allExamples = concat [ "1.9 m" , "1.9米" , "米九" + , "米九左右" ] , examples (simple Metre 3.9) [ "3.9 m" diff --git a/Duckling/Distance/ZH/Rules.hs b/Duckling/Distance/ZH/Rules.hs index 7641725c..d1e58ca6 100644 --- a/Duckling/Distance/ZH/Rules.hs +++ b/Duckling/Distance/ZH/Rules.hs @@ -220,6 +220,19 @@ ruleIntervalBound2 = Rule _ -> Nothing } +rulePrecision :: Rule +rulePrecision = Rule + { name = "about " + , pattern = + [ dimension Distance + , regex "左右" + ] + , prod = \case + (t:_) -> Just t + _ -> Nothing + + } + rules :: [Rule] rules = [ ruleDistCentimeters @@ -237,4 +250,5 @@ rules = , ruleIntervalDash , ruleIntervalBound , ruleIntervalBound2 + , rulePrecision ]