num2words2 0.1.0.dev1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. num2words2/README.md +69 -0
  2. num2words2/__init__.py +196 -0
  3. num2words2/_version.py +3 -0
  4. num2words2/base.py +377 -0
  5. num2words2/compat.py +29 -0
  6. num2words2/currency.py +60 -0
  7. num2words2/lang_AF.py +202 -0
  8. num2words2/lang_AM.py +193 -0
  9. num2words2/lang_AR.py +435 -0
  10. num2words2/lang_AS.py +119 -0
  11. num2words2/lang_AZ.py +208 -0
  12. num2words2/lang_BA.py +119 -0
  13. num2words2/lang_BE.py +356 -0
  14. num2words2/lang_BG.py +393 -0
  15. num2words2/lang_BN.py +242 -0
  16. num2words2/lang_BO.py +122 -0
  17. num2words2/lang_BR.py +135 -0
  18. num2words2/lang_BS.py +189 -0
  19. num2words2/lang_CA.py +476 -0
  20. num2words2/lang_CE.py +546 -0
  21. num2words2/lang_CS.py +260 -0
  22. num2words2/lang_CY.py +574 -0
  23. num2words2/lang_DA.py +170 -0
  24. num2words2/lang_DE.py +180 -0
  25. num2words2/lang_EL.py +338 -0
  26. num2words2/lang_EN.py +118 -0
  27. num2words2/lang_EN_IN.py +26 -0
  28. num2words2/lang_EN_NG.py +45 -0
  29. num2words2/lang_EO.py +130 -0
  30. num2words2/lang_ES.py +399 -0
  31. num2words2/lang_ES_CO.py +37 -0
  32. num2words2/lang_ES_CR.py +38 -0
  33. num2words2/lang_ES_GT.py +37 -0
  34. num2words2/lang_ES_NI.py +35 -0
  35. num2words2/lang_ES_VE.py +43 -0
  36. num2words2/lang_ET.py +393 -0
  37. num2words2/lang_EU.py +158 -0
  38. num2words2/lang_EUR.py +104 -0
  39. num2words2/lang_FA.py +187 -0
  40. num2words2/lang_FI.py +759 -0
  41. num2words2/lang_FO.py +136 -0
  42. num2words2/lang_FR.py +133 -0
  43. num2words2/lang_FR_BE.py +49 -0
  44. num2words2/lang_FR_CH.py +48 -0
  45. num2words2/lang_FR_DZ.py +35 -0
  46. num2words2/lang_GL.py +135 -0
  47. num2words2/lang_GU.py +172 -0
  48. num2words2/lang_HA.py +293 -0
  49. num2words2/lang_HAW.py +144 -0
  50. num2words2/lang_HE.py +314 -0
  51. num2words2/lang_HI.py +243 -0
  52. num2words2/lang_HR.py +304 -0
  53. num2words2/lang_HT.py +136 -0
  54. num2words2/lang_HU.py +189 -0
  55. num2words2/lang_HY.py +364 -0
  56. num2words2/lang_ID.py +242 -0
  57. num2words2/lang_IS.py +208 -0
  58. num2words2/lang_IT.py +265 -0
  59. num2words2/lang_JA.py +615 -0
  60. num2words2/lang_JW.py +136 -0
  61. num2words2/lang_KA.py +169 -0
  62. num2words2/lang_KK.py +136 -0
  63. num2words2/lang_KM.py +173 -0
  64. num2words2/lang_KN.py +182 -0
  65. num2words2/lang_KO.py +175 -0
  66. num2words2/lang_KZ.py +161 -0
  67. num2words2/lang_LA.py +135 -0
  68. num2words2/lang_LB.py +135 -0
  69. num2words2/lang_LN.py +136 -0
  70. num2words2/lang_LO.py +149 -0
  71. num2words2/lang_LT.py +283 -0
  72. num2words2/lang_LV.py +266 -0
  73. num2words2/lang_MG.py +143 -0
  74. num2words2/lang_MI.py +151 -0
  75. num2words2/lang_MK.py +136 -0
  76. num2words2/lang_ML.py +159 -0
  77. num2words2/lang_MN.py +319 -0
  78. num2words2/lang_MR.py +187 -0
  79. num2words2/lang_MS.py +293 -0
  80. num2words2/lang_MT.py +159 -0
  81. num2words2/lang_MY.py +152 -0
  82. num2words2/lang_NE.py +157 -0
  83. num2words2/lang_NL.py +204 -0
  84. num2words2/lang_NN.py +136 -0
  85. num2words2/lang_NO.py +143 -0
  86. num2words2/lang_OC.py +135 -0
  87. num2words2/lang_PA.py +159 -0
  88. num2words2/lang_PL.py +336 -0
  89. num2words2/lang_PS.py +136 -0
  90. num2words2/lang_PT.py +280 -0
  91. num2words2/lang_PT_BR.py +224 -0
  92. num2words2/lang_RO.py +183 -0
  93. num2words2/lang_RU.py +570 -0
  94. num2words2/lang_SA.py +136 -0
  95. num2words2/lang_SD.py +136 -0
  96. num2words2/lang_SI.py +152 -0
  97. num2words2/lang_SK.py +250 -0
  98. num2words2/lang_SL.py +306 -0
  99. num2words2/lang_SN.py +447 -0
  100. num2words2/lang_SO.py +136 -0
  101. num2words2/lang_SQ.py +252 -0
  102. num2words2/lang_SR.py +254 -0
  103. num2words2/lang_SU.py +136 -0
  104. num2words2/lang_SV.py +169 -0
  105. num2words2/lang_SW.py +219 -0
  106. num2words2/lang_TA.py +303 -0
  107. num2words2/lang_TE.py +169 -0
  108. num2words2/lang_TET.py +285 -0
  109. num2words2/lang_TG.py +149 -0
  110. num2words2/lang_TH.py +214 -0
  111. num2words2/lang_TK.py +136 -0
  112. num2words2/lang_TL.py +145 -0
  113. num2words2/lang_TR.py +882 -0
  114. num2words2/lang_TT.py +136 -0
  115. num2words2/lang_UK.py +1101 -0
  116. num2words2/lang_UR.py +168 -0
  117. num2words2/lang_UZ.py +136 -0
  118. num2words2/lang_VI.py +143 -0
  119. num2words2/lang_WO.py +136 -0
  120. num2words2/lang_YI.py +135 -0
  121. num2words2/lang_YO.py +136 -0
  122. num2words2/lang_ZH.py +296 -0
  123. num2words2/lang_ZH_CN.py +85 -0
  124. num2words2/lang_ZH_HK.py +48 -0
  125. num2words2/lang_ZH_TW.py +198 -0
  126. num2words2/utils.py +35 -0
  127. num2words2-0.1.0.dev1.data/scripts/num2words2 +98 -0
  128. num2words2-0.1.0.dev1.dist-info/METADATA +244 -0
  129. num2words2-0.1.0.dev1.dist-info/RECORD +133 -0
  130. num2words2-0.1.0.dev1.dist-info/WHEEL +5 -0
  131. num2words2-0.1.0.dev1.dist-info/entry_points.txt +2 -0
  132. num2words2-0.1.0.dev1.dist-info/licenses/COPYING +145 -0
  133. num2words2-0.1.0.dev1.dist-info/top_level.txt +1 -0
num2words2/lang_CA.py ADDED
@@ -0,0 +1,476 @@
1
+ from __future__ import division, print_function, unicode_literals
2
+
3
+ import math
4
+
5
+ from .lang_EUR import Num2Word_EUR
6
+
7
+ GENERIC_DOLLARS = ('dòlar', 'dòlars')
8
+ GENERIC_CENTS = ('centau', 'centaus')
9
+ CURRENCIES_UNA = (
10
+ 'SLL',
11
+ 'SEK',
12
+ 'NOK',
13
+ 'CZK',
14
+ 'DKK',
15
+ 'ISK',
16
+ 'SKK',
17
+ 'GBP',
18
+ 'CYP',
19
+ 'EGP',
20
+ 'FKP',
21
+ 'GIP',
22
+ 'LBP',
23
+ 'SDG',
24
+ 'SHP',
25
+ 'SSP',
26
+ 'SYP',
27
+ 'INR',
28
+ 'IDR',
29
+ 'LKR',
30
+ 'MUR',
31
+ 'NPR',
32
+ 'PKR',
33
+ 'SCR',
34
+ 'ESP',
35
+ 'TRY',
36
+ 'ITL',
37
+ )
38
+ CENTS_UNA = ('EGP', 'JOD', 'LBP', 'SDG', 'SSP', 'SYP')
39
+
40
+
41
+ class Num2Word_CA(Num2Word_EUR):
42
+ CURRENCY_FORMS = {
43
+ 'EUR': (('euro', 'euros'), ('cèntim', 'cèntims')),
44
+ 'ESP': (('pesseta', 'pessetes'), ('cèntim', 'cèntims')),
45
+ 'USD': (GENERIC_DOLLARS, ('centau', 'centaus')),
46
+ 'PEN': (('sol', 'sols'), ('cèntim', 'cèntims')),
47
+ 'CRC': (('colón', 'colons'), GENERIC_CENTS),
48
+ 'AUD': (GENERIC_DOLLARS, GENERIC_CENTS),
49
+ 'CAD': (GENERIC_DOLLARS, GENERIC_CENTS),
50
+ 'GBP': (('lliura', 'lliures'), ('penic', 'penics')),
51
+ 'RUB': (('ruble', 'rubles'), ('copec', 'copecs')),
52
+ 'SEK': (('corona', 'corones'), ('öre', 'öre')),
53
+ 'NOK': (('corona', 'corones'), ('øre', 'øre')),
54
+ 'PLN': (('zloty', 'zlotys'), ('grosz', 'groszy')),
55
+ 'MXN': (('peso', 'pesos'), GENERIC_CENTS),
56
+ 'RON': (('leu', 'lei'), ('ban', 'bani')),
57
+ 'INR': (('rupia', 'rupies'), ('paisa', 'paise')),
58
+ 'HUF': (('fòrint', 'fòrints'), ('fillér', 'fillérs')),
59
+ 'FRF': (('franc', 'francs'), ('cèntim', 'cèntims')),
60
+ 'CNY': (('iuan', 'iuans'), ('fen', 'jiao')),
61
+ 'CZK': (('corona', 'corones'), ('haléř', 'haléřů')),
62
+ 'NIO': (('córdoba', 'córdobas'), GENERIC_CENTS),
63
+ 'VES': (('bolívar', 'bolívars'), ('cèntim', 'cèntims')),
64
+ 'BRL': (('real', 'reals'), GENERIC_CENTS),
65
+ 'CHF': (('franc', 'francs'), ('cèntim', 'cèntims')),
66
+ 'JPY': (('ien', 'iens'), ('sen', 'sen')),
67
+ 'KRW': (('won', 'wons'), ('jeon', 'jeon')),
68
+ 'KPW': (('won', 'wons'), ('chŏn', 'chŏn')),
69
+ 'TRY': (('lira', 'lires'), ('kuruş', 'kuruş')),
70
+ 'ZAR': (('rand', 'rands'), ('cèntim', 'cèntims')),
71
+ 'KZT': (('tenge', 'tenge'), ('tin', 'tin')),
72
+ 'UAH': (('hrívnia', 'hrívnies'), ('kopiika', 'kopíok')),
73
+ 'THB': (('baht', 'bahts'), ('satang', 'satang')),
74
+ 'AED': (('dirham', 'dirhams'), ('fils', 'fulūs')),
75
+ 'AFN': (('afgani', 'afganis'), ('puli', 'puls')),
76
+ 'ALL': (('lek', 'lekë'), ('qqindarka', 'qindarkë')),
77
+ 'AMD': (('dram', 'drams'), ('luma', 'lumas')),
78
+ 'ANG': (('florí', 'florins'), ('cèntim', 'cèntims')),
79
+ 'AOA': (('kwanza', 'kwanzes'), ('cèntim', 'cèntims')),
80
+ 'ARS': (('peso', 'pesos'), GENERIC_CENTS),
81
+ 'AWG': (('florí', 'florins'), GENERIC_CENTS),
82
+ 'AZN': (('manat', 'manats'), ('qəpik', 'qəpik')),
83
+ 'BBD': (GENERIC_DOLLARS, GENERIC_CENTS),
84
+ 'BDT': (('taka', 'taka'), ('poisha', 'poisha')),
85
+ 'BGN': (('lev', 'leva'), ('stotinka', 'stotinki')),
86
+ 'BHD': (('dinar', 'dinars'), ('fils', 'fulūs')),
87
+ 'BIF': (('franc', 'francs'), ('cèntim', 'cèntims')),
88
+ 'BMD': (GENERIC_DOLLARS, GENERIC_CENTS),
89
+ 'BND': (GENERIC_DOLLARS, GENERIC_CENTS),
90
+ 'BOB': (('boliviano', 'bolivianos'), GENERIC_CENTS),
91
+ 'BSD': (GENERIC_DOLLARS, GENERIC_CENTS),
92
+ 'BTN': (('ngultrum', 'ngultrums'), ('chetrum', 'chetrums')),
93
+ 'BWP': (('pula', 'pula'), ('thebe', 'thebe')),
94
+ 'BYN': (('ruble', 'rubles'), ('copec', 'copecs')),
95
+ 'BYR': (('ruble', 'rubles'), ('copec', 'copecs')),
96
+ 'BZD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
97
+ 'CDF': (('franc', 'francs'), ('cèntim', 'cèntims')),
98
+ 'CLP': (('peso', 'pesos'), GENERIC_CENTS),
99
+ 'COP': (('peso', 'pesos'), GENERIC_CENTS),
100
+ 'CUP': (('peso', 'pesos'), GENERIC_CENTS),
101
+ 'CVE': (('escut', 'escuts'), GENERIC_CENTS),
102
+ 'CYP': (('lliura', 'lliures'), ('cèntim', 'cèntims')),
103
+ 'DJF': (('franc', 'francs'), ('cèntim', 'cèntims')),
104
+ 'DKK': (('corona', 'corones'), ('øre', 'øre')),
105
+ 'DOP': (('peso', 'pesos'), GENERIC_CENTS),
106
+ 'DZD': (('dinar', 'dinars'), ('cèntim', 'cèntims')),
107
+ 'ECS': (('sucre', 'sucres'), GENERIC_CENTS),
108
+ 'EGP': (('lliura', 'lliures'), ('piastre', 'piastres')),
109
+ 'ERN': (('nakfa', 'nakfes'), ('cèntim', 'cèntims')),
110
+ 'ETB': (('birr', 'birr'), ('cèntim', 'cèntims')),
111
+ 'FJD': (GENERIC_DOLLARS, GENERIC_CENTS),
112
+ 'FKP': (('lliura', 'lliures'), ('penic', 'penics')),
113
+ 'GEL': (('lari', 'laris'), ('tetri', 'tetri')),
114
+ 'GHS': (('cedi', 'cedis'), ('pesewa', 'pesewas')),
115
+ 'GIP': (('lliura', 'lliures'), ('penic', 'penics')),
116
+ 'GMD': (('dalasi', 'dalasis'), ('butut', 'bututs')),
117
+ 'GNF': (('franc', 'francs'), ('cèntim', 'cèntims')),
118
+ 'GTQ': (('quetzal', 'quetzals'), GENERIC_CENTS),
119
+ 'GYD': (GENERIC_DOLLARS, GENERIC_CENTS),
120
+ 'HKD': (GENERIC_DOLLARS, GENERIC_CENTS),
121
+ 'HNL': (('lempira', 'lempires'), GENERIC_CENTS),
122
+ 'HRK': (('kuna', 'kuna'), ('lipa', 'lipa')),
123
+ 'HTG': (('gourde', 'gourdes'), ('cèntim', 'cèntims')),
124
+ 'IDR': (('rúpia', 'rúpies'), ('cèntim', 'cèntims')),
125
+ 'ILS': (('xéquel', 'xéquels'), ('agorà', 'agorot')),
126
+ 'IQD': (('dinar', 'dinars'), ('fils', 'fils')),
127
+ 'IRR': (('rial', 'rials'), ('dinar', 'dinars')),
128
+ 'ISK': (('corona', 'corones'), ('eyrir', 'aurar')),
129
+ 'ITL': (('lira', 'lires'), ('cèntim', 'cèntims')),
130
+ 'JMD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
131
+ 'JOD': (('dinar', 'dinars'), ('piastra', 'piastres')),
132
+ 'KES': (('xiling', 'xílings'), ('cèntim', 'cèntims')),
133
+ 'KGS': (('som', 'som'), ('tyiyn', 'tyiyn')),
134
+ 'KHR': (('riel', 'riels'), ('cèntim', 'cèntims')),
135
+ 'KMF': (('franc', 'francs'), ('cèntim', 'cèntims')),
136
+ 'KWD': (('dinar', 'dinars'), ('fils', 'fils')),
137
+ 'KYD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
138
+ 'LAK': (('kip', 'kips'), ('at', 'at')),
139
+ 'LBP': (('lliura', 'lliures'), ('piastra', 'piastres')),
140
+ 'LKR': (('rúpia', 'rúpies'), ('cèntim', 'cèntims')),
141
+ 'LRD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
142
+ 'LSL': (('loti', 'maloti'), ('sente', 'lisente')),
143
+ 'LTL': (('lita', 'litai'), ('cèntim', 'cèntims')),
144
+ 'LYD': (('dinar', 'dinars'), ('dírham', 'dírhams')),
145
+ 'MAD': (('dírham', 'dirhams'), ('cèntim', 'cèntims')),
146
+ 'MDL': (('leu', 'lei'), ('ban', 'bani')),
147
+ 'MGA': (('ariary', 'ariary'), ('iraimbilanja', 'iraimbilanja')),
148
+ 'MKD': (('denar', 'denari'), ('deni', 'deni')),
149
+ 'MMK': (('kyat', 'kyats'), ('pya', 'pyas')),
150
+ 'MNT': (('tögrög', 'tögrög'), ('möngö', 'möngö')),
151
+ 'MOP': (('pataca', 'pataques'), ('avo', 'avos')),
152
+ 'MRO': (('ouguiya', 'ouguiya'), ('khoums', 'khoums')),
153
+ 'MRU': (('ouguiya', 'ouguiya'), ('khoums', 'khoums')),
154
+ 'MUR': (('rupia', 'rúpies'), ('cèntim', 'cèntims')),
155
+ 'MVR': (('rufiyaa', 'rufiyaa'), ('laari', 'laari')),
156
+ 'MWK': (('kwacha', 'kwacha'), ('tambala', 'tambala')),
157
+ 'MYR': (('ringgit', 'ringgits'), ('sen', 'sens')),
158
+ 'MZN': (('metical', 'meticals'), GENERIC_CENTS),
159
+ 'NAD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
160
+ 'NGN': (('naira', 'naires'), ('kobo', 'kobos')),
161
+ 'NPR': (('rupia', 'rupies'), ('paisa', 'paises')),
162
+ 'NZD': (GENERIC_DOLLARS, GENERIC_CENTS),
163
+ 'OMR': (('rial', 'rials'), ('baisa', 'baisa')),
164
+ 'PAB': (GENERIC_DOLLARS, ('centésimo', 'centésimos')),
165
+ 'PGK': (('kina', 'kina'), ('toea', 'toea')),
166
+ 'PHP': (('peso', 'pesos'), GENERIC_CENTS),
167
+ 'PKR': (('rupia', 'rupies'), ('paisa', 'paise')),
168
+ 'PLZ': (('zloty', 'zlotys'), ('grosz', 'groszy')),
169
+ 'PYG': (('guaraní', 'guaranís'), ('cèntim', 'cèntims')),
170
+ 'QAR': (('rial', 'rials'), ('dírham', 'dírhams')),
171
+ 'QTQ': (('quetzal', 'quetzals'), GENERIC_CENTS),
172
+ 'RSD': (('dinar', 'dinars'), ('para', 'para')),
173
+ 'RUR': (('ruble', 'rubles'), ('copec', 'copecs')),
174
+ 'RWF': (('franc', 'francs'), ('cèntim', 'cèntims')),
175
+ 'SAR': (('riyal', 'riyals'), ('hàl·lala', 'hàl·lalat')),
176
+ 'SBD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
177
+ 'SCR': (('rupia', 'rupies'), ('cèntim', 'cèntims')),
178
+ 'SDG': (('lliura', 'lliures'), ('piastre', 'piastres')),
179
+ 'SGD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
180
+ 'SHP': (('lliura', 'lliures'), ('penic', 'penics')),
181
+ 'SLL': (('leonE', 'leones'), ('cèntim', 'cèntims')),
182
+ 'SRD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
183
+ 'SSP': (('lliura', 'lliures'), ('piastre', 'piastres')),
184
+ 'STD': (('dobra', 'dobrAs'), ('cèntim', 'cèntims')),
185
+ 'SVC': (('colón', 'colons'), GENERIC_CENTS),
186
+ 'SYP': (('lliura', 'lliures'), ('piastre', 'piastres')),
187
+ 'SZL': (('lilangeni', 'emalangeni'), ('cèntim', 'cèntims')),
188
+ 'TJS': (('somoni', 'somoni'), ('diram', 'diram')),
189
+ 'TMT': (('manat', 'manats'), ('teňňesi', 'teňňesi')),
190
+ 'TND': (('dinar', 'dinars'), ('mil·lim', 'mil·limat')),
191
+ 'TOP': (('paanga', 'paangas'), ('seniti', 'seniti')),
192
+ 'TTD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
193
+ 'TWD': (('nou dòlar', 'nous dòlars'), ('fen', 'fen')),
194
+ 'TZS': (('xíling', 'xílings'), ('cèntim', 'cèntims')),
195
+ 'UGX': (('xíling', 'xílings'), ('cèntim', 'cèntims')),
196
+ 'UYU': (('peso', 'pesos'), ('centèsim', 'centèsims')),
197
+ 'UZS': (('som', 'som'), ('tiyin', 'tiyin')),
198
+ 'VND': (('dong', 'dongs'), ('xu', 'xu')),
199
+ 'VUV': (('vatu', 'vatus'), ('cèntim', 'cèntims')),
200
+ 'WST': (('tala', 'tala'), ('sene', 'sene')),
201
+ 'XAF': (('franc CFA', 'francs CFA'), ('cèntim', 'cèntims')),
202
+ 'XCD': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
203
+ 'XOF': (('franc CFA', 'francs CFA'), ('cèntim', 'cèntims')),
204
+ 'XPF': (('franc CFP', 'francs CFP'), ('cèntim', 'cèntims')),
205
+ 'YER': (('rial', 'rials'), ('fils', 'fils')),
206
+ 'YUM': (('dinar', 'dinars'), ('para', 'para')),
207
+ 'ZMW': (('kwacha', 'kwacha'), ('ngwee', 'ngwee')),
208
+ 'ZWL': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
209
+ 'ZWL': (GENERIC_DOLLARS, ('cèntim', 'cèntims')),
210
+ }
211
+
212
+ GIGA_SUFFIX = None
213
+ MEGA_SUFFIX = "ilió"
214
+
215
+ def setup(self):
216
+ lows = ["quadr", "tr", "b", "m"]
217
+ self.high_numwords = self.gen_high_numwords([], [], lows)
218
+ self.negword = "menys "
219
+ self.pointword = "punt"
220
+ self.errmsg_nonnum = "type(%s) no és [long, int, float]"
221
+ self.errmsg_floatord = "El float %s no pot ser tractat com un" \
222
+ " ordinal."
223
+ self.errmsg_negord = "El número negatiu %s no pot ser tractat" \
224
+ " com un ordinal."
225
+ self.errmsg_toobig = "abs(%s) ha de ser inferior a %s."
226
+ self.gender_stem = "è"
227
+ self.exclude_title = ["i", "menys", "punt"]
228
+
229
+ self.mid_numwords = [
230
+ (1000, "mil"),
231
+ (100, "cent"),
232
+ (90, "noranta"),
233
+ (80, "vuitanta"),
234
+ (70, "setanta"),
235
+ (60, "seixanta"),
236
+ (50, "cinquanta"),
237
+ (40, "quaranta"),
238
+ (30, "trenta"),
239
+ ]
240
+ self.low_numwords = [
241
+ "vint-i-nou",
242
+ "vint-i-vuit",
243
+ "vint-i-set",
244
+ "vint-i-sis",
245
+ "vint-i-cinc",
246
+ "vint-i-quatre",
247
+ "vint-i-tres",
248
+ "vint-i-dos",
249
+ "vint-i-un",
250
+ "vint",
251
+ "dinou",
252
+ "divuit",
253
+ "disset",
254
+ "setze",
255
+ "quinze",
256
+ "catorze",
257
+ "tretze",
258
+ "dotze",
259
+ "onze",
260
+ "deu",
261
+ "nou",
262
+ "vuit",
263
+ "set",
264
+ "sis",
265
+ "cinc",
266
+ "quatre",
267
+ "tres",
268
+ "dos",
269
+ "un",
270
+ "zero",
271
+ ]
272
+ self.mid_num = {
273
+ 1000: "mil",
274
+ 100: "cent",
275
+ 90: "noranta",
276
+ 80: "vuitanta",
277
+ 70: "setanta",
278
+ 60: "seixanta",
279
+ 50: "cinquanta",
280
+ 40: "quaranta",
281
+ 30: "trenta",
282
+ 20: "vint",
283
+ 10: "deu",
284
+ }
285
+ self.low_num = {
286
+ 0: "zero",
287
+ 1: "un",
288
+ 2: "dos",
289
+ 3: "tres",
290
+ 4: "quatre",
291
+ 5: "cinc",
292
+ 6: "sis",
293
+ 7: "set",
294
+ 8: "vuit",
295
+ 9: "nou",
296
+ 10: "deu",
297
+ 11: "onze",
298
+ 12: "dotze",
299
+ 13: "tretze",
300
+ 14: "catorze",
301
+ 15: "quinze",
302
+ 16: "setze",
303
+ 17: "disset",
304
+ 18: "divuit",
305
+ 19: "dinou",
306
+ 20: "vint",
307
+ 21: "vint-i-un",
308
+ 22: "vint-i-dos",
309
+ 23: "vint-i-tres",
310
+ 24: "vint-i-quatre",
311
+ 25: "vint-i-cinc",
312
+ 26: "vint-i-sis",
313
+ 27: "vint-i-set",
314
+ 28: "vint-i-vuit",
315
+ 29: "vint-i-nou",
316
+ }
317
+ self.ords = {
318
+ 1: "primer",
319
+ 2: "segon",
320
+ 3: "tercer",
321
+ 4: "quart",
322
+ 5: "cinqu",
323
+ 6: "sis",
324
+ 7: "set",
325
+ 8: "vuit",
326
+ 9: "nov",
327
+ 10: "des",
328
+ 11: "onz",
329
+ 12: "dotz",
330
+ 13: "tretz",
331
+ 14: "catorz",
332
+ 15: "quinz",
333
+ 16: "setz",
334
+ 17: "disset",
335
+ 18: "divuit",
336
+ 19: "dinov",
337
+ 20: "vint",
338
+ 30: "trent",
339
+ 40: "quarant",
340
+ 50: "cinquant",
341
+ 60: "seixant",
342
+ 70: "setant",
343
+ 80: "vuitant",
344
+ 90: "norant",
345
+ 100: "cent",
346
+ 200: "dos-cent",
347
+ 300: "tres-cent",
348
+ 400: "quatre-cent",
349
+ 500: "cinc-cent",
350
+ 600: "sis-cent",
351
+ 700: "set-cent",
352
+ 800: "vuit-cent",
353
+ 900: "nou-cent",
354
+ 1e3: "mil",
355
+ 1e6: "milion",
356
+ 1e9: "mil milion",
357
+ 1e12: "bilion",
358
+ 1e15: "mil bilion",
359
+ }
360
+
361
+ self.ords_2 = {1: "1r", 2: "2n", 3: "3r", 4: "4t"}
362
+ self.ords_3 = {
363
+ 1: "unè",
364
+ 2: "dosè",
365
+ 3: "tresè",
366
+ 4: "quatrè",
367
+ 5: "cinquè",
368
+ 6: "sisè",
369
+ 7: "setè",
370
+ 8: "vuitè",
371
+ 9: "novè",
372
+ }
373
+
374
+ def merge(self, curr, next):
375
+ ctext, cnum, ntext, nnum = curr + next
376
+ if cnum == 1:
377
+ if nnum < 1000000:
378
+ return next
379
+ ctext = "un"
380
+
381
+ if nnum < cnum:
382
+ if cnum < 100:
383
+ return "%s-%s" % (ctext, ntext), cnum + nnum
384
+ elif nnum == 1:
385
+ return "%s %s" % (ctext, ntext), cnum + nnum
386
+ elif cnum == 100:
387
+ return "%s %s" % (ctext, ntext), cnum + nnum
388
+ else:
389
+ return "%s %s" % (ctext, ntext), cnum + nnum
390
+ elif (not nnum % 1000000) and cnum > 1:
391
+ ntext = ntext[:-3] + "lions"
392
+ if nnum == 100:
393
+ ntext += "s"
394
+ ctext += "-"
395
+ else:
396
+ ntext = " " + ntext
397
+ return (ctext + ntext, cnum * nnum)
398
+
399
+ def to_ordinal(self, value):
400
+ self.verify_ordinal(value)
401
+ if value == 0:
402
+ text = ""
403
+ elif value < 5:
404
+ text = self.ords[value]
405
+ elif value <= 20:
406
+ text = "%s%s" % (self.ords[value], self.gender_stem)
407
+ elif value <= 30:
408
+ frac = value % 10
409
+ text = "%s%s%s" % (self.ords[20], "-i-", self.ords_3[frac])
410
+ elif value < 100:
411
+ dec = (value // 10) * 10
412
+ text = "%s%s%s%s" % (self.ords[dec], "a",
413
+ "-", self.ords_3[value - dec])
414
+ elif value == 1e2:
415
+ text = "%s%s" % (self.ords[value], self.gender_stem)
416
+ elif value < 2e2:
417
+ cen = (value // 100) * 100
418
+ text = "%s %s" % (self.ords[cen], self.to_ordinal(value - cen))
419
+ elif value < 1e3:
420
+ cen = (value // 100) * 100
421
+ text = "%s%s %s" % (self.ords[cen], "s",
422
+ self.to_ordinal(value - cen))
423
+ elif value == 1e3:
424
+ text = "%s%s" % (self.ords[value], self.gender_stem)
425
+ elif value < 1e6:
426
+ dec = 1000 ** int(math.log(int(value), 1000))
427
+ high_part, low_part = divmod(value, dec)
428
+ cardinal = self.to_cardinal(high_part) if high_part != 1 else ""
429
+ text = "%s %s %s" % (cardinal, self.ords[dec],
430
+ self.to_ordinal(low_part))
431
+ elif value < 1e18:
432
+ dec = 1000 ** int(math.log(int(value), 1000))
433
+ high_part, low_part = divmod(value, dec)
434
+ cardinal = self.to_cardinal(high_part) if high_part != 1 else ""
435
+ text = "%s%s%s %s" % (cardinal, self.ords[dec],
436
+ self.gender_stem, self.to_ordinal(low_part))
437
+ else:
438
+ part1 = self.to_cardinal(value)
439
+ text = "%s%s" % (part1[:-1], "onè")
440
+ return text.strip()
441
+
442
+ def to_ordinal_num(self, value):
443
+ self.verify_ordinal(value)
444
+ if value not in self.ords_2:
445
+ return "%s%s" % (value, "è" if self.gender_stem == "è" else "a")
446
+ else:
447
+ return self.ords_2[value]
448
+
449
+ def to_currency(self, val, currency="EUR", cents=True,
450
+ separator=" amb", adjective=False):
451
+ # Handle integers specially - just add currency name without cents
452
+ if isinstance(val, int):
453
+ try:
454
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
455
+ except (KeyError, AttributeError):
456
+ # Fallback to base implementation for unknown currency
457
+ return super(Num2Word_CA, self).to_currency(
458
+ val, currency=currency, cents=cents, separator=separator,
459
+ adjective=adjective)
460
+
461
+ minus_str = self.negword if val < 0 else ""
462
+ abs_val = abs(val)
463
+ money_str = self.to_cardinal(abs_val)
464
+
465
+ # Proper pluralization for currency
466
+ if abs_val == 1:
467
+ currency_str = cr1[0] if isinstance(cr1, tuple) else cr1
468
+ else:
469
+ currency_str = cr1[1] if isinstance(cr1, tuple) and len(cr1) > 1 else (cr1[0] if isinstance(cr1, tuple) else cr1)
470
+
471
+ return (u'%s %s %s' % (minus_str, money_str, currency_str)).strip()
472
+
473
+ # For floats, use the parent class implementation
474
+ return super(Num2Word_CA, self).to_currency(
475
+ val, currency=currency, cents=cents, separator=separator,
476
+ adjective=adjective)