n2words icon indicating copy to clipboard operation
n2words copied to clipboard

Incorrect punctuation in certain AR translations

Open omarsafwany opened this issue 1 year ago • 1 comments

First of all, Awesome work. 🔥 I checked a number of different libraries and that's the most accurate one so hats off.

Problem When translating certain arabic numbers, there seems to be a certain issue with spaces and و.

Input n2words(820, {lang: 'ar'})

Expected "ثمانمائة و عشرون" Actual "ثمانمائةعشرون"

Input n2words(810, {lang: 'ar'}) Expected == Actual which is "ثمانمائة و عشرة"

Input n2words(823, {lang: 'ar'}) Expected == Actual which is "ثمانمائة و ثلاثة و عشرون"

The rest 833, 843 & 853 are of same pattern

But 863, 873, 883 & 893 start the response with ثمانمائةثلاثة so there is a missing space after ثمانمائة and missing و to be consistent with the rest.

Also regarding the number 200 which is a special case, the missing space makes the output incorrect Input: 287 Expected: "مئتان و سبعة و ثمانون" Actual: "مئتانسبعة و ثمانون"

omarsafwany avatar May 27 '23 10:05 omarsafwany

@omarsafwany thank you for you encouragements and for reporting the issue. Indeed, I am aware of issues in Arabic, and I really want to fix them all. It's just a matter of time and organisation. Meanwhile, I came across this library nArabicWords that imitates n2words, but only for Arabic. It seems to support it very well. I hope soon we'll incorporate the same options in n2words.

forzagreen avatar May 28 '23 23:05 forzagreen

Hi @omarsafwany , we have just released a new version n2words/v1.20.0 that fixes this issue and others in Arabic. Feel free to test and let me know if you see other issues. Thanks

forzagreen avatar Apr 14 '24 18:04 forzagreen