savoirfairelinux / num2words

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

Erroneous -s- in French ordinals for 80, 200, ... #409

Open m-f-h opened 3 years ago

m-f-h commented 3 years ago

Expected Behaviour

In French, the trailing "-s" in "quatre-vingts", "deux cents" etc. (but not in "trois") must disappear when the ordinal suffix "-ième" is appended.

Actual Behaviour

num2words(200,lang="fr",to="ordinal") returns "deux centsième", the "-s-" should not be there. num2words(80,lang="fr",to="ordinal") returns "quatre-vingtsième", the "-s-" should not be there.

Steps to reproduce

pip install num2words python

import num2words num2words.num2words(200,lang='fr',to='ordinal') 'deux centsième'

m-f-h commented 2 years ago

patches #410 (to test_fr.py) and #411 (to lang_FR.py) would fix this issue, but it seems that the two PR's are both blocked due to absence of the other one... (?) [I guess I should have "grouped together" the two somehow...]

m-f-h commented 2 years ago

Ah no, actually #411 was blocked by File "/home/runner/work/num2words/num2words/tests/test_fr_be.py" and file "/home/runner/work/num2words/num2words/tests/test_fr_ch.py", for test case 10^6-th: these two test files required for no reason that it should be "millionsième" (maybe this was also incorrect in an old version of test_fr.py which now correctly expects "millionième")

m-f-h commented 2 years ago

Actually, the same that applies to 80 and 200 (deux cents => ordinal: deux-centième) also applies to "million" and had been fixed in my patch #410 , I had to patch files test_fr_be.py and test_fr_ch.py accordingly.

m-f-h commented 2 years ago

additionally, the somewhat obsolete fr_BE and fr_CH had several errors : in addition to those above (for ordinals ...80, 200, 10^6, 10^9...) they also have erroneous "-s" in 10^6 "un million" (NOT "un millions" as currently produced), 10^12 = un billion etc). I fear this is blocking the PR ...