savoirfairelinux / num2words

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

Norwegian uplift #484

Closed gealodge closed 2 years ago

gealodge commented 2 years ago

Norwegian Uplift by gealodge

This may fix #110 but was not the motivation for the fix

Changes proposed in this pull request:

Status

How to verify this change

I have added hopefully quite comprehensive tests for the changes I have made and generally basic tests for Norwegian. Specific examples include:

>>> num2words('92', lang='no')
'nittito'
>>> num2words('1345', lang='no')
'en tusen tre hundre og førtifem'
>>> num2words('5', lang='no', to='ordinal')
'femte'
>>> num2words('5', lang='no', to='ordinal_num')
'5.'
>>> num2words('12', lang='no', to='currency')
'tolv kroner'

Additional notes

There were no tests, these needed adding. The currency conversion was completely broken, essentially dividing the numbers by 100 before converting. Hyphens and commas don't belong in Norwegian numbers like that, so I've removed them. I had to do a big shift around for the ordinals to get that working.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.4%) to 96.968% when pulling f58d9540a7622b0fb0e7939761fe4d040aa645fb on gealodge:feature/NO_tens_units into 67146ed02c3bbcbe4b7c9d9b933eb5e9d9684013 on savoirfairelinux:master.