Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numeral/DE: add very large german numbers #682

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Duckling/Numeral/DE/Corpus.hs
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,7 @@ allExamples = concat
, examples (NumeralValue 1000000.0)
[ "1.000.000,00"
]
, examples (NumeralValue 2771090092000000.0)
[ "zwei billiarden sieben hundert ein und siebzig billionen neunzig milliarden zwei und neunzig millionen"
]
]
22 changes: 14 additions & 8 deletions Duckling/Numeral/DE/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down