Humanizer icon indicating copy to clipboard operation
Humanizer copied to clipboard

Problem in spanish with thousands and millions.

Open gibranamparan opened this issue 7 years ago • 6 comments

First of all, awesome tool. I've found a problem trying to display 21,000 in spanish, which says "Veintiuno Mil", correctly has to return "Veintiún Mil". The same with 31,000 -> "Treinta y uno mil" should be "Treinta y un mil", 41,000 -> "Cuarenta y uno mil" should be "Cuarenta y un mil", and so on, in this cases "uno" has to be replaced by "un". The same happens with the millions. I just applied some words replacings to the result to have the correct output, something like this:

    result = result.Replace("uno mil", "un mil");
    result = result.Replace("veintiun", "veintiún");

but would be good to have SpanishNumberToWordsConverter.cs corrected. Greetings :)

gibranamparan avatar Sep 29 '17 22:09 gibranamparan

Thanks for the comment. I don't think we have a native Spanish speaker in our core contributor team. Most localisations were provided by the community.

Please send us a PR. You already know where the fix should go :)

MehdiK avatar Nov 03 '17 03:11 MehdiK

I would like to take this one and maybe https://github.com/Humanizr/Humanizer/issues/650 if I have time (Spanish native speaker). However I am struggling to make the build work:

https://i.imgur.com/VKAR9t2.png

Unit tests are work fine, but for some reason I dont have those missing files. @MehdiK any idea

@MehdiK is there any place where Humanizer is discussed, forum, Reddit, IRC, Discord? I am pretty confident I can fix these fixes but I think I might need some assistance to stick to the git flow proposed in the contribution guide.

mihemihe avatar Dec 22 '17 08:12 mihemihe

@mihemihe that's my bad -- the build.proj file is a bit out of date as it's no longer used. Really the only thing you need is to ensure the solution builds and the tests pass. The CI build on the PR validates that as well.

As for flow, just create a new branch off of dev for each PR and submit them individually. That's it :)

We do have a Gitter set up, though not sure how frequently it's checked. I know I see GitHub emails fairly quickly though, and I respond to tweets quickly as well.

https://gitter.im/Humanizr/Humanizer

Happy to help you along and thanks for your help!

clairernovotny avatar Dec 22 '17 13:12 clairernovotny

btw, I just updated the build script and it should work now.

clairernovotny avatar Dec 22 '17 13:12 clairernovotny

@onovotny thanks!! it works perfectly now 👍

@gibranamparan I have been checking the official statements for this case from RAE.ES and this is basically what they propose: http://www.rae.es/consultas/veintiuna-mil-personas-o-veintiun-mil-personas

Veintiuna mil personas o veintiún mil personas Los numerales compuestos que contienen el numeral simple uno, una concuerdan en género con el sustantivo al que determinan cuando lo preceden inmediatamente, por eso debe decirse veintiuna personas, treinta y una toneladas (y no veintiún personas, treinta y un toneladas). [Para los casos de apócope, véase Veintiuna personas, veintiuno por ciento en esta misma sección].

Pero cuando entre el numeral y un sustantivo femenino se interpone la palabra mil, la concordancia de género es opcional, por lo que puede decirse tanto veintiún mil personas, treinta y un mil toneladas, como veintiuna mil personas, treinta y una mil toneladas.

La concordancia en femenino (veintiuna mil personas, treinta y una mil toneladas) se está imponiendo en el uso actual por influjo de la que obligatoriamente establecen los numerales de la serie de las centenas, que acomodan siempre su género al del sustantivo, lo precedan inmediatamente o no (setecientas toneladas, setecientas mil toneladas).

so based on this, the output for these cases would be:

1 - uno or una . The apocope form would be missing though , like in "un perro" . This would probably require overloading the Convert and creating a new extension method, and letting the dev to express his/her intent if an apocope is required. But I see no such exceptions are included in other languages, so I dont think this is something possible at this moment. 21- veintiuno or veintiuna (never veintiún ) 31 - treintaiuno or treintaiuna, or treinta y uno and treinta y una (current implementaton) (never treintaiún ) 21.000 - Veintiún mil, veintiuna mil, treinta y un mil, treinta y una mil . In this case, the gender is optional, and although the feminine form is getting more used, as the RAE states, y think the best, easier and 100% valid solution would be to simplify to veintiún mil. 31.000 - same rule than 21.000 41.000 - same rule than 21.000 21.000.000 - veintiún millones

The only problem I see, given the current implementation, is, (1)either we keep the gender neutral version for both, masculine and femenine, which is completely valid. (2)Or we stick to the gender neutral for masculine (Veintiún mil) and the femenine gender for the femenine (Veintiuna mil). In my opinion, the second option is better.

@gibranamparan What are your thoughts on this?

mihemihe avatar Dec 22 '17 22:12 mihemihe

@mihemihe wow somebody actually followed up this, I am the one's who didn't followed up after 4 years.... So sorry about this, I thinks it should apply gender neutral which is option 1. Is there any way to indicate that the subject is femenine or masculine? I think that's very specific and that could be adjusted by the developer implementing the library for his own purposes.

gibranamparan avatar Jul 21 '21 00:07 gibranamparan