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_ES.py ADDED
@@ -0,0 +1,399 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import division, print_function, unicode_literals
19
+
20
+ import math
21
+
22
+ from .lang_EUR import Num2Word_EUR
23
+
24
+ GENERIC_DOLLARS = ('dólar', 'dólares')
25
+ GENERIC_CENTS = ('centavo', 'centavos')
26
+ CURRENCIES_UNA = ('SLL', 'SEK', 'NOK', 'CZK', 'DKK', 'ISK',
27
+ 'SKK', 'GBP', 'CYP', 'EGP', 'FKP', 'GIP',
28
+ 'LBP', 'SDG', 'SHP', 'SSP', 'SYP', 'INR',
29
+ 'IDR', 'LKR', 'MUR', 'NPR', 'PKR', 'SCR',
30
+ 'ESP', 'TRY', 'ITL')
31
+ CENTS_UNA = ('EGP', 'JOD', 'LBP', 'SDG', 'SSP', 'SYP')
32
+
33
+
34
+ class Num2Word_ES(Num2Word_EUR):
35
+ CURRENCY_FORMS = {
36
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
37
+ 'ESP': (('peseta', 'pesetas'), ('céntimo', 'céntimos')),
38
+ 'USD': (GENERIC_DOLLARS, GENERIC_CENTS),
39
+ 'PEN': (('sol', 'soles'), ('céntimo', 'céntimos')),
40
+ 'CRC': (('colón', 'colones'), GENERIC_CENTS),
41
+ 'AUD': (GENERIC_DOLLARS, GENERIC_CENTS),
42
+ 'CAD': (GENERIC_DOLLARS, GENERIC_CENTS),
43
+ 'GBP': (('libra', 'libras'), ('penique', 'peniques')),
44
+ 'RUB': (('rublo', 'rublos'), ('kopeyka', 'kopeykas')),
45
+ 'SEK': (('corona', 'coronas'), ('öre', 'öre')),
46
+ 'NOK': (('corona', 'coronas'), ('øre', 'øre')),
47
+ 'PLN': (('zloty', 'zlotys'), ('grosz', 'groszy')),
48
+ 'MXN': (('peso', 'pesos'), GENERIC_CENTS),
49
+ 'RON': (('leu', 'leus'), ('ban', 'bani')),
50
+ 'INR': (('rupia', 'rupias'), ('paisa', 'paisas')),
51
+ 'HUF': (('florín', 'florines'), ('fillér', 'fillér')),
52
+ 'FRF': (('franco', 'francos'), ('céntimo', 'céntimos')),
53
+ 'CNY': (('yuan', 'yuanes'), ('fen', 'jiaos')),
54
+ 'CZK': (('corona', 'coronas'), ('haléř', 'haléř')),
55
+ 'NIO': (('córdoba', 'córdobas'), GENERIC_CENTS),
56
+ 'VES': (('bolívar', 'bolívares'), ('céntimo', 'céntimos')),
57
+ 'BRL': (('real', 'reales'), GENERIC_CENTS),
58
+ 'CHF': (('franco', 'francos'), ('céntimo', 'céntimos')),
59
+ 'JPY': (('yen', 'yenes'), ('sen', 'sen')),
60
+ 'KRW': (('won', 'wones'), ('jeon', 'jeon')),
61
+ 'KPW': (('won', 'wones'), ('chon', 'chon')),
62
+ 'TRY': (('lira', 'liras'), ('kuruş', 'kuruş')),
63
+ 'ZAR': (('rand', 'rands'), ('céntimo', 'céntimos')),
64
+ 'KZT': (('tenge', 'tenges'), ('tïın', 'tïın')),
65
+ 'UAH': (('hryvnia', 'hryvnias'), ('kopiyka', 'kopiykas')),
66
+ 'THB': (('baht', 'bahts'), ('satang', 'satang')),
67
+ 'AED': (('dirham', 'dirhams'), ('fils', 'fils')),
68
+ 'AFN': (('afghani', 'afghanis'), ('pul', 'puls')),
69
+ 'ALL': (('lek ', 'leke'), ('qindarkë', 'qindarka')),
70
+ 'AMD': (('dram', 'drams'), ('luma', 'lumas')),
71
+ 'ANG': (('florín', 'florines'), GENERIC_CENTS),
72
+ 'AOA': (('kwanza', 'kwanzas'), ('céntimo', 'céntimos')),
73
+ 'ARS': (('peso', 'pesos'), GENERIC_CENTS),
74
+ 'AWG': (('florín', 'florines'), GENERIC_CENTS),
75
+ 'AZN': (('manat', 'manat'), ('qəpik', 'qəpik')),
76
+ 'BBD': (GENERIC_DOLLARS, GENERIC_CENTS),
77
+ 'BDT': (('taka', 'takas'), ('paisa', 'paisas')),
78
+ 'BGN': (('lev', 'leva'), ('stotinka', 'stotinki')),
79
+ 'BHD': (('dinar', 'dinares'), ('fils', 'fils')),
80
+ 'BIF': (('franco', 'francos'), ('céntimo', 'céntimos')),
81
+ 'BMD': (GENERIC_DOLLARS, GENERIC_CENTS),
82
+ 'BND': (GENERIC_DOLLARS, GENERIC_CENTS),
83
+ 'BOB': (('boliviano', 'bolivianos'), GENERIC_CENTS),
84
+ 'BSD': (GENERIC_DOLLARS, GENERIC_CENTS),
85
+ 'BTN': (('ngultrum', 'ngultrum'), ('chetrum', 'chetrum')),
86
+ 'BWP': (('pula', 'pulas'), ('thebe', 'thebes')),
87
+ 'BYN': (('rublo', 'rublos'), ('kópek', 'kópeks')),
88
+ 'BYR': (('rublo', 'rublos'), ('kópek', 'kópeks')),
89
+ 'BZD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
90
+ 'CDF': (('franco', 'francos'), ('céntimo', 'céntimos')),
91
+ 'CLP': (('peso', 'pesos'), GENERIC_CENTS),
92
+ 'COP': (('peso', 'pesos'), GENERIC_CENTS),
93
+ 'CUP': (('peso', 'pesos'), GENERIC_CENTS),
94
+ 'CVE': (('escudo', 'escudos'), GENERIC_CENTS),
95
+ 'CYP': (('libra', 'libras'), ('céntimo', 'céntimos')),
96
+ 'DJF': (('franco', 'francos'), ('céntimo', 'céntimos')),
97
+ 'DKK': (('corona', 'coronas'), ('øre', 'øre')),
98
+ 'DOP': (('peso', 'pesos'), GENERIC_CENTS),
99
+ 'DZD': (('dinar', 'dinares'), ('céntimo', 'céntimos')),
100
+ 'ECS': (('sucre', 'sucres'), GENERIC_CENTS),
101
+ 'EGP': (('libra', 'libras'), ('piastra', 'piastras')),
102
+ 'ERN': (('nakfa', 'nakfas'), ('céntimo', 'céntimos')),
103
+ 'ETB': (('birr', 'birrs'), ('céntimo', 'céntimos')),
104
+ 'FJD': (GENERIC_DOLLARS, GENERIC_CENTS),
105
+ 'FKP': (('libra', 'libras'), ('penique', 'peniques')),
106
+ 'GEL': (('lari', 'laris'), ('tetri', 'tetris')),
107
+ 'GHS': (('cedi', 'cedis'), ('pesewa', 'pesewas')),
108
+ 'GIP': (('libra', 'libras'), ('penique', 'peniques')),
109
+ 'GMD': (('dalasi', 'dalasis'), ('butut', 'bututs')),
110
+ 'GNF': (('franco', 'francos'), ('céntimo', 'céntimos')),
111
+ 'GTQ': (('quetzal', 'quetzales'), GENERIC_CENTS),
112
+ 'GYD': (GENERIC_DOLLARS, GENERIC_CENTS),
113
+ 'HKD': (GENERIC_DOLLARS, GENERIC_CENTS),
114
+ 'HNL': (('lempira', 'lempiras'), GENERIC_CENTS),
115
+ 'HRK': (('kuna', 'kunas'), ('lipa', 'lipas')),
116
+ 'HTG': (('gourde', 'gourdes'), ('céntimo', 'céntimos')),
117
+ 'IDR': (('rupia', 'rupias'), ('céntimo', 'céntimos')),
118
+ 'ILS': (('séquel', 'séqueles'), ('agora', 'agoras')),
119
+ 'IQD': (('dinar', 'dinares'), ('fils', 'fils')),
120
+ 'IRR': (('rial', 'riales'), ('dinar', 'dinares')),
121
+ 'ISK': (('corona', 'coronas'), ('eyrir', 'aurar')),
122
+ 'ITL': (('lira', 'liras'), ('céntimo', 'céntimos')),
123
+ 'JMD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
124
+ 'JOD': (('dinar', 'dinares'), ('piastra', 'piastras')),
125
+ 'KES': (('chelín', 'chelines'), ('céntimo', 'céntimos')),
126
+ 'KGS': (('som', 'som'), ('tyiyn', 'tyiyn')),
127
+ 'KHR': (('riel', 'rieles'), ('céntimo', 'céntimos')),
128
+ 'KMF': (('franco', 'francos'), ('céntimo', 'céntimos')),
129
+ 'KWD': (('dinar', 'dinares'), ('fils', 'fils')),
130
+ 'KYD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
131
+ 'LAK': (('kip', 'kips'), ('att', 'att')),
132
+ 'LBP': (('libra', 'libras'), ('piastra', 'piastras')),
133
+ 'LKR': (('rupia', 'rupias'), ('céntimo', 'céntimos')),
134
+ 'LRD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
135
+ 'LSL': (('loti', 'lotis'), ('céntimo', 'céntimos')),
136
+ 'LTL': (('lita', 'litas'), ('céntimo', 'céntimos')),
137
+ 'LVL': (('lat', 'lats'), ('céntimo', 'céntimos')),
138
+ 'LYD': (('dinar', 'dinares'), ('dírham', 'dírhams')),
139
+ 'MAD': (('dírham', 'dirhams'), ('céntimo', 'céntimos')),
140
+ 'MDL': (('leu', 'lei'), ('ban', 'bani')),
141
+ 'MGA': (('ariary', 'ariaris'), ('iraimbilanja', 'iraimbilanja')),
142
+ 'MKD': (('denar', 'denares'), ('deni', 'denis')),
143
+ 'MMK': (('kiat', 'kiats'), ('pya', 'pyas')),
144
+ 'MNT': (('tugrik', 'tugriks'), ('möngö', 'möngö')),
145
+ 'MOP': (('pataca', 'patacas'), ('avo', 'avos')),
146
+ 'MRO': (('ouguiya', 'ouguiyas'), ('khoums', 'khoums')),
147
+ 'MRU': (('ouguiya', 'ouguiyas'), ('khoums', 'khoums')),
148
+ 'MUR': (('rupia', 'rupias'), ('céntimo', 'céntimos')),
149
+ 'MVR': (('rufiyaa', 'rufiyaas'), ('laari', 'laari')),
150
+ 'MWK': (('kuacha', 'kuachas'), ('tambala', 'tambalas')),
151
+ 'MYR': (('ringgit', 'ringgit'), ('céntimo', 'céntimos')),
152
+ 'MZN': (('metical', 'metical'), GENERIC_CENTS),
153
+ 'NAD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
154
+ 'NGN': (('naira', 'nairas'), ('kobo', 'kobo')),
155
+ 'NPR': (('rupia', 'rupias'), ('paisa', 'paisas')),
156
+ 'NZD': (GENERIC_DOLLARS, GENERIC_CENTS),
157
+ 'OMR': (('rial', 'riales'), ('baisa', 'baisa')),
158
+ 'PAB': (('balboa', 'balboas'), ('centésimo', 'centésimos')),
159
+ 'PGK': (('kina', 'kinas'), ('toea', 'toea')),
160
+ 'PHP': (('peso', 'pesos'), GENERIC_CENTS),
161
+ 'PKR': (('rupia', 'rupias'), ('paisa', 'paisas')),
162
+ 'PLZ': (('zloty', 'zlotys'), ('grosz', 'groszy')),
163
+ 'PYG': (('guaraní', 'guaranís'), ('céntimo', 'céntimos')),
164
+ 'QAR': (('rial', 'riales'), ('dírham', 'dírhams')),
165
+ 'QTQ': (('quetzal', 'quetzales'), GENERIC_CENTS),
166
+ 'RSD': (('dinar', 'dinares'), ('para', 'para')),
167
+ 'RUR': (('rublo', 'rublos'), ('kopek', 'kopeks')),
168
+ 'RWF': (('franco', 'francos'), ('céntimo', 'céntimos')),
169
+ 'SAR': (('riyal', 'riales'), ('halala', 'halalas')),
170
+ 'SBD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
171
+ 'SCR': (('rupia', 'rupias'), ('céntimo', 'céntimos')),
172
+ 'SDG': (('libra', 'libras'), ('piastra', 'piastras')),
173
+ 'SGD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
174
+ 'SHP': (('libra', 'libras'), ('penique', 'peniques')),
175
+ 'SKK': (('corona', 'coronas'), ('halier', 'haliers')),
176
+ 'SLL': (('leona', 'leonas'), ('céntimo', 'céntimos')),
177
+ 'SRD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
178
+ 'SSP': (('libra', 'libras'), ('piastra', 'piastras')),
179
+ 'STD': (('dobra', 'dobras'), ('céntimo', 'céntimos')),
180
+ 'SVC': (('colón', 'colones'), GENERIC_CENTS),
181
+ 'SYP': (('libra', 'libras'), ('piastra', 'piastras')),
182
+ 'SZL': (('lilangeni', 'emalangeni'), ('céntimo', 'céntimos')),
183
+ 'TJS': (('somoni', 'somonis'), ('dirame', 'dirames')),
184
+ 'TMT': (('manat', 'manat'), ('tenge', 'tenge')),
185
+ 'TND': (('dinar', 'dinares'), ('milésimo', 'milésimos')),
186
+ 'TOP': (('paanga', 'paangas'), ('céntimo', 'céntimos')),
187
+ 'TTD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
188
+ 'TWD': (('nuevo dólar', 'nuevos dólares'), ('céntimo', 'céntimos')),
189
+ 'TZS': (('chelín', 'chelines'), ('céntimo', 'céntimos')),
190
+ 'UAG': (('hryvnia', 'hryvnias'), ('kopiyka', 'kopiykas')),
191
+ 'UGX': (('chelín', 'chelines'), ('céntimo', 'céntimos')),
192
+ 'UYU': (('peso', 'pesos'), ('centésimo', 'centésimos')),
193
+ 'UZS': (('sum', 'sum'), ('tiyin', 'tiyin')),
194
+ 'VEF': (('bolívar fuerte', 'bolívares fuertes'),
195
+ ('céntimo', 'céntimos')),
196
+ 'VND': (('dong', 'dongs'), ('xu', 'xu')),
197
+ 'VUV': (('vatu', 'vatu'), ('nenhum', 'nenhum')),
198
+ 'WST': (('tala', 'tala'), GENERIC_CENTS),
199
+ 'XAF': (('franco CFA', 'francos CFA'), ('céntimo', 'céntimos')),
200
+ 'XCD': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
201
+ 'XOF': (('franco CFA', 'francos CFA'), ('céntimo', 'céntimos')),
202
+ 'XPF': (('franco CFP', 'francos CFP'), ('céntimo', 'céntimos')),
203
+ 'YER': (('rial', 'riales'), ('fils', 'fils')),
204
+ 'YUM': (('dinar', 'dinares'), ('para', 'para')),
205
+ 'ZMW': (('kwacha', 'kwachas'), ('ngwee', 'ngwee')),
206
+ 'ZRZ': (('zaire', 'zaires'), ('likuta', 'makuta')),
207
+ 'ZWL': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
208
+ 'ZWL': (GENERIC_DOLLARS, ('céntimo', 'céntimos')),
209
+ }
210
+
211
+ # //CHECK: Is this sufficient??
212
+ GIGA_SUFFIX = None
213
+ MEGA_SUFFIX = "illón"
214
+
215
+ def setup(self):
216
+ lows = ["cuatr", "tr", "b", "m"]
217
+ self.high_numwords = self.gen_high_numwords([], [], lows)
218
+ self.negword = "menos "
219
+ self.pointword = "punto"
220
+ self.errmsg_nonnum = "type(%s) no es [long, int, float]"
221
+ self.errmsg_floatord = "El float %s no puede ser tratado como un" \
222
+ " ordinal."
223
+ self.errmsg_negord = "El número negativo %s no puede ser tratado" \
224
+ " como un ordinal."
225
+ self.errmsg_toobig = (
226
+ "abs(%s) deber ser inferior a %s."
227
+ )
228
+ self.gender_stem = "o"
229
+ self.exclude_title = ["y", "menos", "punto"]
230
+ self.mid_numwords = [(1000, "mil"), (100, "cien"), (90, "noventa"),
231
+ (80, "ochenta"), (70, "setenta"), (60, "sesenta"),
232
+ (50, "cincuenta"), (40, "cuarenta"),
233
+ (30, "treinta")]
234
+ self.low_numwords = ["veintinueve", "veintiocho", "veintisiete",
235
+ "veintiséis", "veinticinco", "veinticuatro",
236
+ "veintitrés", "veintidós", "veintiuno",
237
+ "veinte", "diecinueve", "dieciocho", "diecisiete",
238
+ "dieciséis", "quince", "catorce", "trece", "doce",
239
+ "once", "diez", "nueve", "ocho", "siete", "seis",
240
+ "cinco", "cuatro", "tres", "dos", "uno", "cero"]
241
+ self.ords = {1: "primer",
242
+ 2: "segund",
243
+ 3: "tercer",
244
+ 4: "cuart",
245
+ 5: "quint",
246
+ 6: "sext",
247
+ 7: "séptim",
248
+ 8: "octav",
249
+ 9: "noven",
250
+ 10: "décim",
251
+ 20: "vigésim",
252
+ 30: "trigésim",
253
+ 40: "cuadragésim",
254
+ 50: "quincuagésim",
255
+ 60: "sexagésim",
256
+ 70: "septuagésim",
257
+ 80: "octogésim",
258
+ 90: "nonagésim",
259
+ 100: "centésim",
260
+ 200: "ducentésim",
261
+ 300: "tricentésim",
262
+ 400: "cuadrigentésim",
263
+ 500: "quingentésim",
264
+ 600: "sexcentésim",
265
+ 700: "septigentésim",
266
+ 800: "octigentésim",
267
+ 900: "noningentésim",
268
+ 1e3: "milésim",
269
+ 1e6: "millonésim",
270
+ 1e9: "billonésim",
271
+ 1e12: "trillonésim",
272
+ 1e15: "cuadrillonésim"}
273
+
274
+ def merge(self, curr, next):
275
+ ctext, cnum, ntext, nnum = curr + next
276
+
277
+ if cnum == 1:
278
+ if nnum < 1000000:
279
+ return next
280
+ ctext = "un"
281
+ elif cnum == 100 and not nnum % 1000 == 0:
282
+ ctext += "t" + self.gender_stem
283
+
284
+ if nnum < cnum:
285
+ if cnum < 100:
286
+ return "%s y %s" % (ctext, ntext), cnum + nnum
287
+ return "%s %s" % (ctext, ntext), cnum + nnum
288
+ elif (not nnum % 1000000) and cnum > 1:
289
+ ntext = ntext[:-3] + "lones"
290
+
291
+ if nnum == 100:
292
+ if cnum == 5:
293
+ ctext = "quinien"
294
+ ntext = ""
295
+ elif cnum == 7:
296
+ ctext = "sete"
297
+ elif cnum == 9:
298
+ ctext = "nove"
299
+ ntext += "t" + self.gender_stem + "s"
300
+ else:
301
+ ntext = " " + ntext
302
+
303
+ return (ctext + ntext, cnum * nnum)
304
+
305
+ def to_ordinal(self, value, gender='m'):
306
+ gender_stem = 'a' if gender == 'f' else 'o'
307
+
308
+ self.verify_ordinal(value)
309
+ if value == 0:
310
+ text = ""
311
+ elif value <= 10:
312
+ text = "%s%s" % (self.ords[value], gender_stem)
313
+ # According to RAE recommendations, simple forms are preferred up to 30
314
+ # Ortography for sobreesdrújulas
315
+ elif value <= 29:
316
+ gender_stem = 'o'
317
+ dec = (value // 10) * 10
318
+ text = (
319
+ "%s%s%s" % (self.ords[dec].replace('é', 'e'), gender_stem,
320
+ self.to_ordinal(value % 10, gender))
321
+ )
322
+ elif value <= 100:
323
+ dec = (value // 10) * 10
324
+ text = (
325
+ "%s%s %s" % (self.ords[dec], gender_stem,
326
+ self.to_ordinal(value - dec, gender))
327
+ )
328
+ elif value <= 1e3:
329
+ cen = (value // 100) * 100
330
+ text = (
331
+ "%s%s %s" % (self.ords[cen], gender_stem,
332
+ self.to_ordinal(value - cen, gender))
333
+ )
334
+ elif value < 1e18:
335
+ # Round down to the nearest 1e(3n)
336
+ # dec contains the following:
337
+ # [ 1e3, 1e6): 1e3
338
+ # [ 1e6, 1e9): 1e6
339
+ # [ 1e9, 1e12): 1e9
340
+ # [1e12, 1e15): 1e12
341
+ # [1e15, 1e18): 1e15
342
+ dec = 1000 ** int(math.log(int(value), 1000))
343
+
344
+ # Split the parts before and after the word for 'dec'
345
+ # eg (12, 345) = divmod(12_345, 1_000)
346
+ high_part, low_part = divmod(value, dec)
347
+
348
+ cardinal = self.to_cardinal(high_part) if high_part != 1 else ""
349
+ text = (
350
+ "%s%s%s %s" % (cardinal, self.ords[dec], gender_stem,
351
+ self.to_ordinal(low_part, gender=gender))
352
+ )
353
+ else:
354
+ text = self.to_cardinal(value)
355
+ # Handle exception: it's not "decimooctavo" but "decimoctavo"
356
+ return text.strip().replace('oo', 'o')
357
+
358
+ def to_ordinal_num(self, value, gender='m'):
359
+ gender_stem = 'a' if gender == 'f' else 'o'
360
+ self.verify_ordinal(value)
361
+ return "%s%s" % (value, "º" if gender_stem == 'o' else "ª")
362
+
363
+ def to_currency(self, val, currency='EUR', cents=True, separator=' con',
364
+ adjective=False):
365
+ # Handle integers specially - just add currency name without cents
366
+ if isinstance(val, int):
367
+ try:
368
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
369
+ except (KeyError, AttributeError):
370
+ # Fallback to base implementation for unknown currency
371
+ return super(Num2Word_ES, self).to_currency(
372
+ val, currency=currency, cents=cents, separator=separator,
373
+ adjective=adjective)
374
+
375
+ minus_str = self.negword if val < 0 else ""
376
+ abs_val = abs(val)
377
+ money_str = self.to_cardinal(abs_val)
378
+
379
+ # Convert "uno" to "un" for currency
380
+ if abs_val == 1:
381
+ money_str = "un"
382
+ currency_str = cr1[0] if isinstance(cr1, tuple) else cr1
383
+ else:
384
+ currency_str = cr1[1] if isinstance(cr1, tuple) and len(cr1) > 1 else (cr1[0] if isinstance(cr1, tuple) else cr1)
385
+
386
+ return (u'%s %s %s' % (minus_str, money_str, currency_str)).strip()
387
+
388
+ # For floats, use the parent class implementation but fix "uno" -> "un"
389
+ result = super(Num2Word_ES, self).to_currency(
390
+ val, currency=currency, cents=cents, separator=separator,
391
+ adjective=adjective)
392
+ # Convert "uno euro" to "un euro"
393
+ result = result.replace("veintiuno euro", "veintiún euro")
394
+ result = result.replace("veintiuno céntimo", "veintiún céntimo")
395
+ result = result.replace("uno euro", "un euro")
396
+ result = result.replace("uno céntimo", "un céntimo")
397
+ result = result.replace("uno centavo", "un centavo")
398
+ result = result.replace("uno dólar", "un dólar")
399
+ return result
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+ from .lang_ES import Num2Word_ES
21
+
22
+
23
+ class Num2Word_ES_CO(Num2Word_ES):
24
+
25
+ CURRENCY_FORMS = {
26
+ 'COP': (('peso', 'pesos'), ('centavo', 'centavos')),
27
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
28
+ 'USD': (('dólar', 'dólares'), ('centavo', 'centavos')),
29
+ }
30
+
31
+ def to_currency(self, val, currency='COP', cents=True, separator=' y', adjective=False):
32
+ # Use parent class implementation with our currency forms
33
+ result = super(Num2Word_ES_CO, self).to_currency(
34
+ val, currency=currency, cents=cents, separator=separator, adjective=adjective
35
+ )
36
+ # Handle exception, in spanish is "un euro" and not "uno euro"
37
+ return result.replace("uno", "un")
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+ # Copyright (c) 2024, Randall Castro. All Rights Reserved.
5
+
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2.1 of the License, or (at your option) any later version.
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ # You should have received a copy of the GNU Lesser General Public
15
+ # License along with this library; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
+ # MA 02110-1301 USA
18
+
19
+ from __future__ import print_function, unicode_literals
20
+
21
+ from .lang_ES import Num2Word_ES
22
+
23
+
24
+ class Num2Word_ES_CR(Num2Word_ES):
25
+
26
+ CURRENCY_FORMS = {
27
+ 'CRC': (('colón', 'colónes'), ('céntimo', 'céntimos')),
28
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
29
+ 'USD': (('dólar', 'dólares'), ('centavo', 'centavos')),
30
+ }
31
+
32
+ def to_currency(self, val, currency='CRC', cents=True, separator=' y', adjective=False):
33
+ # Use parent class implementation with our currency forms
34
+ result = super(Num2Word_ES_CR, self).to_currency(
35
+ val, currency=currency, cents=cents, separator=separator, adjective=adjective
36
+ )
37
+ # Handle exception, in spanish is "un euro" and not "uno euro"
38
+ return result.replace("uno", "un")
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+ from .lang_ES import Num2Word_ES
21
+
22
+
23
+ class Num2Word_ES_GT(Num2Word_ES):
24
+
25
+ CURRENCY_FORMS = {
26
+ 'GTQ': (('quetzal', 'quetzales'), ('centavo', 'centavos')),
27
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
28
+ 'USD': (('dólar', 'dólares'), ('centavo', 'centavos')),
29
+ }
30
+
31
+ def to_currency(self, val, currency='GTQ', cents=True, separator=' y', adjective=False):
32
+ # Use parent class implementation with our currency forms
33
+ result = super(Num2Word_ES_GT, self).to_currency(
34
+ val, currency=currency, cents=cents, separator=separator, adjective=adjective
35
+ )
36
+ # Handle exception, in spanish is "un euro" and not "uno euro"
37
+ return result.replace("uno", "un")
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+ from .lang_ES import Num2Word_ES
21
+
22
+
23
+ class Num2Word_ES_NI(Num2Word_ES):
24
+ CURRENCY_FORMS = {
25
+ 'NIO': (('córdoba', 'córdobas'), ('centavo', 'centavos')),
26
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
27
+ 'USD': (('dólar', 'dólares'), ('centavo', 'centavos')),
28
+ }
29
+
30
+ def to_currency(self, val, currency='NIO', cents=True, separator=' con',
31
+ adjective=False):
32
+ result = super(Num2Word_ES, self).to_currency(
33
+ val, currency=currency, cents=cents, separator=separator,
34
+ adjective=adjective)
35
+ return result.replace("uno", "un")
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
3
+ # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
4
+
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ # This library is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
+ # Lesser General Public License for more details.
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16
+ # MA 02110-1301 USA
17
+
18
+ from __future__ import print_function, unicode_literals
19
+
20
+ from .lang_ES import Num2Word_ES
21
+
22
+
23
+ class Num2Word_ES_VE(Num2Word_ES):
24
+
25
+ CURRENCY_FORMS = {
26
+ 'VES': (('bolívar', 'bolívares'), ('centavo', 'centavos')),
27
+ 'VEB': (('bolívar', 'bolívares'), ('centavo', 'centavos')), # Old currency
28
+ 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')),
29
+ 'USD': (('dólar', 'dólares'), ('centavo', 'centavos')),
30
+ }
31
+
32
+ def to_currency(self, val, currency='VES', cents=True, separator=' y', adjective=False, old=False):
33
+ # Handle the old parameter for backward compatibility
34
+ if old:
35
+ # For old Venezuelan Bolívar (VEB)
36
+ currency = 'VEB' if currency == 'VES' else currency
37
+
38
+ # Use parent class implementation with our currency forms
39
+ result = super(Num2Word_ES_VE, self).to_currency(
40
+ val, currency=currency, cents=cents, separator=separator, adjective=adjective
41
+ )
42
+ # Handle exception, in spanish is "un euro" and not "uno euro"
43
+ return result.replace("uno", "un")