savoirfairelinux / num2words

Modules to convert numbers to words. 42 --> forty-two
GNU Lesser General Public License v2.1
820 stars 497 forks source link

New languages: Welsh (Celtic) and Chechen (Nakho-Dagestanian) #543

Closed jheinecke closed 6 months ago

jheinecke commented 11 months ago

Fixes # by Johannes Heinecke

Changes proposed in this pull request:

support of two new languages

Status

How to verify this change

run tests for Welsh and Chechen

pytest -v tests/test_cy.py
pytest -v tests/test_ce.py

Additional notes

Welsh

I needed Welsh for a personal project. I also added Chechen since was on it.

The Welsh function has two additional arguments: gender (valid values fem or masc) and the counted object. The latter is needed since in Welsh the counted object does not follow the number (like English seventeen dogs) but is inserted within the numeric expression:

dau gi  ar bymtheg
2   dog on 15

e.g. num2words(17, lang="cy", counted="ci", gender="masc")

Currencies are used in the same way

E.g. num2words(31.50, lang='cy', to="currency", currency="GBP")

tair punt  ar ddeg, hanner cant    ceiniog
3   pound on 10     half   hundred penny

After a numeral the noun is always in Singular

Chechen

The Chechen API as also two language specific arguments, case (valid values: abs, gen, dat, erg, instr, mat, comp, all, obl, attr) and the semantic class (gender). The cases obl is needed when the numeral is used with a noun in non-Absolute Case, attr is needed (only internally) if the numeral precedes another numeral (ши бӀе == 2 * 100). All other cases are used if the numeral is used as a noun (Tree are coming) Chechen has 6 classes (genders) which are marked by 4 letters ("д", "б", "й" or "в".

class SG PL
1 в д
2 й д
3 д д
4 й й
5 б б
6 б д

Adjectives, numerals and verbs agree with the noun in class. In case of numerals it is only 4, 14, 40, 80 which show the class letter. If not given "д" is used:

e.g. num2words(4, lang='ce', case="abs", clazz="в")

coveralls commented 11 months ago

Coverage Status

coverage: 97.561% (+0.08%) from 97.483% when pulling 69dd3e8a012f596c0ed96ea365a413fab0ff96aa on jheinecke:master into 038e92dd673cdea6009d5e8df2b75714a651a8f8 on savoirfairelinux:master.

jheinecke commented 10 months ago

Hi, is there any action needed from me ? checks seemed to have passed successfully :-)

mrodriguezg1991 commented 6 months ago

Hi, is there any action needed from me ? checks seemed to have passed successfully :-)

Hi, sorry for the delay, seems to be some conflicts with the main branch, can you fix it, pls? Thanks

jheinecke commented 6 months ago

I resolved the conflict. Should be OK now