Difference between revisions of "Talk:NUMBERTEXT/MONEYTEXT development"

From Apache OpenOffice Wiki
Jump to: navigation, search
(French numbering remarks)
(French numbering remarks: new remarks, old ones deleted)
Line 116: Line 116:
 
Congratulations for this fantastic extension ! It was needed for many years !
 
Congratulations for this fantastic extension ! It was needed for many years !
  
I checked numbertext-0.5.oxt, which does not yet support fr-BE and fr-CH.
+
Version 0.6 has corrected my previous observations, so I have  deleted the remarks.
  
For your tests, the french web site [http://www.leconjugueur.com/frnombre.php?nombre=3%2C14 Le Conjugueur] is probably a reference.
+
I have discovered these errors with version 0.6 :
  
==== Special cases ====
+
==== MONEYTEXT ====
100 should be written : cent  instead of : un cent (error only in NUMBERTEXT)
+
a) found same error with fr, es, it languages, maybe others
  
1000 should be written : mille  instead of : un mille
+
MONEYTEXT value 0 gives : "zéro euros" instead of : "zéro euro" (singular)
  
Same for 137, 1284, etc.
 
  
 +
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.
  
1000000000 should be written : un milliard  instead of : un milliarde
+
Compare with the rounding of Calc when formatted with 2 decimals :
  
2000000000 should be written : deux milliards  instead of : deux milliardes
+
Value 9,9949 is displayed 10 by Calc, but MONEYTEXT will treat it like 9,99
  
etc
+
MONEYTEXT produces 10 only for a value strictly greater that 9,995, for example 9,995001
  
==== Decimals ====
 
NUMBERTEXT systematically writes the decimal separator as : "comma", this is incorrect.
 
  
fr-FR and fr-BE use the comma as separator. The term "comma" translates in french as "virgule"
+
c) not language specific, case of rounding down :
  
fr-CH use a dot as separator. The term "dot" translates in french as "point"
+
MONEYTEXT value 7,004 gives : "sept euros et zéro centimes" instead of : "sept euros"
  
  
In french we write (and say) decimals as if it were a number :
+
d) combination of a) and c) :  
 
+
3,14 should be written : trois virgule quatorze  instead of : trois virgule un quatre
+
 
+
3,1415 should be written : trois virgule mille quatre cent quinze
+
 
+
3,141592 should be written : trois virgule cent quarante et un mille cinq cent quatre-vingt-douze
+
 
+
3,1415926535 should be written : trois virgule un milliard quatre cent quinze millions neuf cent vingt-six mille cinq cent trente-cinq
+
 
+
NUMBERTEXT only : 5,000375 should be written : cinq virgule zéro zéro zéro trois cent soixante-quinze
+
 
+
==== MONEYTEXT ====
+
3,1 in Euros shoud be written : trois euros et dix centimes instead of : trois euros y dix centimes
+
 
+
: [[User:Nemeth|Nemeth]]: I have fixed the reported problems in Numbertext version 0.6. The most interesting problem was the decimal handling of French,
+
the solution:
+
  
"([-−]?\d+)[.,]" "$1| virgule"
+
MONEYTEXT value 0,004 gives : "zéro euros et zéro centimes" instead of : "zéro euro"
"([-−]?\d+[.,]0*)(\d+)" $1 |$2
+
  
instead of the previous
+
==== NUMBERTEXT ====
 +
A strange behaviour of NUMBERTEXT with en-US (seen on Calc with UI fr-FR using a decimal comma, if that matters)
  
([-−]?\d+)[.,] $1| comma
+
Correct : value 123,45 gives : "one hundred and twenty-three point four five"
([-−]?\d+[.,]\d*)(\d) $1| |$2
+
  
: Many thanks for your detailed review! [[User:Nemeth|Nemeth]] 22:43, 3 September 2009 (UTC)
+
Incorrect : value 23,45 gives : "twenty-three thousand" (but MONEYTEXT is correct)

Revision as of 10:11, 4 September 2009

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)

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)

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)

Personal tools