mirror of
https://github.com/facebook/duckling.git
synced 2024-11-28 16:54:59 +03:00
Use comma "," as decimal separator for VI
Summary: In Vietnam, we use comma "," as decimal separator instead of dot "." Closes https://github.com/facebook/duckling/pull/176 Reviewed By: patapizza Differential Revision: D7601328 Pulled By: panagosg7 fbshipit-source-id: 7f5725006f9054fe45a24757ec2abc36b7aa6605
This commit is contained in:
parent
4df76289bc
commit
c166179d89
@ -37,12 +37,12 @@ allExamples = concat
|
||||
, "mười xu"
|
||||
]
|
||||
, examples (simple Dollar 10000)
|
||||
[ "$10,000"
|
||||
[ "$10.000"
|
||||
, "10K$"
|
||||
, "$10k"
|
||||
]
|
||||
, examples (simple USD 1.23)
|
||||
[ "USD1.23"
|
||||
[ "USD1,23"
|
||||
]
|
||||
, examples (simple Dollar 2.23)
|
||||
[ "2 đô la và 23 xen"
|
||||
@ -56,7 +56,7 @@ allExamples = concat
|
||||
[ "mười đồng"
|
||||
]
|
||||
, examples (simple VND 10000)
|
||||
[ "10,000 đồng"
|
||||
[ "10.000 đồng"
|
||||
, "10K đồng"
|
||||
, "10k đồng"
|
||||
]
|
||||
@ -72,7 +72,7 @@ allExamples = concat
|
||||
, "EUR 20"
|
||||
]
|
||||
, examples (simple EUR 29.99)
|
||||
[ "EUR29.99"
|
||||
[ "EUR29,99"
|
||||
]
|
||||
, examples (simple INR 20)
|
||||
[ "Rs. 20"
|
||||
@ -94,8 +94,8 @@ allExamples = concat
|
||||
, "chín pounds"
|
||||
]
|
||||
, examples (simple GBP 3.01)
|
||||
[ "GBP3.01"
|
||||
, "GBP 3.01"
|
||||
[ "GBP3,01"
|
||||
, "GBP 3,01"
|
||||
]
|
||||
, examples (simple AED 1)
|
||||
[ "1 AED."
|
||||
|
@ -61,16 +61,16 @@ allExamples = concat
|
||||
, "tră"
|
||||
]
|
||||
, examples (NumeralValue 1.1)
|
||||
[ "1.1"
|
||||
, "1.10"
|
||||
, "01.10"
|
||||
[ "1,1"
|
||||
, "1,10"
|
||||
, "01,10"
|
||||
]
|
||||
, examples (NumeralValue 0.77)
|
||||
[ "0.77"
|
||||
, ".77"
|
||||
[ "0,77"
|
||||
, ",77"
|
||||
]
|
||||
, examples (NumeralValue 100000)
|
||||
[ "100,000"
|
||||
[ "100.000"
|
||||
, "100000"
|
||||
, "100K"
|
||||
, "100k"
|
||||
@ -79,22 +79,22 @@ allExamples = concat
|
||||
[ "3M"
|
||||
, "3000K"
|
||||
, "3000000"
|
||||
, "3,000,000"
|
||||
, "3.000.000"
|
||||
]
|
||||
, examples (NumeralValue 1200000)
|
||||
[ "1,200,000"
|
||||
[ "1.200.000"
|
||||
, "1200000"
|
||||
, "1.2M"
|
||||
, "1,2M"
|
||||
, "1200K"
|
||||
, ".0012G"
|
||||
, ",0012G"
|
||||
]
|
||||
, examples (NumeralValue (-1200000))
|
||||
[ "- 1,200,000"
|
||||
[ "- 1.200.000"
|
||||
, "-1200000"
|
||||
, "âm 1,200,000"
|
||||
, "-1.2M"
|
||||
, "âm 1.200.000"
|
||||
, "-1,2M"
|
||||
, "-1200K"
|
||||
, "-.0012G"
|
||||
, "-,0012G"
|
||||
]
|
||||
, examples (NumeralValue 5000)
|
||||
[ "5 nghìn"
|
||||
|
@ -79,11 +79,11 @@ ruleDecimalWithThousandsSeparator :: Rule
|
||||
ruleDecimalWithThousandsSeparator = Rule
|
||||
{ name = "decimal with thousands separator"
|
||||
, pattern =
|
||||
[ regex "(\\d+(,\\d\\d\\d)+\\.\\d+)"
|
||||
[ regex "(\\d+(\\.\\d\\d\\d)+,\\d+)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) ->
|
||||
parseDouble (Text.replace "," Text.empty match) >>= double
|
||||
parseDouble (Text.replace "." Text.empty match) >>= double
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -91,10 +91,10 @@ ruleDecimalNumeral :: Rule
|
||||
ruleDecimalNumeral = Rule
|
||||
{ name = "decimal number"
|
||||
, pattern =
|
||||
[ regex "(\\d*\\.\\d+)"
|
||||
[ regex "(\\d*,\\d+)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> parseDecimal True match
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> parseDecimal False match
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
@ -275,11 +275,11 @@ ruleIntegerWithThousandsSeparator :: Rule
|
||||
ruleIntegerWithThousandsSeparator = Rule
|
||||
{ name = "integer with thousands separator ,"
|
||||
, pattern =
|
||||
[ regex "(\\d{1,3}(,\\d\\d\\d){1,5})"
|
||||
[ regex "(\\d{1,3}(\\.\\d\\d\\d){1,5})"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):
|
||||
_) -> let fmt = Text.replace "," Text.empty match
|
||||
_) -> let fmt = Text.replace "." Text.empty match
|
||||
in parseDouble fmt >>= double
|
||||
_ -> Nothing
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user