~sebzur/os.num2word/main

« back to all changes in this revision

Viewing changes to num2word_EU.py

  • Committer: Sebastian Żurek
  • Date: 2008-09-07 12:41:03 UTC
  • Revision ID: sebzur@gmail.com-20080907124103-qqgwshcd0428dmbh
num2word dir created and all the files were moved into its. __init__.py added  - it is required by OpenSynergy plugins import framework (all the plugins *must* be Python packages)

Show diffs side-by-side

added added

removed removed

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