Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > number and words

Reply
Thread Tools

number and words

 
 
Daniel
Guest
Posts: n/a
 
      05-02-2012
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
 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-02-2012
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

 
Reply With Quote
 
 
 
 
Roedy Green
Guest
Posts: n/a
 
      05-02-2012
On Wed, 2 May 2012 13:55:00 -0700 (PDT), Daniel
<(E-Mail Removed)> 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.
..
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      05-02-2012
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'tknow 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 wellfor some words, such as "quatre-vingt" in French, which you might not wanttranslated as "four-twenty" in English.

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

--
Lew
 
Reply With Quote
 
Arne Vajhj
Guest
Posts: n/a
 
      05-02-2012
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

 
Reply With Quote
 
Daniel
Guest
Posts: n/a
 
      05-02-2012
On 2 Maj, 23:23, Roedy Green <(E-Mail Removed)> wrote:
> On Wed, 2 May 2012 13:55:00 -0700 (PDT), Daniel
> <(E-Mail Removed)> 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
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      05-03-2012
On Wed, 02 May 2012 19:19:34 -0400, Arne Vajhj <(E-Mail Removed)>
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
 
Reply With Quote
 
Gene Wirchenko
Guest
Posts: n/a
 
      05-03-2012
On Wed, 02 May 2012 18:41:19 -0500, Leif Roar Moldskred
<(E-Mail Removed)> wrote:

>Lew <(E-Mail Removed)> 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
 
Reply With Quote
 
RedGrittyBrick
Guest
Posts: n/a
 
      05-03-2012
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.
 
Reply With Quote
 
Arved Sandstrom
Guest
Posts: n/a
 
      05-03-2012
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Words and non-words, according to Microsoft et al Steve B NZ Computing 11 03-21-2008 11:52 PM
Replace stop words (remove words from a string) BerlinBrown Python 6 01-17-2008 02:37 PM
Words Words utab C++ 6 02-16-2006 07:00 PM
Non-noise words are incorrectly recognised as noise words. Peter Striman ASP .Net 1 08-23-2005 01:26 PM
Re: A little bit of help regarding my linked list program required. - "words.c" - "words.c" Richard Heathfield C Programming 7 10-05-2003 02:38 PM



Advertisments