AmountOfMoney - extend interval support

Reviewed By: haoxuany

Differential Revision: D26254863

Pulled By: chessai

fbshipit-source-id: dfc06f9831de2d50c11d252429c4fb9b8c1eb13a
This commit is contained in:
kcnhk1@gmail.com 2021-02-04 11:17:52 -08:00 committed by Facebook GitHub Bot
parent b6da3929ce
commit 67c1dbe94f
2 changed files with 6 additions and 3 deletions

View File

@ -76,10 +76,12 @@ allExamples = concat
[ "3.04块以上"
, "至少三块四分"
, "至少三块零四"
, "起碼三蚊零四"
]
, examples (between Dollar (5.6, 5.78))
[ "5.6到5.78元"
, "五元六角-五元七毛八分"
, "五块六到五块七毛八"
, "五蚊六毫至五蚊七毫八"
]
]

View File

@ -239,7 +239,7 @@ ruleIntervalNumeralDash = Rule
{ name = "<numeral> - <amount-of-money>"
, pattern =
[ Predicate isPositive
, regex "-|~|到"
, regex "-|~|到|至"
, Predicate isSimpleAmountOfMoney
]
, prod = \case
@ -257,7 +257,7 @@ ruleIntervalDash = Rule
{ name = "<amount-of-money> - <amount-of-money>"
, pattern =
[ Predicate isSimpleAmountOfMoney
, regex "-|~|到"
, regex "-|~|到|至"
, Predicate isSimpleAmountOfMoney
]
, prod = \case
@ -275,7 +275,7 @@ ruleIntervalBound :: Rule
ruleIntervalBound = Rule
{ name = "under/less/lower/no more than <amount-of-money> (最多|至少|最少)"
, pattern =
[ regex "(最多|至少|最少)"
[ regex "(最多|至少|最少|起碼)"
, Predicate isSimpleAmountOfMoney
]
, prod = \case
@ -286,6 +286,7 @@ ruleIntervalBound = Rule
"最多" -> Just $ Token AmountOfMoney $ withMax to $ currencyOnly c
"最少" -> Just $ Token AmountOfMoney $ withMin to $ currencyOnly c
"至少" -> Just $ Token AmountOfMoney $ withMin to $ currencyOnly c
"起碼" -> Just $ Token AmountOfMoney $ withMin to $ currencyOnly c
_ -> Nothing
_ -> Nothing
}