From ff342868d7054956d77d0faf0aadf78c6333e65b Mon Sep 17 00:00:00 2001 From: "kcnhk1@gmail.com" Date: Wed, 12 May 2021 13:22:58 -0700 Subject: [PATCH] Add rulePrecision Summary: about rule Reviewed By: haoxuany Differential Revision: D28389599 Pulled By: chessai fbshipit-source-id: 237f6f8ed605ba7d22f40cd338e637ed99565e28 --- Duckling/Distance/ZH/Corpus.hs | 1 + Duckling/Distance/ZH/Rules.hs | 14 ++++++++++++++ 2 files changed, 15 insertions(+) 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 ]