Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #14147 > unrolled thread

number and words

Started byDaniel <daniel.chmielewski@gmail.com>
First post2012-05-02 13:55 -0700
Last post2012-05-03 15:32 -0700
Articles 20 on this page of 23 — 11 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  number and words Daniel <daniel.chmielewski@gmail.com> - 2012-05-02 13:55 -0700
    Re: number and words Arne Vajhøj <arne@vajhoej.dk> - 2012-05-02 17:01 -0400
    Re: number and words Roedy Green <see_website@mindprod.com.invalid> - 2012-05-02 14:23 -0700
      Re: number and words Lew <lewbloch@gmail.com> - 2012-05-02 16:13 -0700
        Re: number and words Arne Vajhøj <arne@vajhoej.dk> - 2012-05-02 19:19 -0400
          Re: number and words Gene Wirchenko <genew@ocis.net> - 2012-05-02 20:05 -0700
        Re: number and words Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-02 18:41 -0500
          Re: number and words Gene Wirchenko <genew@ocis.net> - 2012-05-02 20:06 -0700
            Re: number and words Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-03 00:06 -0500
              Re: number and words Gene Wirchenko <genew@ocis.net> - 2012-05-03 09:15 -0700
                Re: number and words Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-05-03 12:00 -0500
                  Re: number and words Gene Wirchenko <genew@ocis.net> - 2012-05-03 13:26 -0700
        Re: number and words RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2012-05-03 10:03 +0100
          Re: number and words Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2012-05-03 06:15 -0300
          Re: number and words Lew <lewbloch@gmail.com> - 2012-05-03 14:08 -0700
            Re: number and words glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-05-04 05:49 +0000
              Re: number and words Lew <lewbloch@gmail.com> - 2012-05-04 06:46 -0700
                Re: number and words glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-05-04 19:41 +0000
        Re: number and words Roedy Green <see_website@mindprod.com.invalid> - 2012-05-03 14:14 -0700
      Re: number and words Daniel <daniel.chmielewski@gmail.com> - 2012-05-02 16:20 -0700
        Re: number and words Martin Gregorie <martin@address-in-sig.invalid> - 2012-05-03 15:12 +0000
          Re: number and words Roedy Green <see_website@mindprod.com.invalid> - 2012-05-03 14:28 -0700
            Re: number and words Tom McGlynn <taqmcg@gmail.com> - 2012-05-03 15:32 -0700

Page 1 of 2  [1] 2  Next page →


#14147 — number and words

FromDaniel <daniel.chmielewski@gmail.com>
Date2012-05-02 13:55 -0700
Subjectnumber and words
Message-ID<7d4884d6-aebf-436e-8a76-1e2a3bf10c8b@n1g2000vby.googlegroups.com>
Hi Everybody,
I am looking for library (open source or liberal license) which enable
me to solve the fallowing problem in Java.


I need to convert numbers into words in different languages for
example:

in english:
123 one hundred twenty three

in german:
123 eins hudrer deiund zwanzig

in polish:
123 sto dwadzieścia trzy
and similar in the most common languages:
Italian, German, English, etc.

I have tried to find.... but without results... in php I have found
this kind of lib, but now I have to write software in Java ;-)  Do you
have any suggestions? Do you know this kind of libs?

regards,
Daniel

[toc] | [next] | [standalone]


#14149

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-02 17:01 -0400
Message-ID<4fa1a095$0$286$14726298@news.sunsite.dk>
In reply to#14147
On 5/2/2012 4:55 PM, Daniel wrote:
> I am looking for library (open source or liberal license) which enable
> me to solve the fallowing problem in Java.
>
> I need to convert numbers into words in different languages for
> example:
>
> in english:
> 123 one hundred twenty three
>
> in german:
> 123 eins hudrer deiund zwanzig
>
> in polish:
> 123 sto dwadzieścia trzy
> and similar in the most common languages:
> Italian, German, English, etc.
>
> I have tried to find.... but without results... in php I have found
> this kind of lib, but now I have to write software in Java ;-)  Do you
> have any suggestions? Do you know this kind of libs?

I have never seen one in Java either.

I can rewrite the C# code to Java, but ...

:-)

Arne

[toc] | [prev] | [next] | [standalone]


#14151

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-05-02 14:23 -0700
Message-ID<je93q7980grd9ihrq7r22k6ifn9800qiif@4ax.com>
In reply to#14147
On Wed, 2 May 2012 13:55:00 -0700 (PDT), Daniel
<daniel.chmielewski@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>in english:
>123 one hundred twenty three
>
>in german:
>123 eins hudrer deiund zwanzig

see http://mindprod.com/applet/inwords.html

includes source.
there are about 100 languages, though some are not languages in the
usual sense.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML. 
They forget that the simplest language is the one you 
already know. They also forget that their simple little 
markup language will bit by bit become even more convoluted 
and complicated than HTML because of the unplanned way it grows.
.

[toc] | [prev] | [next] | [standalone]


#14167

FromLew <lewbloch@gmail.com>
Date2012-05-02 16:13 -0700
Message-ID<26508931.2139.1336000428636.JavaMail.geo-discussion-forums@pbcvn7>
In reply to#14151
Roedy Green wrote:
> Daniel wrote, quoted or indirectly quoted someone who said :
> 
>>in english [sic]:
>>123 one hundred twenty three

"One hundred twenty-three"

>>in german [sic]:
>>123 eins hudrer deiund zwanzig
> 
> see http://mindprod.com/applet/inwords.html
> 
> includes source.
> there are about 100 languages, though some are not languages in the
> usual sense.

Another approach would be to expand into one language, e.g., English, then use resource bundles to translate those words into other languages. I don't know how effective this would be.

Yet another approach would be to use a database to store translations. The finite approaches are limited, though, for example they might not work well for some words, such as "quatre-vingt" in French, which you might not want translated as "four-twenty" in English.

Sorry, I'm not aware of any free code, but does Google Translate have a Web service? If so, do they charge for it?

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#14169

FromArne Vajhøj <arne@vajhoej.dk>
Date2012-05-02 19:19 -0400
Message-ID<4fa1c108$0$287$14726298@news.sunsite.dk>
In reply to#14167
On 5/2/2012 7:13 PM, Lew wrote:
> Roedy Green wrote:
>> Daniel wrote, quoted or indirectly quoted someone who said :
>>
>>> in english [sic]:
>>> 123 one hundred twenty three
>
> "One hundred twenty-three"
>
>>> in german [sic]:
>>> 123 eins hudrer deiund zwanzig
>>
>> see http://mindprod.com/applet/inwords.html
>>
>> includes source.
>> there are about 100 languages, though some are not languages in the
>> usual sense.
>
> Another approach would be to expand into one language, e.g., English, then use resource bundles to translate those words into other languages. I don't know how effective this would be.

It will not work.

The order of the part vary between languages and some languages
has multiple words for the same depending on what it is counting
(gender).

> Sorry, I'm not aware of any free code, but does Google Translate have a Web service? If so, do they charge for it?

Not free.

https://developers.google.com/translate/v2/faq#access

But rather cheap.

https://developers.google.com/translate/v2/pricing

(20 USD per 1 M characters seems cheap to me)

Arne

[toc] | [prev] | [next] | [standalone]


#14179

FromGene Wirchenko <genew@ocis.net>
Date2012-05-02 20:05 -0700
Message-ID<t3t3q7hefivdeit45tq1j07ebqnhqrdver@4ax.com>
In reply to#14169
On Wed, 02 May 2012 19:19:34 -0400, Arne Vajhøj <arne@vajhoej.dk>
wrote:

>On 5/2/2012 7:13 PM, Lew wrote:

[snip]

>> Another approach would be to expand into one language, e.g., English,
 then use resource bundles to translate those words into other
languages. I don't know how effective this would be.
>
>It will not work.

     ... and with a vengeance!

>The order of the part vary between languages and some languages
>has multiple words for the same depending on what it is counting
>(gender).

     ... or how many one is counting.  Some languages have special
forms for two of something.

     More complexity:

     French has some numbers that are in scores.  74 is
"soixante-quatorze" (60 14).

     In Chinese, 1) the digits are grouped in fours -- one hundred
thousand is literally "ten ten-thousand" -- and 2) in some cases, one
has to insert the word for zero in mid-number.

     I understand that some languages reverse the order of some of
number words.

[snip]

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14173

FromLeif Roar Moldskred <leifm@dimnakorr.com>
Date2012-05-02 18:41 -0500
Message-ID<d46dneSt5fmCWzzSnZ2dnUVZ8uqdnZ2d@giganews.com>
In reply to#14167
Lew <lewbloch@gmail.com> wrote:

> Another approach would be to expand into one language, e.g.,
> English, then use resource bundles to translate those words into
> other languages. I don't know how effective this would be.

You'd quickly run into issues with different languages constructing
large numbers in different ways. To point out a worst case scenario,
there are languages that are duodecimal, i.e. they form numbers in
base 12 rather than base 10. 

-- 
Leif Roar Moldskred
 

[toc] | [prev] | [next] | [standalone]


#14180

FromGene Wirchenko <genew@ocis.net>
Date2012-05-02 20:06 -0700
Message-ID<7gt3q79ic5cmde4a217o6c672jkvgntfu0@4ax.com>
In reply to#14173
On Wed, 02 May 2012 18:41:19 -0500, Leif Roar Moldskred
<leifm@dimnakorr.com> wrote:

>Lew <lewbloch@gmail.com> wrote:
>
>> Another approach would be to expand into one language, e.g.,
>> English, then use resource bundles to translate those words into
>> other languages. I don't know how effective this would be.
>
>You'd quickly run into issues with different languages constructing
>large numbers in different ways. To point out a worst case scenario,
>there are languages that are duodecimal, i.e. they form numbers in
>base 12 rather than base 10. 

     Oh, my!  I have not heard of that one.  Which languages?

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14181

FromLeif Roar Moldskred <leifm@dimnakorr.com>
Date2012-05-03 00:06 -0500
Message-ID<leudnfgw96zNjz_SnZ2dnUVZ8uednZ2d@giganews.com>
In reply to#14180
Gene Wirchenko <genew@ocis.net> wrote:
> 
>     Oh, my!  I have not heard of that one.  Which languages?

Fairly esoteric languages in this context I'll admit. Mostly some
Nigerian languages, but also the Chepal language in Nepal. There are
several other bases in use by languages though, with (in addition to
base 10) base 5 and base 20 the most common.

-- 
Leif Roar Moldskred

[toc] | [prev] | [next] | [standalone]


#14189

FromGene Wirchenko <genew@ocis.net>
Date2012-05-03 09:15 -0700
Message-ID<o1b5q79ijk4jb100okp4kh5l7omi1b4914@4ax.com>
In reply to#14181
On Thu, 03 May 2012 00:06:24 -0500, Leif Roar Moldskred
<leifm@dimnakorr.com> wrote:

>Gene Wirchenko <genew@ocis.net> wrote:
>> 
>>     Oh, my!  I have not heard of that one.  Which languages?
>
>Fairly esoteric languages in this context I'll admit. Mostly some
>Nigerian languages, but also the Chepal language in Nepal. There are
>several other bases in use by languages though, with (in addition to
>base 10) base 5 and base 20 the most common.

     Are you sure about the spelling for "Chepal"?  I tried to find
something on it to no avail.

     I recall one science fiction novel with parallel universes that
had one that had a base 8 numbering system.  <look look>  "The Coming
of the Quantum Cats" by Frederik Pohl.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14196

FromLeif Roar Moldskred <leifm@dimnakorr.com>
Date2012-05-03 12:00 -0500
Message-ID<krmdnbaMFKQ9JD_SnZ2dnUVZ8kqdnZ2d@giganews.com>
In reply to#14189
Gene Wirchenko <genew@ocis.net> wrote:
> 
>     Are you sure about the spelling for "Chepal"?  I tried to find
> something on it to no avail.

My bad, it's "Chepang."

-- 
Leif Roar Moldskred

[toc] | [prev] | [next] | [standalone]


#14213

FromGene Wirchenko <genew@ocis.net>
Date2012-05-03 13:26 -0700
Message-ID<keq5q79de2hp179ojp0qvaocqvk49j7rfk@4ax.com>
In reply to#14196
On Thu, 03 May 2012 12:00:16 -0500, Leif Roar Moldskred
<leifm@dimnakorr.com> wrote:

>Gene Wirchenko <genew@ocis.net> wrote:
>> 
>>     Are you sure about the spelling for "Chepal"?  I tried to find
>> something on it to no avail.
>
>My bad, it's "Chepang."

     Thank you.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14182

FromRedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Date2012-05-03 10:03 +0100
Message-ID<4fa249d6$0$12272$5b6aafb4@news.zen.co.uk>
In reply to#14167
On 03/05/2012 00:13, Lew wrote:
> Roedy Green wrote:
>> Daniel wrote, quoted or indirectly quoted someone who said :
>>
>>> in english [sic]:
>>> 123 one hundred twenty three
>
> "One hundred twenty-three"  [sic]
>

In English†:
"One hundred *and* twenty three"

-- 
RGB
† English English, as it is spoken in England. This bit anyway. Currently.

[toc] | [prev] | [next] | [standalone]


#14183

FromArved Sandstrom <asandstrom3minus1@eastlink.ca>
Date2012-05-03 06:15 -0300
Message-ID<f1sor.18764$DB1.11651@newsfe03.iad>
In reply to#14182
On 12-05-03 06:03 AM, RedGrittyBrick wrote:
> On 03/05/2012 00:13, Lew wrote:
>> Roedy Green wrote:
>>> Daniel wrote, quoted or indirectly quoted someone who said :
>>>
>>>> in english [sic]:
>>>> 123 one hundred twenty three
>>
>> "One hundred twenty-three"  [sic]
>>
> 
> In English†:
> "One hundred *and* twenty three"
> 
One hundred and EIGHTY!!! is preferable. :-)

AHS
-- 
A fly was very close to being called a "land," cause that's what they do
half the time.
-- Mitch Hedberg

[toc] | [prev] | [next] | [standalone]


#14228

FromLew <lewbloch@gmail.com>
Date2012-05-03 14:08 -0700
Message-ID<19395048.254.1336079296882.JavaMail.geo-discussion-forums@pbew9>
In reply to#14182
On Thursday, May 3, 2012 2:03:16 AM UTC-7, RedGrittyBrick wrote:
> On 03/05/2012 00:13, Lew wrote:
> > Roedy Green wrote:
> >> Daniel wrote, quoted or indirectly quoted someone who said :
> >>
> >>> in english [sic]:
> >>> 123 one hundred twenty three
> >
> > "One hundred twenty-three"  [sic]
> >
> 
> In English†:
> "One hundred *and* twenty three"
> 
> -- 
> RGB
> † English English, as it is spoken in England. This bit anyway. Currently.

In American English the "and" is optional, but the hyphen in "twenty-three" is part of the spelling.

From <http://en.wikipedia.org/wiki/English_numerals>:
"Note that in American English, many students are taught not to use the word and anywhere in the whole part of a number, so it is not used before the tens and ones. It is instead used as a verbal delimiter when dealing with compound numbers. Thus, instead of "three hundred and seventy-three", one would say "three hundred seventy-three". For details, see American and British English differences."

So the usage /sic/ /supra/ is legit in my part of the world.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#14250

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2012-05-04 05:49 +0000
Message-ID<jnvqkl$daq$2@speranza.aioe.org>
In reply to#14228
Lew <lewbloch@gmail.com> wrote:

(snip)

> From <http://en.wikipedia.org/wiki/English_numerals>:
> "Note that in American English, many students are taught not to 
> use the word and anywhere in the whole part of a number, 
> so it is not used before the tens and ones. It is instead 
> used as a verbal delimiter when dealing with compound numbers. 

Specifically, for writing the number of dollars on checks.
(Maybe different on cheques.) The cents (xx/100) comes after the and.

> Thus, instead of "three hundred and seventy-three", one would 
> say "three hundred seventy-three". For details, see American and 
> British English differences."

-- glen

[toc] | [prev] | [next] | [standalone]


#14256

FromLew <lewbloch@gmail.com>
Date2012-05-04 06:46 -0700
Message-ID<24007613.517.1336139174406.JavaMail.geo-discussion-forums@pbbpp10>
In reply to#14250
glen herrmannsfeldt wrote:
> Lew wrote:
> 
> (snip)
> 
>> From <http://en.wikipedia.org/wiki/English_numerals>:
>> "Note that in American English, many students are taught not to 
>> use the word and anywhere in the whole part of a number, 
>> so it is not used before the tens and ones. It is instead 
>> used as a verbal delimiter when dealing with compound numbers. 
> 
> Specifically, for writing the number of dollars on checks.
> (Maybe different on cheques.) The cents (xx/100) comes after the and.

That's not "and" inside a number name, but between a number name and a numeral representation. Different case.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#14266

Fromglen herrmannsfeldt <gah@ugcs.caltech.edu>
Date2012-05-04 19:41 +0000
Message-ID<jo1bdj$j0n$2@speranza.aioe.org>
In reply to#14256
Lew <lewbloch@gmail.com> wrote:
(snip, someone wrote)

>>> "Note that in American English, many students are taught not to 
>>> use the word and anywhere in the whole part of a number, 
>>> so it is not used before the tens and ones. It is instead 
>>> used as a verbal delimiter when dealing with compound numbers. 
 
>> Specifically, for writing the number of dollars on checks.
>> (Maybe different on cheques.) The cents (xx/100) comes after 
>> the and.

> That's not "and" inside a number name, but between a number name 
> and a numeral representation. Different case.

Yes, but it only works if you don't put an "and" inside the number.
(That is, "and" is the delimiter for the dollar amount.)

-- glen

[toc] | [prev] | [next] | [standalone]


#14220

FromRoedy Green <see_website@mindprod.com.invalid>
Date2012-05-03 14:14 -0700
Message-ID<2js5q719ppd6r4d8im19pchoo1d35rpthm@4ax.com>
In reply to#14167
On Wed, 2 May 2012 16:13:48 -0700 (PDT), Lew <lewbloch@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>Another approach would be to expand into one language, e.g., English, then =
>use resource bundles to translate those words into other languages. I don't=
> know how effective this would be.

That's what I hoped would be true when I started writing that code.  I
thought I would need a common skeleton just with different constants
for thousand etc.

But it turns out they are crazy irregular.

Have a look at Icelandic.
https://wush.net/websvn/mindprod/filedetails.php?repname=mindprod&path=%2Fcom%2Fmindprod%2Finwords%2FIcelandic.java

or Polish.
https://wush.net/websvn/mindprod/filedetails.php?repname=mindprod&path=%2Fcom%2Fmindprod%2Finwords%2FIcelandic.java

compared with AmericanEnglish
https://wush.net/websvn/mindprod/filedetails.php?repname=mindprod&path=%2Fcom%2Fmindprod%2Finwords%2FAmericanEnglish.java

compared with the regularity of Esperanto
https://wush.net/websvn/mindprod/filedetails.php?repname=mindprod&path=%2Fcom%2Fmindprod%2Finwords%2FEsperanto.java

I have not done it yet, but I suspect Mandarin may be simpler still.

you can play with these only at
http://mindprod.com/inwords/InWords.html
typing in number to see the words in any language.
-- 
Roedy Green Canadian Mind Products
http://mindprod.com
Programmers love to create simplified replacements for HTML. 
They forget that the simplest language is the one you 
already know. They also forget that their simple little 
markup language will bit by bit become even more convoluted 
and complicated than HTML because of the unplanned way it grows.
.

[toc] | [prev] | [next] | [standalone]


#14170

FromDaniel <daniel.chmielewski@gmail.com>
Date2012-05-02 16:20 -0700
Message-ID<12ed676d-b3c2-409d-bce2-0e731adf8aeb@n4g2000vbz.googlegroups.com>
In reply to#14151
On 2 Maj, 23:23, Roedy Green <see_webs...@mindprod.com.invalid> wrote:
> On Wed, 2 May 2012 13:55:00 -0700 (PDT), Daniel
> <daniel.chmielew...@gmail.com> wrote, quoted or indirectly quoted
> someone who said :
>
> >in english:
> >123 one hundred twenty three
>
> >in german:
> >123 eins hudrer deiund zwanzig
>
> seehttp://mindprod.com/applet/inwords.html
>
> includes source.
> there are about 100 languages, though some are not languages in the
> usual sense.
> --
> Roedy Green Canadian Mind Productshttp://mindprod.com
> Programmers love to create simplified replacements for HTML.
> They forget that the simplest language is the one you
> already know. They also forget that their simple little
> markup language will bit by bit become even more convoluted
> and complicated than HTML because of the unplanned way it grows.
> .
>
>

"First look", looks REALLY GREAT !!! I will test it. Thanks for
help ;-)
Regards,
Daniel

[toc] | [prev] | [next] | [standalone]


Page 1 of 2  [1] 2  Next page →

Back to top | Article view | comp.lang.java.programmer


csiph-web