Обсуждение: National Number to text conversion

Поиск
Список
Период
Сортировка

National Number to text conversion

От
"Samer Abukhait"
Дата:
Hello,

is there any known way to convert numbers to their text equivalent in English and other languages?

like 25 --> Twenty Five

I am interested in Arabic specifically.

Re: National Number to text conversion

От
Bob Pawley
Дата:

Make a table that you can reference. Fill it with Arabic, English or any language that you wish.
 
Make it available to the list so those who wish can particpate and receive a copy of the finished product.
 
Bob
 
----- Original Message -----
Sent: Monday, May 29, 2006 8:09 AM
Subject: [GENERAL] National Number to text conversion

Hello,

is there any known way to convert numbers to their text equivalent in English and other languages?

like 25 --> Twenty Five

I am interested in Arabic specifically.

Re: National Number to text conversion

От
"Samer Abukhait"
Дата:
Not sure that i understand..
Fill what exactly in the table?

I am seeking for a dynamic way to combine text numbers

Please also note that in Arabic .. text numbers behave differently according to the item you are counting (male or female Items)


On 5/29/06, Bob Pawley <rjpawley@shaw.ca> wrote:
Make a table that you can reference. Fill it with Arabic, English or any language that you wish.
 
Make it available to the list so those who wish can particpate and receive a copy of the finished product.
 
Bob
 
----- Original Message -----
Sent: Monday, May 29, 2006 8:09 AM
Subject: [GENERAL] National Number to text conversion

Hello,

is there any known way to convert numbers to their text equivalent in English and other languages?

like 25 --> Twenty Five

I am interested in Arabic specifically.

Re: National Number to text conversion

От
brian ally
Дата:
Bob Pawley wrote:
> Make a table that you can reference. Fill it with Arabic, English or any language that you wish.
>
> Make it available to the list so those who wish can particpate and receive a copy of the finished product.
>
> Bob
>
>   ----- Original Message -----
>   From: Samer Abukhait
>   To: pgsql-general@postgresql.org
>   Sent: Monday, May 29, 2006 8:09 AM
>   Subject: [GENERAL] National Number to text conversion
>
>
>   Hello,
>
>   is there any known way to convert numbers to their text equivalent in English and other languages?
>
>   like 25 --> Twenty Five
>
>   I am interested in Arabic specifically.
>

I was thinking the same. But Bob's reply has me wondering if there are
any online resources for this sort of thing. Specifically, i have a
look-up table, with most (possibly all - i don't know) countries'
2-letter ISO codes and english names. Just this weekend, i've learned
that i'll require the names in french, as well. I'd thought about
feeding the names to Babelfish, but, if such a list exists somewhere
that'd be a real time saver.

I have a list of Canadian provinces, in both official languages, to swap
(w00t!).

brian

Re: National Number to text conversion

От
Jorge Godoy
Дата:
Em Segunda 29 Maio 2006 12:22, brian ally escreveu:
> I was thinking the same. But Bob's reply has me wondering if there are
> any online resources for this sort of thing. Specifically, i have a
> look-up table, with most (possibly all - i don't know) countries'
> 2-letter ISO codes and english names. Just this weekend, i've learned
> that i'll require the names in french, as well. I'd thought about
> feeding the names to Babelfish, but, if such a list exists somewhere
> that'd be a real time saver.

At least for pt_BR (Brazilian Portuguese) there are lots of functions around
that can be used.  What they have of "bad" is that the names are expressed as
an array inside the function itself.

I believe that the suggestion was to use one of these functions -- for any
language, with modifications for number gender, as said it is needed in
arabian -- and instead of storing the names in an array storing them in a
table would be interesting.

I believe that this table should contain:

  - numbers from 0 to 20, 30, 40, 50, 60, 70, 80, 90, 100 (this has a
variation in pt_BR), 200, 300, 400, 500, 600, 700, 800, 900, 1000
  - suffixes for thousands, millions, billions, etc.
  - suffixes for fractions (cents, dimes, quarters, etc.)
  - gender (in pt_BR they are genderless, in pt the male gender is the
dominant with regards to the language, so I'd define the male gender as
default in a function...)
  - language (if this becomes a function to share with other people, I'd make
English the default)
  - groupping character, decimal separator (in pt_BR and en_US they are
reversed, for example)


I don't see it easily done in a multi-language way due to several
particularities of each language...  If this is going to be used for money,
things might get a bit harder (IIRC, in Portugal they have the money symbol
after the integer part and before the decimal part, making it a new "decimal"
separator...)...

Anyway, this is what I believe was suggested to be done :-)  Sorry for being
so discursive...

--
Jorge Godoy           <jgodoy@gmail.com>

Re: National Number to text conversion

От
Tom Lane
Дата:
"Samer Abukhait" <abukhait@gmail.com> writes:
> I am seeking for a dynamic way to combine text numbers

There's some code in the "money" datatype for this, but it's hard-wired
for English.

I have a vague feeling that I've seen a Perl module for the task, which
might possibly have international capability.  Search CPAN --- if you
find it you could embed it into a plperl function easily enough.

            regards, tom lane

Re: National Number to text conversion

От
"A. Kretschmer"
Дата:
am  29.05.2006, um 17:09:10 +0200 mailte Samer Abukhait folgendes:
> Hello,
>
> is there any known way to convert numbers to their text equivalent in
> English and other languages?
>
> like 25 --> Twenty Five

IIRC i have @work a book about sed and awk, and, iirc, there are a code
for awk or sed for this task. I'm not sure...


> I am interested in Arabic specifically.

Uhm, sorry, not for arabic...


--
Andreas Kretschmer    (Kontakt: siehe Header)
Heynitz:  035242/47215,      D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    ===

Re: List of countries (WAS: National Number to text conversion)

От
Nis Jorgensen
Дата:
brian ally wrote:

> I was thinking the same. But Bob's reply has me wondering if there are
> any online resources for this sort of thing. Specifically, i have a
> look-up table, with most (possibly all - i don't know) countries'
> 2-letter ISO codes and english names. Just this weekend, i've learned
> that i'll require the names in french, as well. I'd thought about
> feeding the names to Babelfish, but, if such a list exists somewhere
> that'd be a real time saver.

Do you mean something like

http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-fr1-semic.txt

Unfortunately the list is in ALL CAPS. I believe I can extract a
decapitated version from one of my systems, if you have time to wait
until tomorrow.

/Nis


Re: List of countries (WAS: National Number to text conversion)

От
brian ally
Дата:
Nis Jorgensen wrote:
> brian ally wrote:
>
>> I was thinking the same. But Bob's reply has me wondering if there are
>> any online resources for this sort of thing. Specifically, i have a
>> look-up table, with most (possibly all - i don't know) countries'
>> 2-letter ISO codes and english names. Just this weekend, i've learned
>> that i'll require the names in french, as well. I'd thought about
>> feeding the names to Babelfish, but, if such a list exists somewhere
>> that'd be a real time saver.
>
>
> Do you mean something like
>
> http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-fr1-semic.txt
>
>
> Unfortunately the list is in ALL CAPS. I believe I can extract a
> decapitated version from one of my systems, if you have time to wait
> until tomorrow.
>
> /Nis
>

Thanks, Nis. Here's my revised list, using those (errors of letter-case
entirely my own, owing to my hazy understanding of capitilisation for
hyphenated french nouns):

ISO-3166    Name (en)    Name(fr)
'AF'    'Afghanistan'    'Afghanistan'
'AL'    'Albania'    'Albanie'
'DZ'    'Algeria'    'Algérie'
'AS'    'American Samoa'    'Samoa Américaines'
'AD'    'Andorra'    'Andorre'
'AO'    'Angola'    'Angola'
'AI'    'Anguilla'    'Anguilla'
'AQ'    'Antarctica'    'Antarctique'
'AG'    'Antigua and Barbuda'    'Antigua-et-barbuda'
'AR'    'Argentina'    'Argentine'
'AM'    'Armenia'    'Arménie'
'AW'    'Aruba'    'Aruba'
'AX'    'Åland Islands'    'Åland, Îles'
'AU'    'Australia'    'Australie'
'AT'    'Austria'    'Autriche'
'AZ'    'Azerbaijan'    'Azerbaïdjan'
'BS'    'Bahamas'    'Bahamas'
'BH'    'Bahrain'    'Bahreïn'
'BD'    'Bangladesh'    'Bangladesh'
'BB'    'Barbados'    'Barbade'
'BY'    'Belarus'    'Bélarus'
'BE'    'Belgium'    'Belgique'
'BZ'    'Belize'    'Belize'
'BJ'    'Benin'    'Bénin'
'BM'    'Bermuda'    'Bermudes'
'BT'    'Bhutan'    'Bhoutan'
'BO'    'Bolivia'    'Bolivie'
'BA'    'Bosnia and Herzegovina'    'Bosnie-herzégovine'
'BW'    'Botswana'    'Botswana'
'BV'    'Bouvet Island'    'Bouvet, Île'
'BR'    'Brazil'    'Brésil'
'IO'    'British Indian Ocean Territory'    'Océan Indien, Territoire
Britannique de l''
'BN'    'Brunei Darussalam'    'Brunéi Darussalam'
'BG'    'Bulgaria'    'Bulgarie'
'BF'    'Burkina Faso'    'Burkina Faso'
'BI'    'Burundi'    'Burundi'
'KH'    'Cambodia'    'Cambodge'
'CM'    'Cameroon'    'Cameroun'
'CA'    'Canada'    'Canada'
'CV'    'Cap Verde'    'Cap-vert'
'KY'    'Cayman Islands'    'Caïmanes, Îles'
'CF'    'Central African Republic'    'Centrafricaine, République'
'TD'    'Chad'    'Tchad'
'CL'    'Chile'    'Chili'
'CN'    'China'    'Chine'
'CX'    'Christmas Island'    'Christmas, Île'
'CC'    'Cocos (Keeling) Islands'    'Cocos (Keeling), Îles'
'CO'    'Colombia'    'Colombie'
'KM'    'Comoros'    'Comores'
'CD'    'Congo, Democratic Republic of the'    'Congo, la République
Démocratique du'
'CG'    'Congo, Republic of'    'Congo'
'CK'    'Cook Islands'    'Cook, Îles'
'CR'    'Costa Rica'    'Costa Rica'
'CI'    'Côte d'Ivoire'    'Côte D'ivoire'
'HR'    'Croatia/Hrvatska'    'Croatie'
'CU'    'Cuba'    'Cuba'
'CY'    'Cyprus'    'Chypre'
'CZ'    'Czech Republic'    'Tchèque, République'
'DK'    'Denmark'    'Danemark'
'DJ'    'Djibouti'    'Djibouti'
'DM'    'Dominica'    'Dominique'
'DO'    'Dominican Republic'    'Dominicaine, République'
'TL'    'East Timor'    'Timor-Leste'
'EC'    'Ecuador'    'Équateur'
'EG'    'Egypt'    'Égypte'
'SV'    'El Salvador'    'El Salvador'
'GQ'    'Equatorial Guinea'    'Guinée équatoriale'
'ER'    'Eritrea'    'Érythrée'
'EE'    'Estonia'    'Estonie'
'ET'    'Ethiopia'    'Éthiopie'
'FK'    'Falkland Islands (Malvina)'    'Falkland, Îles (Malvinas)'
'FO'    'Faroe Islands'    'Féroé, Îles'
'FJ'    'Fiji'    'Fidji'
'FI'    'Finland'    'Finlande'
'FR'    'France'    'France'
'GF'    'French Guiana'    'Guyane Française'
'PF'    'French Polynesia'    'Polynésie Française'
'TF'    'French Southern Territories'    'Terres Australes Françaises'
'GA'    'Gabon'    'Gabon'
'GM'    'Gambia'    'Gambie'
'GE'    'Georgia'    'Géorgie'
'DE'    'Germany'    'Allemagne'
'GH'    'Ghana'    'Ghana'
'GI'    'Gibraltar'    'Gibraltar'
'GR'    'Greece'    'Grèce'
'GL'    'Greenland'    'Groenland'
'GD'    'Grenada'    'Grenade'
'GP'    'Guadeloupe'    'Guadeloupe'
'GU'    'Guam'    'Guam'
'GT'    'Guatemala'    'Guatemala'
'GG'    'Guernsey'    'Guernesey'
'GN'    'Guinea'    'Guinée'
'GW'    'Guinea-Bissau'    'Guinée-bissau'
'GY'    'Guyana'    'Guyana'
'HT'    'Haiti'    'Haïti'
'HM'    'Heard and McDonald Islands'    'Heard, Île et Mcdonald, Îles'
'VA'    'Holy See (City Vatican State)'    'Saint-siège (État de la Cité du
Vatican)'
'HN'    'Honduras'    'Honduras'
'HK'    'Hong Kong'    'Hong-kong'
'HU'    'Hungary'    'Hongrie'
'IS'    'Iceland'    'Islande'
'IN'    'India'    'Inde'
'ID'    'Indonesia'    'Indonésie'
'IR'    'Iran (Islamic Republic of)'    'Iran, République Islamique d''
'IQ'    'Iraq'    'Iraq'
'IE'    'Ireland'    'Irlande'
'IM'    'Isle of Man'    'Île de Man'
'IL'    'Israel'    'Israël'
'IT'    'Italy'    'Italie'
'JM'    'Jamaica'    'Jamaïque'
'JP'    'Japan'    'Japon'
'JE'    'Jersey'    'Jersey'
'JO'    'Jordan'    'Jordanie'
'KZ'    'Kazakhstan'    'Kazakhstan'
'KE'    'Kenya'    'Kenya'
'KI'    'Kiribati'    'Kiribati'
'KP'    'Korea, Democratic People's Republic'    'Corée, République Populaire
Démocratique de'
'KR'    'Korea, Republic of'    'Corée, République De'
'KW'    'Kuwait'    'Koweït'
'KG'    'Kyrgyzstan'    'Kirghizistan'
'LA'    'Lao People's Democratic Republic'    'Lao, République Démocratique
Populaire'
'LV'    'Latvia'    'Lettonie'
'LB'    'Lebanon'    'Liban'
'LS'    'Lesotho'    'Lesotho'
'LR'    'Liberia'    'Libéria'
'LY'    'Libyan Arab Jamahiriya'    'Libyenne, Jamahiriya Arabe'
'LI'    'Liechtenstein'    'Liechtenstein'
'LT'    'Lithuania'    'Lituanie'
'LU'    'Luxembourg'    'Luxembourg'
'MO'    'Macau'    'Macao'
'MK'    'Macedonia, Former Yugoslav Republic'    'Macédoine, l'ex-république
Yougoslave de'
'MG'    'Madagascar'    'Madagascar'
'MW'    'Malawi'    'Malawi'
'MY'    'Malaysia'    'Malaisie'
'MV'    'Maldives'    'Maldives'
'ML'    'Mali'    'Mali'
'MT'    'Malta'    'Malte'
'MH'    'Marshall Islands'    'Marshall, Îles'
'MQ'    'Martinique'    'Martinique'
'MR'    'Mauritania'    'Mauritanie'
'MU'    'Mauritius'    'Maurice'
'YT'    'Mayotte'    'Mayotte'
'MX'    'Mexico'    'Mexique'
'FM'    'Micronesia, Federal State of'    'Micronésie, États Fédérés de'
'MD'    'Moldova, Republic of'    'Moldova, République de'
'MC'    'Monaco'    'Monaco'
'MN'    'Mongolia'    'Mongolie'
'MS'    'Montserrat'    'Montserrat'
'MA'    'Morocco'    'Maroc'
'MZ'    'Mozambique'    'Mozambique'
'MM'    'Myanmar'    'Myanmar'
'NA'    'Namibia'    'Namibie'
'NR'    'Nauru'    'Nauru'
'NP'    'Nepal'    'Népal'
'NL'    'Netherlands'    'Pays-bas'
'AN'    'Netherlands Antilles'    'Antilles Néerlandaises'
'NC'    'New Caledonia'    'Nouvelle-calédonie'
'NZ'    'New Zealand'    'Nouvelle-zélande'
'NI'    'Nicaragua'    'Nicaragua'
'NE'    'Niger'    'Niger'
'NG'    'Nigeria'    'Nigéria'
'NU'    'Niue'    'Niué'
'NF'    'Norfolk Island'    'Norfolk, Île'
'MP'    'Northern Mariana Islands'    'Mariannes Du Nord, Îles'
'NO'    'Norway'    'Norvège'
'OM'    'Oman'    'Oman'
'PK'    'Pakistan'    'Pakistan'
'PW'    'Palau'    'Palaos'
'PS'    'Palestinian Territories'    'Palestinien Occupé, Territoire'
'PA'    'Panama'    'Panama'
'PG'    'Papua New Guinea'    'Papouasie-nouvelle-guinée'
'PY'    'Paraguay'    'Paraguay'
'PE'    'Peru'    'Pérou'
'PH'    'Philippines'    'Philippines'
'PN'    'Pitcairn Island'    'Pitcairn'
'PL'    'Poland'    'Pologne'
'PT'    'Portugal'    'Portugal'
'PR'    'Puerto Rico'    'Porto Rico'
'QA'    'Qatar'    'Qatar'
'RE'    'Reunion Island'    'Réunion'
'RO'    'Romania'    'Roumanie'
'RU'    'Russian Federation'    'Russie, Fédération de'
'RW'    'Rwanda'    'Rwanda'
'KN'    'Saint Kitts and Nevis'    'Saint-kitts-et-nevis'
'LC'    'Saint Lucia'    'Sainte-lucie'
'VC'    'Saint Vincent and the Grenadines'    'Saint-vincent-et-les Grenadines'
'SM'    'San Marino'    'Saint-marin'
'ST'    'São Tomé et Principe'    'Sao Tomé-et-principe'
'SA'    'Saudi Arabia'    'Arabie Saoudite'
'SN'    'Senegal'    'Sénégal'
'SC'    'Seychelles'    'Seychelles'
'SL'    'Sierra Leone'    'Sierra Leone'
'SG'    'Singapore'    'Singapour'
'SK'    'Slovak Republic'    'Slovaquie'
'SI'    'Slovenia'    'Slovénie'
'SB'    'Solomon Islands'    'Salomon, Îles'
'SO'    'Somalia'    'Somalie'
'ZA'    'South Africa'    'Afrique Du Sud'
'GS'    'South Georgia and the South Sandwich Islands'    'Géorgie du Sud et
les Îles Sandwich du Sud'
'ES'    'Spain'    'Espagne'
'LK'    'Sri Lanka'    'Sri Lanka'
'SH'    'St Helena'    'Sainte-hélène'
'PM'    'St Pierre and Miquelon'    'Saint-pierre-et-miquelon'
'SD'    'Sudan'    'Soudan'
'SR'    'Suriname'    'Suriname'
'SJ'    'Svalbard and Jan Mayen Islands'    'Svalbard et Île Jan Mayen'
'SZ'    'Swaziland'    'Swaziland'
'SE'    'Sweden'    'Suède'
'CH'    'Switzerland'    'Suisse'
'SY'    'Syrian Arab Republic'    'Syrienne, République Arabe'
'TW'    'Taiwan'    'Taïwan, Province De Chine'
'TJ'    'Tajikistan'    'Tadjikistan'
'TZ'    'Tanzania'    'Tanzanie, République-unie de'
'TH'    'Thailand'    'Thaïlande'
'TG'    'Togo'    'Togo'
'TK'    'Tokelau'    'Tokelau'
'TO'    'Tonga'    'Tonga'
'TT'    'Trinidad and Tobago'    'Trinité-et-tobago'
'TN'    'Tunisia'    'Tunisie'
'TR'    'Turkey'    'Turquie'
'TM'    'Turkmenistan'    'Turkménistan'
'TC'    'Turks and Caicos Islands'    'Turks et Caïques, Îles'
'TV'    'Tuvalu'    'Tuvalu'
'UM'    'US Minor Outlying Islands'    'Îles Mineures Éloignées des États-unis'
'UG'    'Uganda'    'Ouganda'
'UA'    'Ukraine'    'Ukraine'
'AE'    'United Arab Emirates'    'Émirats Arabes Unis'
'GB'    'United Kingdom'    'Royaume-Uni'
'US'    'United States'    'États-unis'
'UY'    'Uruguay'    'Uruguay'
'UZ'    'Uzbekistan'    'Ouzbékistan'
'VU'    'Vanuatu'    'Vanuatu'
'VE'    'Venezuela'    'Venezuela'
'VN'    'Vietnam'    'Viet Nam'
'VG'    'Virgin Islands (British)'    'Îles Vierges Britanniques'
'VI'    'Virgin Islands (USA)'    'Îles Vierges des États-unis'
'WF'    'Wallis and Futuna Islands'    'Wallis et Futuna'
'EH'    'Western Sahara'    'Sahara Occidental'
'WS'    'Western Samoa'    'Samoa'
'YE'    'Yemen'    'Yémen'
'CS'    'Serbia and Montenegro'    'Serbie-et-Monténégro'
'ZM'    'Zambia'    'Zambie'
'ZW'    'Zimbabwe'    'Zimbabwe'

Re: National Number to text conversion

От
"Greg Sabino Mullane"
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


> is there any known way to convert numbers to their text
> equivalent in English and other languages?

See:

http://search.cpan.org/~rvasicek/Lingua-Num2Word-0.07/Num2Word.pm

Easy enough to put into a pl/perlu. I've used the English version
successfully before.

> I am interested in Arabic specifically.

I did not see Lingua::AR::Numbers in the list on that page,
but it should be easy enough to create one based on the existing
modules (and release it so others can use it as well).

See also:

http://search.cpan.org/search?query=Arabic

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200605291907
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFEe3/gvJuQZxSWSsgRAmGtAJ4/Pt2rz7uOaaaobpM05q4J/TqENgCfXwDc
B5IzxhxXMC4wmr7kaxmE0js=
=0FIt
-----END PGP SIGNATURE-----



Re: List of countries (WAS: National Number to text conversion)

От
Nis Jorgensen
Дата:
brian ally wrote:

> Thanks, Nis. Here's my revised list, using those (errors of letter-case
> entirely my own, owing to my hazy understanding of capitilisation for
> hyphenated french nouns):

With the risk of getting horribly off topic, you may want to be
consistent between the languages in whether you use the "official" name
or the "common" name.

In general, this problem arises in cases where the official name is
controversial ("TAÏWAN, PROVINCE DE CHINE"), much longer than the common
one ("IRAN, RÉPUBLIQUE ISLAMIQUE D'"), differs in spelling from the
common form ("VIET NAM") or is less likely to be immediately recognized
("KOREA, REPUBLIC OF").

/Nis