.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Lingua::ES::Numeros 3pm" .TH Lingua::ES::Numeros 3pm "2022-11-21" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Lingua::ES::Numeros \- Translates numbers to spanish text .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Lingua::ES::Numeros ":constants"; \& \& my $obj = new Lingua::ES::Numeros (\*(AqMAYUSCULAS\*(Aq => 1); \& print $obj\->cardinal(124856), "\en"; \& print $obj\->real(124856.531), "\en"; \& $obj\->{GENERO} = FEMALE; \& print $obj\->ordinal(124856), "\en"; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module supports the translation of cardinal, ordinal and, real numbers, the module handles integer numbers up to vigintillions (that's 1e120), since Perl does not handle such numbers natively, numbers are kept as text strings because processing does not justify using bigint. .PP Currently Lingua::ES::Numeros handles numbers up to 1e127\-1 (999999 vigintillions). .SH "METHODS" .IX Header "METHODS" .SS "\s-1CONSTRUCTOR:\s0 new" .IX Subsection "CONSTRUCTOR: new" To create a new Lingua::ES::Numeros, use the \fBnew\fR class method. This method can receive as parameters any of the above mentioned fields. .PP Examples: .PP .Vb 1 \& use Lingua::ES::Numeros \*(Aq:constants\*(Aq; \& \& # Use the fields\*(Aq default values \& $obj = new Lingua::ES::Numeros; \& \& # Specifies the values of some of them \& $obj = Lingua::ES::Numeros\->new( ACENTOS => 0, \& MAYUSCULAS => 1, GENERO => FEMALE, \& DECIMAL => \*(Aq,\*(Aq, SEPARADORES=> \*(Aq"_\*(Aq ); .Ve .IP "\s-1DECIMAL\s0" 4 .IX Item "DECIMAL" Specifies the character string that will be used to separate the integer from the fractional part of the number to convert. The default value for \&\s-1DECIMAL\s0 is '.' .IP "\s-1SEPARADORES\s0" 4 .IX Item "SEPARADORES" Character string including all of the format characters used when representing a number. All of the characters in this string will be ignored by the parser when analyzing the number. The default value for \s-1SEPARADORES\s0 is '_' .IP "\s-1ACENTOS\s0" 4 .IX Item "ACENTOS" Affects the way in which the generated string for the translated numbers is given; if it is false, the textual representation will not have any accented characters. The default value for this field is true (with accents). .IP "\s-1MAYUSCULAS\s0" 4 .IX Item "MAYUSCULAS" If this is a true value, the textual representation of the number will be an uppercase character string. The default value for this field is false (lowercase). .IP "\s-1HTML\s0" 4 .IX Item "HTML" If this is a true value, the textual representation of the number will be a HTML-valid string character (accents will be represented by their respective \s-1HTML\s0 entities). The default value is 0 (text). .IP "\s-1GENERO\s0" 4 .IX Item "GENERO" The gender of the numbers can be \s-1MALE, FEMALE\s0 or \s-1NEUTRAL,\s0 respectively for femenine, masculine or neutral numbers. The default value is \s-1MALE.\s0 .Sp The following table shows the efect of \s-1GENDER\s0 on translation of Cardinal and Ordinal numbers: .Sp .Vb 9 \& +\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& | N | CARDINAL | ORDINAL | \& | u +\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | m | MALE |FEMALE|NEUTRAL| MALE | FEMALE | NEUTRAL | \& +\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | 1 | uno | una | un | primero | primera | primer | \& | 2 | dos | dos | dos | segundo | segunda | segundo | \& | 3 | tres | tres | tres | tercero | tercera | tercer | \& +\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ .Ve .Sp The constants \s-1MALE, FEMALE\s0 and \s-1NEUTRAL\s0 and their spanish counterparts \s-1MASCULINO, FEMENINO\s0 and \s-1NEUTRO,\s0 may be imported with the tag \*(L":constants\*(R" on module use. .IP "\s-1SEXO\s0" 4 .IX Item "SEXO" Deprecated option only for backward compatibility, use \s-1GENERO\s0 instead. .IP "\s-1UNMIL\s0" 4 .IX Item "UNMIL" This field affects only the translation of cardinal numbers. When it is a true value, the number 1000 is translated to 'un mil' (one thousand), otherwise it is translated to the more colloquial 'mil' (thousand). The default value is 1. .IP "\s-1NEGATIVO\s0" 4 .IX Item "NEGATIVO" Contains the character string with the text to which the negative sign (\-) will be translated with. Defaults to 'menos'. .Sp For example: default translation of \-5 will yield \*(L"menos cinco\*(R". .IP "\s-1POSITIVO\s0" 4 .IX Item "POSITIVO" Contains the character string with the text to which the positive sign will be translated with. Defaults to ''. .Sp For example: default translation of 5 will yield \*(L"cinco\*(R". .IP "\s-1FORMATO\s0" 4 .IX Item "FORMATO" A character string specifying how the decimals of a real number are to be translated. Its default value is 'con \f(CW%2d\fR ctms.' (see the \fBreal\fR method) .PP \fIAliases\fR .IX Subsection "Aliases" .PP All the options have the following english aliases. .PP .Vb 9 \& English Option name \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& ACCENTS ACENTOS \& UPPERCASE MAYUSCULAS \& SEPARATORS SEPARADORES \& GENDER GENERO \& POSITIVE POSITIVO \& NEGATIVE NEGATIVO \& FORMAT FORMATO .Ve .SS "cardinal" .IX Subsection "cardinal" \&\s-1SYNOPSIS:\s0 \f(CW$text\fR = \f(CW$obj\fR\->cardinal($num) .PP \fIParameters\fR .IX Subsection "Parameters" .ie n .IP "$num" 4 .el .IP "\f(CW$num\fR" 4 .IX Item "$num" the number. .PP \fIDescription\fR .IX Subsection "Description" .PP Translates a cardinal number ($num) to spanish text, translation is performed according to the following object ($obj) settings: \&\s-1DECIMAL, SEPARADORES, SEXO, ACENTOS, MAYUSCULAS, POSITIVO\s0 and \&\s-1NEGATIVO.\s0 .PP This method ignores any fraction part of the number ($num). .PP \fIReturn Value\fR .IX Subsection "Return Value" .PP Textual representation of the number as a string .SS "real" .IX Subsection "real" \&\s-1SYNOPSIS:\s0 \f(CW$text\fR = real($n; \f(CW$genf\fR, \f(CW$genm\fR) .PP Translates the real number ($n) to spanish text. .PP The optional \f(CW$genf\fR and \f(CW$genm\fR parameters are used to specify gender of the fraction part and fraction part magnitude in that order. If \f(CW$genf\fR is missing it will default to the \s-1GENDER\s0 option, and \f(CW$genm\fR will default to the \f(CW$genf\fR's value. .PP This translation is affected by the options: \s-1DECIMAL, SEPARADORES, GENDER,\s0 \&\s-1ACENTOS, MAYUSCULAS, POSITIVO, NEGATIVO\s0 and \s-1FORMATO.\s0 .PP \fIFraction format (\s-1FORMATO\s0)\fR .IX Subsection "Fraction format (FORMATO)" .PP \&\s-1FORMAT\s0 option is a formatting string like printf, it is used to format the fractional part before appending it to the integer part. It has the following format specifiers: .ie n .IP "%Ns" 4 .el .IP "\f(CW%Ns\fR" 4 .IX Item "%Ns" Formats the fractional part as text with precisión of N digits, for example: number '124.345' formatted with string '\s-1CON\s0 \f(CW%s\fR.' will yield the text 'ciento veinticuatro \s-1CON\s0 trescientas cuarenta y cinco milésimas', and formatted with string '\s-1CON\s0 \f(CW%2s\fR.' will yield 'ciento veinticuatro \s-1CON\s0 treinta y cuatro centésimas'. .ie n .IP "%Nd" 4 .el .IP "\f(CW%Nd\fR" 4 .IX Item "%Nd" Formats the fractional part as a number (no translation), with precision of N digits, veri similar to sprintf's \f(CW%d\fR format, for example: number \&'124.045' formatted with '\s-1CON\s0 \f(CW%2d\fR ctms.' will yield: 'ciento veinticuatro \&\s-1CON 04\s0 ctms.' .SS "ordinal" .IX Subsection "ordinal" \&\s-1SYNOPSIS:\s0 \f(CW$text\fR = \f(CW$obj\fR\->ordinal($num) .PP \fIParameters\fR .IX Subsection "Parameters" .ie n .IP "$num" 4 .el .IP "\f(CW$num\fR" 4 .IX Item "$num" the number. .PP \fIDescription\fR .IX Subsection "Description" .PP Translates an ordinal number ($num) to spanish text, translation is performed according to the following object ($obj) settings: \&\s-1DECIMAL, SEPARADORES, GENERO, ACENTOS, MAYUSCULAS, POSITIVO\s0 and \&\s-1NEGATIVO.\s0 .PP This method croacks if \f(CW$num\fR <= 0 and carps if \f(CW$num\fR has a fractional part. .PP \fIReturn Value\fR .IX Subsection "Return Value" .PP Textual representation of the number as a string .SS "Accessors" .IX Subsection "Accessors" Each of the options has a setter/getter with the name of the option in lowercase, all the accessors have the following sintax: .PP \fIGetters\fR .IX Subsection "Getters" .PP .Vb 1 \& $obj\->name_of_option() .Ve .PP Returns the current value of the option. .PP \fISetters\fR .IX Subsection "Setters" .PP .Vb 1 \& $obj\->name_of_option( $value ) .Ve .PP Sets the option to \f(CW$value\fR and returns \f(CW$obj\fR .PP \fIList of accessors\fR .IX Subsection "List of accessors" .PP .Vb 10 \& $obj\->accents \& $obj\->acentos \& $obj\->uppercase \& $obj\->mayusculas \& $obj\->unmil \& $obj\->html \& $obj\->decimal \& $obj\->separators \& $obj\->separadores \& $obj\->gender \& $obj\->genero \& $obj\->positive \& $obj\->positivo \& $obj\->negative \& $obj\->negativo \& $obj\->format \& $obj\->formato .Ve .SH "INTERNALS" .IX Header "INTERNALS" Functions in this secction are generally not used, but are docummented here for completeness. .PP This is not part of the module's \s-1API\s0 and is subject to change. .SS "\s-1CARDINAL SUPPORT\s0" .IX Subsection "CARDINAL SUPPORT" Construction of cardinal numbers .PP \fIcardinal_e2\fR .IX Subsection "cardinal_e2" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& cardinal_e2($n, $nn) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR (an integer in the range [0 .. 99], not verified) and adds the numbers text translation to \f(CW$nn\fR (a word stack), on a word by word basis. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIcardinal_e3\fR .IX Subsection "cardinal_e3" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& cardinal_e3($n, $nn) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR (an integer in the range [0 .. 99], not verified) and adds the numbers text translation to \f(CW$nn\fR (a word stack), on a word by word basis. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIcardinal_e6\fR .IX Subsection "cardinal_e6" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& cardinal_e6($n, $nn, $mag, $un_mil, $postfix) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .ie n .IP "$mag" 4 .el .IP "\f(CW$mag\fR" 4 .IX Item "$mag" magnitude of the number 1 for millions, 2 for billions, etc. .ie n .IP "$un_mil" 4 .el .IP "\f(CW$un_mil\fR" 4 .IX Item "$un_mil" if true 1000 is translated as \*(L"un mil\*(R" otherwise \*(L"mil\*(R" .ie n .IP "$postfix" 4 .el .IP "\f(CW$postfix\fR" 4 .IX Item "$postfix" array representing plural & singular magnitude of the number, in this order. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR, and pushes the numbers text translation into \f(CW$nn\fR, on a word by word basis, with the proper translated magnitude. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIcardinal_generic\fR .IX Subsection "cardinal_generic" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& cardinal_generic($n, $exp, $fmag, $gen) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent. .ie n .IP "$fmag" 4 .el .IP "\f(CW$fmag\fR" 4 .IX Item "$fmag" closure to format the 6 digits groups. .ie n .IP "$gen" 4 .el .IP "\f(CW$gen\fR" 4 .IX Item "$gen" gender of the magnitude (optional defaults to \s-1NEUTRAL\s0): \s-1FEMALE\s0 for female gender (1 \-> una). \s-1MALE\s0 for male gender (1 \-> uno). \s-1NEUTRAL\s0 for neutral gender (1 \-> un). .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This function translate the natural number \f(CW$n\fR to spanish words, adding gender where needed. .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" Translation of \f(CW$n\fR to spanish text as a list of words. .PP \fIcardinal_simple\fR .IX Subsection "cardinal_simple" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& cardinal_simple($n, $exp, $un_mil; $gen) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent. .ie n .IP "$un_mil" 4 .el .IP "\f(CW$un_mil\fR" 4 .IX Item "$un_mil" if true 1000 is translated as \*(L"un mil\*(R" otherwise \*(L"mil\*(R" .ie n .IP "$gen" 4 .el .IP "\f(CW$gen\fR" 4 .IX Item "$gen" gender of the magnitude (optional defaults to \s-1NEUTRAL\s0): \s-1FEMALE\s0 for female gender (1 \-> una). \s-1MALE\s0 for male gender (1 \-> uno). \s-1NEUTRAL\s0 for neutral gender (1 \-> un). .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This function translate the natural number \f(CW$n\fR to spanish words, adding gender where needed. .Sp This procedure just builds a closure with format information, to call cardinal_e6, and then calls cardinal_generic to do the work. .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" Translation of \f(CW$n\fR to spanish text as a list of words. .PP \fIfraccion_mag_prefix\fR .IX Subsection "fraccion_mag_prefix" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& fraccion_mag_prefix($mag, $gp) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent. .ie n .IP "$mag" 4 .el .IP "\f(CW$mag\fR" 4 .IX Item "$mag" magnitude of the number 1 for millionths, 2 for billionths, etc. .ie n .IP "$gp" 4 .el .IP "\f(CW$gp\fR" 4 .IX Item "$gp" gender and plural of the number, is the concatenation of gender and plural gender must be one of \s-1FEMALE, MALE\s0 or \s-1NEUTRAL,\s0 and plural must be '' for singular and 's' for plural. .Sp Note that \s-1NEUTRAL +\s0 plural is a nonsense. .ie n .IP "$ngen" 4 .el .IP "\f(CW$ngen\fR" 4 .IX Item "$ngen" gender of the number (same values as \f(CW$gen\fR). .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This function returns the name of the magnitude of a fraction, \f(CW$mag\fR is the number of decimal digits. For example 0.001 has \f(CW$mag\fR == 3 and translates to \*(L"milesimos\*(R" if \f(CW$gp\fR is (\s-1MALE .\s0 's'). .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" Translation of \f(CW$n\fR to spanish text as a string. .PP \fIfraccion_simple\fR .IX Subsection "fraccion_simple" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& fraccion_simple($n, $exp, $un_mil, $gen; $ngen) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent. .ie n .IP "$un_mil" 4 .el .IP "\f(CW$un_mil\fR" 4 .IX Item "$un_mil" if true 1000 is translated as \*(L"un mil\*(R" otherwise \*(L"mil\*(R" .ie n .IP "$gen" 4 .el .IP "\f(CW$gen\fR" 4 .IX Item "$gen" gender of the magnitude (optional defaults to \s-1NEUTRAL\s0): \s-1FEMALE\s0 for female gender (1 \-> primera). \s-1MALE\s0 for male gender (1 \-> primero). \s-1NEUTRAL\s0 for neutral gender (1 \-> primer). .ie n .IP "$ngen" 4 .el .IP "\f(CW$ngen\fR" 4 .IX Item "$ngen" gender of the number (same values as \f(CW$gen\fR). .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This function translate the fraction \f(CW$n\fR to spanish words, adding gender where needed. .Sp This procedure just builds a closure with format information, to call cardinal_e6, and then calls cardinal_generic to do the work. .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" Translation of \f(CW$n\fR to spanish text as a list of words. .SS "\s-1ORDINAL SUPPORT\s0" .IX Subsection "ORDINAL SUPPORT" Construction of ordinal numbers .PP \fIordinal_e2\fR .IX Subsection "ordinal_e2" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& ordinal_e2($n, $nn) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR (an integer in the range [0 .. 99], not verified) and adds the numbers text translation to \f(CW$nn\fR (a word stack), on a word by word basis. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIordinal_e3\fR .IX Subsection "ordinal_e3" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& ordinal_e3($n, $nn) .Ve .IP "Parameters" 4 .IX Item "Parameters" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR (an integer in the range [0 .. 999], not verified) and adds the numbers text translation to \f(CW$nn\fR (a word stack), on a word by word basis. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIordinal_e6\fR .IX Subsection "ordinal_e6" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& ordinal_e6($n, $nn, $mag, $un_mil, $postfix) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$nn" 4 .el .IP "\f(CW$nn\fR" 4 .IX Item "$nn" word stack. .ie n .IP "$mag" 4 .el .IP "\f(CW$mag\fR" 4 .IX Item "$mag" magnitude of the number 1 for millions, 2 for billions, etc. .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This procedure takes \f(CW$n\fR, and pushes the numbers text translation into \f(CW$nn\fR, on a word by word basis, with the proper translated magnitude. If \f(CW$n\fR == 0 nothing is pushed into \f(CW$nn\fR. .PP \fIordinal_simple\fR .IX Subsection "ordinal_simple" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& ordinal_simple($n, $exp; $gen) .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$n" 4 .el .IP "\f(CW$n\fR" 4 .IX Item "$n" .PD the number. .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent. .ie n .IP "$un_mil" 4 .el .IP "\f(CW$un_mil\fR" 4 .IX Item "$un_mil" if true 1000 is translated as \*(L"un mil\*(R" otherwise \*(L"mil\*(R" .ie n .IP "$gen" 4 .el .IP "\f(CW$gen\fR" 4 .IX Item "$gen" gender of the magnitude (optional defaults to \s-1NEUTRAL\s0): \s-1FEMALE\s0 for female gender (1 \-> primera). \s-1MALE\s0 for male gender (1 \-> primero). \s-1NEUTRAL\s0 for neutral gender (1 \-> primer). .RE .RS 4 .RE .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" This function translate the fraction \f(CW$n\fR to spanish words, adding gender where needed. .Sp This procedure just builds a closure with format information, to call ordinal_e6, and then calls ordinal_generic to do the work. .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" Translation of \f(CW$n\fR to spanish text as a list of words. .SS "\s-1MISCELANEOUS\s0" .IX Subsection "MISCELANEOUS" Everithing not fitting elsewere .PP \fIparse_num\fR .IX Subsection "parse_num" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& parse_num($num, $dec, $sep) .Ve .Sp Decomposes the number in its constitutive parts, and returns them in a list: .Sp .Vb 2 \& use Lingua::ES::Numeros; \& ($sgn, $ent, $frc, $exp) = parse_num(\*(Aq123.45e10\*(Aq, \*(Aq.\*(Aq, \*(Aq",\*(Aq); .Ve .IP "\s-1PARAMETERS\s0" 4 .IX Item "PARAMETERS" .RS 4 .PD 0 .ie n .IP "$num" 4 .el .IP "\f(CW$num\fR" 4 .IX Item "$num" .PD the number to decompose .ie n .IP "$dec" 4 .el .IP "\f(CW$dec\fR" 4 .IX Item "$dec" decimal separator (typically ',' or '.'). .ie n .IP "$sep" 4 .el .IP "\f(CW$sep\fR" 4 .IX Item "$sep" separator characters ignored by the parser, usually to mark thousands, millions, etc.. .RE .RS 4 .RE .IP "\s-1RETURN VALUE\s0" 4 .IX Item "RETURN VALUE" This function parses a general number and returns a list of 4 elements: .RS 4 .ie n .IP "$sgn" 4 .el .IP "\f(CW$sgn\fR" 4 .IX Item "$sgn" sign of the number: \-1 if negative, 1 otherwise .ie n .IP "$int" 4 .el .IP "\f(CW$int\fR" 4 .IX Item "$int" integer part of the number .ie n .IP "$frc" 4 .el .IP "\f(CW$frc\fR" 4 .IX Item "$frc" decimal (fraction) part of the number .ie n .IP "$exp" 4 .el .IP "\f(CW$exp\fR" 4 .IX Item "$exp" exponent of the number .RE .RS 4 .Sp Croaks if there is a syntax error. .RE .PP \fIretval\fR .IX Subsection "retval" .IP "\s-1SYNOPSIS\s0" 4 .IX Item "SYNOPSIS" .Vb 1 \& $obj\->retval($value) .Ve .IP "\s-1DESCRIPTION\s0" 4 .IX Item "DESCRIPTION" Utility method to adjust return values, transforms text following the options: \s-1ACENTOS, MAYUSCULAS\s0 y \s-1HTML.\s0 .Sp Returns the adjusted \f(CW$value\fR. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" Perl 5.006, Exporter, Carp .SH "SEE ALSO" .IX Header "SEE ALSO" http://roble.pntic.mec.es/~msanto1/ortografia/numeros.htm .SH "AUTHOR" .IX Header "AUTHOR" Jose Rey, .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2001\-2009 by Jose Rey .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.