mirror of
https://github.com/facebook/duckling.git
synced 2024-11-24 07:23:03 +03:00
Numeral/DE: add very large german numbers (#682)
Summary: Pull Request resolved: https://github.com/facebook/duckling/pull/682 Test Plan: CI tests look clean. As for the German language, I got a friend to double check and the code + test case look good (see Github comment) Reviewed By: girifb Differential Revision: D34248572 Pulled By: stroxler fbshipit-source-id: a031a07808f9aaab142aa365d012035e277676ca
This commit is contained in:
parent
ea8a4f6d3b
commit
578f4b31cd
@ -143,4 +143,7 @@ allExamples = concat
|
||||
[ "1.000.000,00",
|
||||
"eine million"
|
||||
]
|
||||
, examples (NumeralValue 2771090092000000.0)
|
||||
[ "zwei billiarden sieben hundert ein und siebzig billionen neunzig milliarden zwei und neunzig millionen"
|
||||
]
|
||||
]
|
||||
|
@ -201,17 +201,23 @@ rulePowersOfTen :: Rule
|
||||
rulePowersOfTen = Rule
|
||||
{ name = "powers of tens"
|
||||
, pattern =
|
||||
[ regex "(hunderte?|tausende?|million(en)?)"
|
||||
[ regex "(hunderte?|tausende?|million(en)?|milliarde(n)?|billion(en)?|billiarde(n)?)"
|
||||
]
|
||||
, prod = \tokens -> case tokens of
|
||||
(Token RegexMatch (GroupMatch (match:_)):_) -> case Text.toLower match of
|
||||
"hundert" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"hunderte" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"tausend" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"tausende" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"million" -> double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
"millionen" -> double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
"hundert" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"hunderte" -> double 1e2 >>= withGrain 2 >>= withMultipliable
|
||||
"tausend" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"tausende" -> double 1e3 >>= withGrain 3 >>= withMultipliable
|
||||
"million" -> double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
"millionen" -> double 1e6 >>= withGrain 6 >>= withMultipliable
|
||||
"milliarde" -> double 1e9 >>= withGrain 9 >>= withMultipliable
|
||||
"milliarden" -> double 1e9 >>= withGrain 9 >>= withMultipliable
|
||||
"billion" -> double 1e12 >>= withGrain 12 >>= withMultipliable
|
||||
"billionen" -> double 1e12 >>= withGrain 12 >>= withMultipliable
|
||||
"billiarde" -> double 1e15 >>= withGrain 15 >>= withMultipliable
|
||||
"billiarden" -> double 1e15 >>= withGrain 15 >>= withMultipliable
|
||||
_ -> Nothing
|
||||
_ -> Nothing
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user