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_TH.py ADDED
@@ -0,0 +1,214 @@
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 unicode_literals
19
+
20
+ from num2words2.base import Num2Word_Base
21
+ from num2words2.currency import parse_currency_parts
22
+ from num2words2.utils import splitbyx
23
+
24
+
25
+ class Num2Word_TH(Num2Word_Base):
26
+
27
+ def setup(self):
28
+ self.negword = 'ติดลบ'
29
+ self.pointword = 'จุด'
30
+
31
+ self.CURRENCY_FORMS = {
32
+ 'THB': (('บาท', 'บาท'), ('สตางค์', 'สตางค์')),
33
+ 'USD': (('ดอลลาร์', 'ดอลลาร์'), ('เซนต์', 'เซนต์')),
34
+ 'EUR': (('ยูโร', 'ยูโร'), ('เซนต์', 'เซนต์')),
35
+ }
36
+
37
+ self.high_numwords = []
38
+
39
+ self.mid_numwords = ['', 'สิบ', 'ร้อย', 'พัน', 'หมื่น', 'แสน', 'ล้าน']
40
+
41
+ self.low_numwords = [
42
+ 'ศูนย์', 'หนึ่ง', 'สอง', 'สาม', 'สี่',
43
+ 'ห้า', 'หก', 'เจ็ด', 'แปด', 'เก้า'
44
+ ]
45
+
46
+ def set_high_numwords(self, high_numwords):
47
+ pass
48
+
49
+ def set_mid_numwords(self, mid_numwords):
50
+ pass
51
+
52
+ def splitnum(self, six_num):
53
+ length = len(six_num) > 1
54
+ word_num = ''
55
+
56
+ for index, num in enumerate(map(int, six_num)):
57
+ if num:
58
+ if index:
59
+ word_num = self.mid_numwords[index] + word_num
60
+
61
+ if length and num == 1 and index == 0:
62
+ word_num += 'เอ็ด'
63
+ elif index == 1 and num == 2:
64
+ word_num = 'ยี่' + word_num
65
+ elif index != 1 or num != 1:
66
+ word_num = self.low_numwords[num] + word_num
67
+
68
+ elif num == 0 and index == 0 and length == 0:
69
+ word_num = self.low_numwords[0]
70
+
71
+ return word_num
72
+
73
+ def split_six(self, num_txt):
74
+ result = splitbyx(num_txt, 6, format_int=False)
75
+ result = list(result)[::-1]
76
+ number_list = []
77
+ for i in result:
78
+ number_list.append(i[::-1])
79
+ return number_list
80
+
81
+ def add_text_million(self, word_num):
82
+ result = ''
83
+
84
+ for index, t in enumerate(reversed(word_num)):
85
+ if index == 0:
86
+ result = t
87
+ else:
88
+ result = result + 'ล้าน' + t
89
+
90
+ return result
91
+
92
+ def round_2_decimal(self, number):
93
+ integer, cents, negative = parse_currency_parts(
94
+ number, is_int_with_cents=False
95
+ )
96
+ integer = '{}'.format(integer)
97
+ cents = '{}'.format(cents)
98
+
99
+ if len(cents) < 2:
100
+ add_zero = 2 - len(cents)
101
+ cents = ('0' * add_zero) + cents
102
+
103
+ text_num = integer + '.' + cents
104
+
105
+ return text_num, negative
106
+
107
+ def left_num_to_text(self, number):
108
+ # Special case for exactly 100
109
+ if number == '100':
110
+ return 'ร้อย'
111
+
112
+ # Special cases for 100 million and 1 billion
113
+ if number == '100000000':
114
+ return 'ร้อยล้าน'
115
+ if number == '1000000000':
116
+ return 'พันล้าน'
117
+
118
+ left_num_list = self.split_six(number)
119
+
120
+ left_text_list = []
121
+ for i in left_num_list:
122
+ left_text_list.append(self.splitnum(i))
123
+
124
+ left_text = self.add_text_million(left_text_list)
125
+ return left_text
126
+
127
+ def to_cardinal(self, number):
128
+ negative = number < 0
129
+
130
+ pre, post = self.float2tuple(number)
131
+ precision = self.precision
132
+ pre = '{}'.format(pre)
133
+ post = '{}'.format(post)
134
+
135
+ if negative:
136
+ pre = pre.lstrip('-')
137
+
138
+ if len(post) < precision:
139
+ add_zero = precision - len(post)
140
+ post = ('0' * add_zero) + post
141
+
142
+ result = self.left_num_to_text(pre)
143
+
144
+ right_text = ''
145
+ if not post == '0':
146
+ for i in map(int, post):
147
+ right_text = right_text + self.low_numwords[i]
148
+ result = result + 'จุด' + right_text
149
+
150
+ if negative:
151
+ result = 'ติดลบ' + result
152
+
153
+ return result
154
+
155
+ def to_ordinal(self, number):
156
+ """Convert to Thai ordinal numbers."""
157
+ try:
158
+ num = int(number)
159
+ except (ValueError, TypeError):
160
+ return str(number)
161
+
162
+ # Thai ordinal is formed by adding 'ที่' before the cardinal number
163
+ cardinal = self.to_cardinal(num)
164
+ return 'ที่' + cardinal
165
+
166
+ def to_currency(self, val, currency='THB', cents=True, separator=' ',
167
+ adjective=False):
168
+ """Convert a number to currency words."""
169
+ # Track if input was originally an integer
170
+ is_integer_input = isinstance(val, int)
171
+
172
+ # Check if value has fractional cents
173
+ from decimal import Decimal
174
+ decimal_val = Decimal(str(val))
175
+ has_fractional_cents = (decimal_val * 100) % 1 != 0
176
+
177
+ left, right, is_negative = parse_currency_parts(val, is_int_with_cents=False,
178
+ keep_precision=has_fractional_cents)
179
+
180
+ try:
181
+ cr1, cr2 = self.CURRENCY_FORMS[currency]
182
+ except KeyError:
183
+ raise NotImplementedError(
184
+ 'Currency "%s" not implemented for "%s"' % (
185
+ currency, self.__class__.__name__))
186
+
187
+ minus_str = self.negword + ' ' if is_negative else ""
188
+ money_str = self.to_cardinal(left)
189
+
190
+ # Currency name (Thai doesn't change for plural)
191
+ currency_str = cr1[0]
192
+
193
+ # For integers, don't show satang (cents)
194
+ if is_integer_input:
195
+ return "%s%s%s" % (minus_str, money_str, currency_str)
196
+
197
+ # For floats, handle fractional cents
198
+ if isinstance(right, Decimal) and has_fractional_cents:
199
+ # Convert fractional cents (e.g., 65.3 cents)
200
+ cents_str = self.to_cardinal(float(right))
201
+ elif cents:
202
+ cents_str = self.to_cardinal(int(right)) if right > 0 else self.low_numwords[0]
203
+ else:
204
+ cents_str = str(int(right))
205
+
206
+ cents_currency = cr2[0]
207
+
208
+ # Special case: if left is 0 and right >= 50, only show satang without baht
209
+ if left == 0 and right >= 50:
210
+ return "%s%s%s" % (minus_str, cents_str, cents_currency)
211
+
212
+ return "%s%s%s%s%s%s" % (
213
+ minus_str, money_str, currency_str,
214
+ separator, cents_str, cents_currency)
num2words2/lang_TK.py ADDED
@@ -0,0 +1,136 @@
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 unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+
22
+
23
+ # Turkmen language support
24
+ class Num2Word_TK(Num2Word_Base):
25
+ CURRENCY_FORMS = {
26
+ 'TMT': (('manat', 'manat'), ('teňňe', 'teňňe')),
27
+ 'USD': (('dollar', 'dollars'), ('cent', 'cents')),
28
+ 'EUR': (('euro', 'euros'), ('cent', 'cents'))
29
+ }
30
+
31
+ def setup(self):
32
+ self.negword = "minus "
33
+ self.pointword = "point"
34
+ self.ones = ['', 'bir', 'iki', 'üç', 'dört', 'bäş', 'alty', 'ýedi', 'sekiz', 'dokuz']
35
+ self.tens = ['', 'on', 'ýigrimi', 'otuz', 'kyrk', 'elli', 'altmyş', 'ýetmiş', 'segsen', 'togsan']
36
+ self.hundred = "ýüz"
37
+ self.thousand = "müň"
38
+ self.million = "million"
39
+
40
+ def to_cardinal(self, number):
41
+ """Convert a number to its word representation in Turkmen."""
42
+ n = str(number).strip()
43
+
44
+ if n.startswith('-'):
45
+ n = n[1:]
46
+ ret = self.negword
47
+ else:
48
+ ret = ""
49
+
50
+ if '.' in n:
51
+ left, right = n.split('.', 1)
52
+ ret += self._int_to_word(int(left)) + " " + self.pointword + " "
53
+ for digit in right:
54
+ ret += self._int_to_word(int(digit)) + " "
55
+ return ret.strip()
56
+ else:
57
+ return (ret + self._int_to_word(int(n))).strip()
58
+
59
+ def _int_to_word(self, number):
60
+ """Convert an integer to its word representation in Turkmen."""
61
+ if number == 0:
62
+ return self.ones[0] if self.ones[0] else "zero"
63
+
64
+ if number < 0:
65
+ return self.negword + self._int_to_word(abs(number))
66
+ elif number < 10:
67
+ return self.ones[number]
68
+ elif number < 100:
69
+ tens_val = number // 10
70
+ ones_val = number % 10
71
+ if ones_val == 0:
72
+ return self.tens[tens_val]
73
+ else:
74
+ return self.tens[tens_val] + " " + self.ones[ones_val]
75
+ elif number < 1000:
76
+ hundreds_val = number // 100
77
+ remainder = number % 100
78
+ result = self.ones[hundreds_val] + " " + self.hundred
79
+ if remainder:
80
+ result += " " + self._int_to_word(remainder)
81
+ return result
82
+ elif number < 1000000:
83
+ thousands_val = number // 1000
84
+ remainder = number % 1000
85
+ result = self._int_to_word(thousands_val) + " " + self.thousand
86
+ if remainder:
87
+ result += " " + self._int_to_word(remainder)
88
+ return result
89
+ elif number < 1000000000:
90
+ millions_val = number // 1000000
91
+ remainder = number % 1000000
92
+ result = self._int_to_word(millions_val) + " " + self.million
93
+ if remainder:
94
+ result += " " + self._int_to_word(remainder)
95
+ return result
96
+ else:
97
+ return str(number) # Fallback for very large numbers
98
+
99
+ def to_ordinal(self, number):
100
+ """Convert to ordinal in Turkmen."""
101
+ cardinal = self.to_cardinal(number)
102
+ # Language-specific ordinal suffix
103
+ return cardinal + "-nji"
104
+
105
+ def to_ordinal_num(self, number):
106
+ """Convert to abbreviated ordinal."""
107
+ return str(number) + "."
108
+
109
+ def to_year(self, val, longval=True):
110
+ """Convert to year in Turkmen."""
111
+ return self.to_cardinal(val)
112
+
113
+ def to_currency(self, val, currency='TMT', cents=True, separator=' ', adjective=False):
114
+ """Convert to currency in Turkmen."""
115
+ is_negative = False
116
+ if val < 0:
117
+ is_negative = True
118
+ val = abs(val)
119
+
120
+ parts = str(val).split('.')
121
+ left = int(parts[0]) if parts[0] else 0
122
+ right = int(parts[1][:2].ljust(2, '0')) if len(parts) > 1 and parts[1] else 0
123
+
124
+ cr1, cr2 = self.CURRENCY_FORMS.get(currency, list(self.CURRENCY_FORMS.values())[0])
125
+
126
+ left_str = self._int_to_word(left)
127
+ result = left_str + " " + (cr1[1] if left != 1 else cr1[0])
128
+
129
+ if cents and right:
130
+ cents_str = self._int_to_word(right)
131
+ result += separator + cents_str + " " + (cr2[1] if right != 1 else cr2[0])
132
+
133
+ if is_negative:
134
+ result = self.negword + result
135
+
136
+ return result.strip()
num2words2/lang_TL.py ADDED
@@ -0,0 +1,145 @@
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 unicode_literals
19
+
20
+ from .base import Num2Word_Base
21
+
22
+
23
+ # Tagalog language support
24
+ class Num2Word_TL(Num2Word_Base):
25
+ CURRENCY_FORMS = {
26
+ 'PHP': (('piso', 'piso'), ('sentimo', 'sentimo')),
27
+ 'USD': (('dollar', 'dollars'), ('cent', 'cents')),
28
+ 'EUR': (('euro', 'euros'), ('cent', 'cents'))
29
+ }
30
+
31
+ def setup(self):
32
+ self.negword = "minus "
33
+ self.pointword = "point"
34
+ self.ones = ['', 'isa', 'dalawa', 'tatlo', 'apat', 'lima', 'anim', 'pito', 'walo', 'siyam']
35
+ self.tens = ['', 'sampu', 'dalawampu', 'tatlumpu', 'apatnapu', 'limampu', 'animnapu', 'pitumpu', 'walumpu', 'siyamnapu']
36
+ self.hundred = "daan"
37
+ self.thousand = "libo"
38
+ self.million = "milyon"
39
+
40
+ def to_cardinal(self, number):
41
+ """Convert a number to its word representation in Tagalog."""
42
+ n = str(number).strip()
43
+
44
+ if n.startswith('-'):
45
+ n = n[1:]
46
+ ret = self.negword
47
+ else:
48
+ ret = ""
49
+
50
+ if '.' in n:
51
+ left, right = n.split('.', 1)
52
+ ret += self._int_to_word(int(left)) + " " + self.pointword + " "
53
+ for digit in right:
54
+ ret += self._int_to_word(int(digit)) + " "
55
+ return ret.strip()
56
+ else:
57
+ return (ret + self._int_to_word(int(n))).strip()
58
+
59
+ def _int_to_word(self, number):
60
+ """Convert an integer to its word representation in Tagalog."""
61
+ if number == 0:
62
+ return self.ones[0] if self.ones[0] else "zero"
63
+
64
+ if number < 0:
65
+ return self.negword + self._int_to_word(abs(number))
66
+ elif number < 10:
67
+ return self.ones[number]
68
+ elif number < 100:
69
+ tens_val = number // 10
70
+ ones_val = number % 10
71
+ if ones_val == 0:
72
+ return self.tens[tens_val]
73
+ else:
74
+ return self.tens[tens_val] + " " + self.ones[ones_val]
75
+ elif number < 1000:
76
+ hundreds_val = number // 100
77
+ remainder = number % 100
78
+ result = self.ones[hundreds_val] + " " + self.hundred
79
+ if remainder:
80
+ result += " " + self._int_to_word(remainder)
81
+ return result
82
+ elif number < 1000000:
83
+ thousands_val = number // 1000
84
+ remainder = number % 1000
85
+ result = self._int_to_word(thousands_val) + " " + self.thousand
86
+ if remainder:
87
+ result += " " + self._int_to_word(remainder)
88
+ return result
89
+ elif number < 1000000000:
90
+ millions_val = number // 1000000
91
+ remainder = number % 1000000
92
+ result = self._int_to_word(millions_val) + " " + self.million
93
+ if remainder:
94
+ result += " " + self._int_to_word(remainder)
95
+ return result
96
+ else:
97
+ return str(number) # Fallback for very large numbers
98
+
99
+ def to_ordinal(self, number):
100
+ """Convert to ordinal in Tagalog.
101
+
102
+ Tagalog ordinals use 'ika-' prefix for most numbers.
103
+ Special form exists for 1st (una).
104
+ """
105
+ if number == 1:
106
+ return "una" # first
107
+ elif number == 2:
108
+ return "ikalawa" # second
109
+ else:
110
+ # For other numbers, use "ika-" prefix + cardinal
111
+ cardinal = self.to_cardinal(number)
112
+ return "ika-" + cardinal
113
+
114
+ def to_ordinal_num(self, number):
115
+ """Convert to abbreviated ordinal."""
116
+ return str(number) + "."
117
+
118
+ def to_year(self, val, longval=True):
119
+ """Convert to year in Tagalog."""
120
+ return self.to_cardinal(val)
121
+
122
+ def to_currency(self, val, currency='PHP', cents=True, separator=' ', adjective=False):
123
+ """Convert to currency in Tagalog."""
124
+ is_negative = False
125
+ if val < 0:
126
+ is_negative = True
127
+ val = abs(val)
128
+
129
+ parts = str(val).split('.')
130
+ left = int(parts[0]) if parts[0] else 0
131
+ right = int(parts[1][:2].ljust(2, '0')) if len(parts) > 1 and parts[1] else 0
132
+
133
+ cr1, cr2 = self.CURRENCY_FORMS.get(currency, list(self.CURRENCY_FORMS.values())[0])
134
+
135
+ left_str = self._int_to_word(left)
136
+ result = left_str + " " + (cr1[1] if left != 1 else cr1[0])
137
+
138
+ if cents and right:
139
+ cents_str = self._int_to_word(right)
140
+ result += separator + cents_str + " " + (cr2[1] if right != 1 else cr2[0])
141
+
142
+ if is_negative:
143
+ result = self.negword + result
144
+
145
+ return result.strip()