-
Notifications
You must be signed in to change notification settings - Fork 0
/
num2word_EU.py
44 lines (33 loc) · 1.38 KB
/
num2word_EU.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
Module: num2word_EU.py
Requires: num2word_base.py
Version: 1.1
Author:
Taro Ogawa ([email protected])
Copyright:
Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
Licence:
This module is distributed under the Lesser General Public Licence.
http://www.opensource.org/licenses/lgpl-license.php
Data from:
http://www.uni-bonn.de/~manfear/large.php
History:
1.1: add to_currency()
'''
from num2word_base import Num2Word_Base
class Num2Word_EU(Num2Word_Base):
def set_high_numwords(self, high):
max = 3 + 6*len(high)
for word, n in zip(high, range(max, 3, -6)):
self.cards[10**n] = word + "illiard"
self.cards[10**(n-3)] = word + "illion"
def base_setup(self):
lows = ["non","oct","sept","sext","quint","quadr","tr","b","m"]
units = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "sept",
"octo", "novem"]
tens = ["dec", "vigint", "trigint", "quadragint", "quinquagint",
"sexagint", "septuagint", "octogint", "nonagint"]
self.high_numwords = ["cent"]+self.gen_high_numwords(units, tens, lows)
def to_currency(self, val, longval=True, jointxt=""):
return self.to_splitnum(val, hightxt="Euro/s", lowtxt="Euro cent/s",
jointxt=jointxt, longval=longval)