Talk:NUMBERTEXT/MONEYTEXT development
Discussion page of NUMBERTEXT/MONEYTEXT development
Start a new section for a new theme, bug report or a language module (Soros program). See also NUMBERTEXT.org.
License requirements: Soros programs of NUMBERTEXT project are released under LGPL/BSD dual-license.
Use ~~~~ (four tilde) at the end of your comment to include your login name and a time stamp.
To indent your comment, use one or more colons at the beginning of it.
Some languages need male/female option for number to text
Hi, in Catalan de numbers 1 and 2 can be male or female, based on what's numered. Example: cotxe (car) is male and flor (flower) is female. So 1 cotxe (one car) is spelled "un cotxe" and 1 flor (one flower) is spelled "una flor". So, 1--> un (if male noun) and una (if female noun), 2 --> dos (if male noun) and dues (if female noun).
This male/female change also happens in numbers finished in 1 and 2 different that 11 and 12 (21, 22, 31, 32, ...) and also in hundreds and thousands.
Spanish also has this male/female, but only in numbers finished in 1. In Spanish 2 it's always spelled "dos".
Finally, this male/female isseu als is important for currency to text. Many currency are treated as male nouns: euro, dollar. But few currencis are "female": sterling pounds or the old spanish peseta. So, 1200 $ is spelled as "mil dos-cents dòllars", but 1200 PTA is spelled as "mil dues-centes pessetes".
- I have fixed them by text converters. ca_ES uses manual arguments for the gender of the currency units and subunits, es_ES module uses automatic gender detection (feminine units end with "a" or "as"):
# masculine to feminine conversion of "un" after millions, # if "as?$" matches currency name f:(.*ill)(.*),(.*) \1$(f:\2,\3) # don't modify un in millions f:(.*un)([^a].*,|,)(.*as?) $(f:\1a\2\3) # un libra -> una libra f:(.*),(.*) \1 \2 "([A-Z]{3}) ([-−]?1)" $(f:|$2,$(\1:us)) "([A-Z]{3}) ([-−]?\d+0{6,})" $2 de $(\1:up) "([A-Z]{3}) ([-−]?\d+)" $(f:|$2,$(\1:up))
- Thanks for your report. Nemeth 22:12, 3 September 2009 (UTC)
Works fine with currency, thanks. But I'm thinking in some additional option in NUMBERTEX OOo Calc function. Currently we have, =NUMBERTEXT(number); =NUMBERTEXT(number,lang_code); What about? =NUMBERTEXT(number,lang_code, gender_code); Where gender_code can be: 0,1,2,.... Catalan only needs 2 variations, but may be other languages uses 3 or more variations. Of course, masculine/0 code as default.
or maybe better? =NUMBERTEXT_FEM(number); =NUMBERTEXT_FEM(number,lang_code); for "feminine" option.
Of course, we could use MONEYTEXT function with a fake currency code, with feminine tag, but empty units strings. But I think it is a workarround. --Jmontane 20:35, 6 September 2009 (UTC)
Some fixes on Catalan definition
__numbertext__ ^0 zero 1$ u 1 un 2 dos 3 tres 4 quatre 5 cinc 6 sis 7 set 8 vuit 9 nou 10 deu 11 onze 12 dotze 13 tretze 14 catorze 15 quinze 16 setze 17 disset 1(\d) di$1 20 vint 2(\d) vint-i-$1 30 trenta 40 quaranta 50 cinquanta 60 seixanta 70 setanta 80 vuitanta 90 noranta (\d)(\d) $(\10)-$2 1(\d\d) cent $1 (\d)(\d\d) $1-cents $2 1(\d{3}) mil $1 (\d{1,3})(\d{3}) $1 mil $2 1(\d{6}) un milió $1 (\d{1,6})(\d{6}) $1 milions $2 1(\d{9}) mil milions $1 1(\d{12}) un bilió $1 (\d{1,6})(\d{12}) $1 bilions $2 1(\d{18}) un trilió $1 (\d{1,6})(\d{18}) $1 trilions $2 1(\d{24}) un quadrilió $1 (\d{1,6})(\d{24}) $1 quadrilions $2 # negative number? [-−](\d+) menys |$1 # decimals "([-−]?\d+)[.,]" $1| coma "([-−]?\d+[.,]\d*)(\d)" $1| |$2 # currency # unit/subunit singular/plural us:([^,]*),([^,]*),([^,]*),([^,]*) \1 up:([^,]*),([^,]*),([^,]*),([^,]*) \2 ss:([^,]*),([^,]*),([^,]*),([^,]*) \3 sp:([^,]*),([^,]*),([^,]*),([^,]*) \4 CHF:(\D+) $(\1: franc suís, francs suís, cèntim, cèntims) EUR:(\D+) $(\1: euro, euros, cèntim, cèntims) GBP:(\D+) $(\1: lliura esterlina, lliures esterlines, penic, penics) JPY:(\D+) $(\1: ien, iens, sen, sen) USD:(\D+) $(\1: dòlar EUA, dòlar EUA, cent, cents) "([A-Z]{3}) ([-−]?1)([.,]00?)?" $2 $(\1:us) "([A-Z]{3}) ([-−]?\d+)([.,]00?)?" $2 $(\1:up) "(([A-Z]{3}) [-−]?\d+)[.,](01)" $1 amb $(1) $(\2:ss) "(([A-Z]{3}) [-−]?\d+)[.,](\d)" $1 amb $(\30) $(\2:sp) "(([A-Z]{3}) [-−]?\d+)[.,](\d\d)" $1 amb $3 $(\2:sp)
- Fixed in Numbertext 0.6. Many thanks for your help. Nemeth 22:16, 3 September 2009 (UTC)
- Thanks for your work. I've updated at launchpad (bug #425374) Catalan Soros code with some fixes and improvements.
French numbering remarks
Congratulations for this fantastic extension ! It was needed for many years !
Version 0.6 has corrected my previous observations, so I have deleted the remarks.
I have discovered these errors with version 0.6 :
MONEYTEXT
a) found same error with fr, es, it languages, maybe others
MONEYTEXT value 0 gives : "zéro euros" instead of : "zéro euro" (singular)
b) Not language specific : When there is more than two decimals, MONEYTEXT rounds the value to 2 decimals, that is correct behaviour, I think. But currently it rounds up only above decimal 5, instead of from decimal 5.
Compare with the rounding of Calc when formatted with 2 decimals :
Value 9,9949 is displayed 10 by Calc, but MONEYTEXT will treat it like 9,99
MONEYTEXT produces 10 only for a value strictly greater that 9,995, for example 9,995001
c) not language specific, case of rounding down :
MONEYTEXT value 7,004 gives : "sept euros et zéro centimes" instead of : "sept euros"
d) combination of a) and c) :
MONEYTEXT value 0,004 gives : "zéro euros et zéro centimes" instead of : "zéro euro"
NUMBERTEXT
A strange behaviour of NUMBERTEXT with en-US (seen on Calc with UI fr-FR using a decimal comma, if that matters)
Correct : value 123,45 gives : "one hundred and twenty-three point four five"
Incorrect : value 23,45 gives : "twenty-three thousand" (but MONEYTEXT is correct)
There is a general problem with numbers lower than 1 : no textual result !
Value 0,98 gives (in all languages) : 0,98
Negative values
For a negative value in french we don't say "négatif de " but "moins ". Example with value -8,3
NUMBERTEXT gives : "négatif de huit virgule trois" instead of : "moins huit virgule trois"
MONEYTEXT gives : "négatif de huit euros et trente centimes" instead of : "moins huit euros et trente centimes"
BMarcelly 10:29, 4 September 2009 (UTC)
Monetary units
These monetary units are listed in file numbertext_fr_FR.py (and other french variants) but are not recognized by MONEYTEXT:
BIF, DJF, DZD, GNF, HTF, KMF, MAD, MUR, SCR, VUV, XOF
For fr-FR, fr-BE, fr-CH you should add XPF: franc Pacifique
singular : 1 franc Pacifique ; plural : 2 francs Pacifique
In file numbertext_ro_RO.py the monetary unit RON is listed but not recognized by MONEYTEXT.
The country code for sweden is incorrect: sv-SV means swedish from Salvador! Original swedish is sv-SE
BMarcelly 12:29, 5 September 2009 (UTC)