Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Mambae Language #583

Open
wants to merge 135 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
07283cd
Initial Tetum copy of PT
PeteCoward Mar 16, 2024
0f54073
ida too sanulu
PeteCoward Mar 16, 2024
d5fd4b6
Up to 999?
PeteCoward Mar 23, 2024
a401530
up to 9999?
PeteCoward Mar 23, 2024
d4c19db
up to 100000
marobo Mar 23, 2024
e02cc67
up to 19000000000
eraulo Mar 25, 2024
be5479f
change milaun to millaun
eraulo Mar 25, 2024
751e1b6
add trillaun rua
eraulo Mar 25, 2024
1f9caa2
up to 145254635102
eraulo Mar 25, 2024
42ac30f
changed trillaun an billaun
eraulo Mar 25, 2024
f3bab15
changed iliao to illaun
eraulo Mar 25, 2024
9d53020
millaun change to miliaun
eraulo Mar 26, 2024
ef4d092
rm paramenter inside super
eraulo Mar 26, 2024
efea5df
add more 'miliaun','biliaun','triliaun'
eraulo Mar 26, 2024
bc8f63f
up to -1234567
eraulo Mar 26, 2024
babef4b
up to 2345.75
eraulo Mar 26, 2024
9593ac0
remove parameter inside super
eraulo Mar 26, 2024
75db3e6
changed e to resin
eraulo Mar 26, 2024
24f6391
changed o to u
eraulo Mar 27, 2024
9431b43
implemented test cardinal float
eraulo Mar 27, 2024
54c7fb6
add test ordinal
eraulo Mar 27, 2024
889bff2
changed antes de Cristo to antes Kristu
eraulo Mar 27, 2024
5670b9e
changed format
eraulo Mar 27, 2024
c2f5a7a
add 145254635102 testing
eraulo Mar 27, 2024
f162464
add test currency integer
eraulo Mar 27, 2024
60b46d0
add test currency integer negative
eraulo Mar 27, 2024
ceb9129
add test currency float
eraulo Mar 27, 2024
40021a2
add test year negative
eraulo Mar 27, 2024
af3370b
add test currency float negative
eraulo Mar 27, 2024
6be05c9
rm skip
eraulo Mar 27, 2024
ed7524f
add mambae language
eraulo Mar 28, 2024
4f90d95
add mambae test_mgm
eraulo Mar 28, 2024
2139e96
add lang mgm to file init
eraulo Mar 28, 2024
14266d2
add mambae lang to self.ords
eraulo Mar 28, 2024
d66426a
add test cardinal to integer
eraulo Mar 28, 2024
3d6985a
add test cardinal float negative
eraulo Mar 28, 2024
ab3a2c7
add test currency integer
eraulo Mar 28, 2024
44e9e42
add test currency integer negative
eraulo Mar 28, 2024
4ff7f1a
add test currency float
eraulo Mar 28, 2024
c0bb611
add all testing
eraulo Mar 28, 2024
046646c
add test_ordinal
eraulo Mar 28, 2024
8bd985f
changed zero to mamuk
eraulo Mar 28, 2024
51e89b9
changed EUR to USD
eraulo Apr 2, 2024
b94d0b6
Merge branch 'lang_TET' into lang_MGM
eraulo Apr 2, 2024
9469575
changed EUR to USD
eraulo Apr 2, 2024
d6600a8
Currency fixes
PeteCoward Apr 6, 2024
1c0c74b
replace walu to ualu
marobo Apr 8, 2024
e065d76
Tetun ordinal numbers
marobo Apr 8, 2024
8396b84
Merge pull request #6 from pykafe/lang_TET_curreny
eraulo Apr 8, 2024
da6ed53
Merge pull request #8 from pykafe/lang_TET_ordinal
eraulo Apr 8, 2024
795fe29
add ordinal number
eraulo Apr 9, 2024
f7cf7e2
add thousand separators and hundreds
eraulo Apr 9, 2024
7ca29b3
Merge branch 'lang_TET' into lang_MGM
eraulo Apr 9, 2024
8ace659
add parse_currency_parts, prefix_currency
eraulo Apr 9, 2024
87e23fd
correct writing
eraulo Apr 9, 2024
a88b5e3
add iid, ruu, teul
eraulo Apr 9, 2024
f3cd38b
add mambae Ermera
eraulo Apr 9, 2024
cd907a0
fixed language code
eraulo Apr 9, 2024
966da9e
correct language code
eraulo Apr 9, 2024
92b0943
fixed spelling
eraulo Apr 10, 2024
64fee90
add new source code for to_cardinal tet
eraulo Apr 11, 2024
e49694b
add ordinal to tetun
eraulo Apr 12, 2024
ec96fd3
add da and k
eraulo Apr 12, 2024
06dc175
fixed ordinal number for tetun language
eraulo Apr 12, 2024
af53518
changed variavel to english
eraulo Apr 12, 2024
4901b30
fixed logic for ordinal number
eraulo Apr 12, 2024
32ea368
Merge pull request #11 from pykafe/lang_TET_ordinal
PeteCoward Apr 13, 2024
ce84b71
Merge pull request #1 from pykafe/lang_TET
PeteCoward Apr 13, 2024
173e6e4
Fix test_currency_float
PeteCoward Apr 13, 2024
3438ad7
Don;t show sentavus if no sentavus
PeteCoward Apr 13, 2024
d662f36
test currency integer negative
marobo Apr 13, 2024
7c9a210
Merge remote-tracking branch 'origin/fix_test_currency_float' into te…
marobo Apr 13, 2024
30c2c99
Merge pull request #13 from pykafe/test_currency_integer_negative
MarioAP Apr 13, 2024
7fbdb2e
add test for ordinal
eraulo Apr 13, 2024
aff02e6
Merge pull request #14 from pykafe/test_ordinal
PeteCoward Apr 13, 2024
39e0f2b
fix test currency float negative
joanico Apr 13, 2024
97f40b8
Merge pull request #15 from pykafe/test_currency_float_negative
PeteCoward Apr 13, 2024
498cb02
fixed test currency integer
MarioAP Apr 13, 2024
a95d347
Merge pull request #16 from pykafe/test_currency_integer
PeteCoward Apr 13, 2024
97a4673
rm the comment
eraulo Apr 13, 2024
e1f2ad0
Merge branch 'lang_TET_base' into lang_MGM
eraulo Apr 14, 2024
8453216
add test cardinal integer
eraulo Apr 14, 2024
2c640f8
add test cardinal integer negative
eraulo Apr 14, 2024
94c1417
pass all test for mambae Ermera
eraulo Apr 14, 2024
65e80cf
fixed language code
eraulo Apr 16, 2024
0db1e3c
fixed atus ida resin ida to atus ida ida
eraulo Apr 17, 2024
3f84206
add DRY
eraulo Apr 18, 2024
8b52eba
add test
eraulo Apr 18, 2024
407dc35
add ho
eraulo Apr 19, 2024
0f1ba91
tyup the source code
eraulo Apr 20, 2024
83a7e41
Merge pull request #17 from pykafe/remove_commet
eraulo Apr 20, 2024
ffd3c78
tyup source code
eraulo Apr 20, 2024
62d6971
fixed ho bug
eraulo Apr 29, 2024
a108a0c
mv self.ho_result
eraulo Apr 29, 2024
84d8953
Merge branch 'atus_ida_ida' into ho_atus_ida_ida
eraulo Apr 29, 2024
a4980c5
changed 2 to 1
eraulo Apr 29, 2024
9161ad4
fixed bug ho
eraulo Apr 30, 2024
67f45b9
pass the testing
eraulo Apr 30, 2024
c3ef653
Merge pull request #23 from pykafe/bug_ho_atus_ida_ida
eraulo Apr 30, 2024
42f293e
Merge pull request #19 from pykafe/ho_atus_ida_ida
eraulo May 22, 2024
0e4bf8c
Merge branch 'lang_TET_base' into atus_ida_ida
eraulo May 22, 2024
e1b2d0f
Merge pull request #18 from pykafe/atus_ida_ida
PeteCoward May 25, 2024
62fff7f
Merge branch 'master' into lang_TET_base
PeteCoward May 25, 2024
f9253ea
Flake8 fix lang_TET.py
PeteCoward May 25, 2024
3bb3c4c
fix the test tet flake8
joanico May 25, 2024
04f7f47
isort test num2words
joanico May 25, 2024
415e915
Merge pull request #24 from pykafe/lang_TET_flake8
PeteCoward May 25, 2024
6467799
First small increases in coverage of TET
PeteCoward Jun 1, 2024
92957a1
flake8 removing unused import
PeteCoward Jun 1, 2024
0967414
removed lines that doesn't execute test
marobo Jun 1, 2024
2d2f3bb
removed anos line of code
MarioAP Jun 1, 2024
4648fbd
removed unuse codes
marobo Jun 1, 2024
eccefb9
Merge pull request #27 from pykafe/lang_TET_coverage_ony
PeteCoward Jun 1, 2024
5857212
Remove unused code in to_ordinal
PeteCoward Jun 1, 2024
8bdaa11
assert raises ordinal tests
PeteCoward Jun 1, 2024
0920efd
Remove if statement that was always true
PeteCoward Jun 1, 2024
c1edf90
rm the code
eraulo Jun 3, 2024
7ebbb48
Merge pull request #26 from pykafe/lang_TET_coverage_mario
eraulo Jun 3, 2024
b4ba97c
Merge branch 'lang_TET_coverage' into rm_code_130
eraulo Jun 4, 2024
1bb1e41
Merge pull request #28 from pykafe/rm_code_130
eraulo Jun 4, 2024
f3333a1
rm assert int(value)
eraulo Jun 4, 2024
e67b728
Merge pull request #25 from pykafe/lang_TET_coverage
eraulo Jun 4, 2024
38dda75
fixed the failing error
eraulo Jun 7, 2024
93f0f58
Merge pull request #29 from pykafe/lang_TET_fail_isort
eraulo Jun 7, 2024
edf2e66
Remove unicode literals and division
eraulo Jul 9, 2024
c941c04
Merge pull request #30 from pykafe/rm_unicode_literals
eraulo Jul 9, 2024
39958ff
Merge branch 'master' into lang_TET_base
eraulo Aug 2, 2024
c0aa867
fixed the error
eraulo Sep 19, 2024
dfdfa0c
remove empty line
eraulo Sep 19, 2024
b72e2c2
Merge branch 'lang_TET_base' into lang_MGM
eraulo Sep 22, 2024
b7dfbfb
fixed flake8
eraulo Sep 23, 2024
6ad3907
fixed flake8
eraulo Sep 23, 2024
84d79c4
Merge branch 'master' into lang_MGM_base
eraulo Sep 23, 2024
4e4c11c
Merge branch 'master' into lang_MGM_base
eraulo Oct 7, 2024
96f7865
Merge branch 'master' into lang_MGM_base
eraulo Jan 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ Besides the numerical argument, there are two main optional arguments, ``to:`` a
* ``kz`` (Kazakh)
* ``lt`` (Lithuanian)
* ``lv`` (Latvian)
* ``mgm`` (Mambae Ermera)
* ``nl`` (Dutch)
* ``no`` (Norwegian)
* ``pl`` (Polish)
Expand Down
3 changes: 3 additions & 0 deletions bin/num2words
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ Examples:
"""

from __future__ import print_function, unicode_literals

import os
import sys

from docopt import docopt

import num2words

__version__ = "0.5.14"
Expand Down
5 changes: 4 additions & 1 deletion num2words/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@

from __future__ import unicode_literals


from . import (lang_AM, lang_AR, lang_AZ, lang_BE, lang_BN, lang_CA, lang_CE,
lang_CS, lang_CY, lang_DA, lang_DE, lang_EN, lang_EN_IN,
lang_EN_NG, lang_EO, lang_ES, lang_ES_CO, lang_ES_CR,
lang_ES_GT, lang_ES_NI, lang_ES_VE, lang_FA, lang_FI, lang_FR,
lang_FR_BE, lang_FR_CH, lang_FR_DZ, lang_HE, lang_HI, lang_HU,
lang_ID, lang_IS, lang_IT, lang_JA, lang_KN, lang_KO, lang_KZ,
lang_LT, lang_LV, lang_NL, lang_NO, lang_PL, lang_PT,
lang_LT, lang_LV, lang_MGM, lang_NL, lang_NO, lang_PL, lang_PT,
lang_PT_BR, lang_RO, lang_RU, lang_SK, lang_SL, lang_SR,
lang_SV, lang_TE, lang_TET, lang_TG, lang_TH, lang_TR, lang_UK,
lang_VI)


CONVERTER_CLASSES = {
'am': lang_AM.Num2Word_AM(),
'ar': lang_AR.Num2Word_AR(),
Expand Down Expand Up @@ -79,6 +81,7 @@
'tg': lang_TG.Num2Word_TG(),
'th': lang_TH.Num2Word_TH(),
'tr': lang_TR.Num2Word_TR(),
'mgm': lang_MGM.Num2Word_MGM(),
'nl': lang_NL.Num2Word_NL(),
'uk': lang_UK.Num2Word_UK(),
'te': lang_TE.Num2Word_TE(),
Expand Down
175 changes: 175 additions & 0 deletions num2words/lang_MGM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# -*- coding: utf-8 -*-Num2Word_TET
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.

# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301 USA

import re

from num2words.currency import parse_currency_parts, prefix_currency

from .lang_EU import Num2Word_EU

DOLLAR = ("dolar", "dolar")
CENTS = ("sentavu", "sentavu")


class Num2Word_MGM(Num2Word_EU):

CURRENCY_FORMS = {
"AUD": (DOLLAR, CENTS),
"CAD": (DOLLAR, CENTS),
"EUR": (("euro", "euros"), CENTS),
"GBP": (("pound sterling", "pound sterling"), ("pence", "pence")),
"USD": (DOLLAR, CENTS),
}

GIGA_SUFFIX = None
MEGA_SUFFIX = "iliaun"

def setup(self):
super().setup()
lows = ["kuatr", "tr", "b", "m"]
self.high_numwords = self.gen_high_numwords([], [], lows)
self.negword = "menus "
self.pointword = "vírgula"
self.exclude_title = ["resi", "vírgula", "menus"]

self.mid_numwords = [
(1000, "rihun"),
(100, "atus"),
(90, "guul hoho paat"),
(80, "guul hoho teil"),
(70, "guul hoho ruu"),
(60, "guul hohon iid"),
(50, "guul liim"),
(40, "guul paat"),
(30, "guul teil"),
(20, "guul ruu"),
]
self.low_numwords = [
"saguul",
"hoho paat",
"hoho teil",
"hoho ruu",
"hohon iid",
"liim",
"paat",
"teil",
"ruu",
"iid",
"mamu",
]
self.hundreds = {
1: "atus iid",
2: "atus ruu",
3: "atus teil",
4: "atus paat",
5: "atus liim",
6: "atus hohon iid",
7: "atus hohon ruu",
8: "atus hoho teil",
9: "atus hoho paat",
}

def merge(self, curr, next):
ctext, cnum, ntext, nnum = curr + next

if cnum == 1 and nnum < 100:
return next

if nnum < cnum:
if nnum < 10:
return ("%s resi %s" % (ctext, ntext), cnum + nnum)
else:
return ("%s %s" % (ctext, ntext), cnum + nnum)

return (ntext + " " + ctext, cnum * nnum)

def to_cardinal(self, value):
result = super().to_cardinal(value)

for ext in (
"rihun",
"miliaun",
"miliaun rihun",
"biliaun",
"biliaun rihun",
):
if re.match(".*{} resi \\w*entus? (?=.*resi)".format(ext), result):
result = result.replace(f"{ext} resi", f"{ext}")

return result

def to_ordinal(self, value):
self.verify_ordinal(value)
result = super().to_cardinal(value)
result = "da" + result
return result

def to_ordinal_num(self, value):
self.verify_ordinal(value)
return "%sº" % (value)

def to_year(self, val, longval=True):
if val < 0:
return self.to_cardinal(abs(val)) + " muna Kristu"
return self.to_cardinal(val)

def to_currency(self, val, currency="USD", cents=True, adjective=False):
"""
Args:
val: Numeric value
currency (str): Currency code
cents (bool): Verbose cents
adjective (bool): Prefix currency name with adjective
Returns:
str: Formatted string
"""
left, right, is_negative = parse_currency_parts(val)

try:
cr1, cr2 = self.CURRENCY_FORMS[currency]
except KeyError:
raise NotImplementedError(
'Currency code "%s" not implemented for "%s"'
% (currency, self.__class__.__name__)
)

if adjective and currency in self.CURRENCY_ADJECTIVES:
cr1 = prefix_currency(self.CURRENCY_ADJECTIVES[currency], cr1)

minus_str = "%s " % self.negword.strip() if is_negative else ""
money_str = self._money_verbose(left, currency)
cents_str = (
self._cents_verbose(right, currency)
if cents
else self._cents_terse(right, currency)
)

if right == 0:
return "%s%s %s" % (
minus_str,
self.pluralize(left, cr1),
money_str,
)
else:

return "%s%s %s %s %s" % (
minus_str,
self.pluralize(left, cr1),
money_str,
self.pluralize(right, cr2),
cents_str,
)
Loading
Loading