wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Offline Language Translation API? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Offline Language Translation API?" Watch "Offline Language Translation API?" New topic
Author

Offline Language Translation API?

Allasso Travesser
Ranch Hand

Joined: Feb 06, 2010
Posts: 35
Hello,

Is there a Java API which will translate English to Spanish without requiring an internet connection?

(sorta cross-posted on Stack Overflow)

Thanks kindly, Allasso
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Looks like you got rather a negative reaction over there on Stack Overflow.

When I searched the web I found a lot of software which claimed to do language translation offline. I didn't see anything which claimed to have a Java API, but then I only spent less than a minute. Why do you need a Java API?
Allasso Travesser
Ranch Hand

Joined: Feb 06, 2010
Posts: 35
Yikes, I guess SO was not the place to ask.

It doesn't have to be Java per se, but it has to be open source, something I can extend to fit to my own implementation. I would be running it on an Ubuntu server. Java or Perl would be good choices for me because I am more familiar with them. But I am open to any other languages also.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

When I googled "open source spanish translation" I found several reasonable-looking options. Although on closer inspection they seemed to be Spanish-Catalan or Spanish-Portuguese, which are much easier problems than Spanish-English. However you might want to have a look at this page: Free and Open-Source Software and Tools for Translators.
Allasso Travesser
Ranch Hand

Joined: Feb 06, 2010
Posts: 35
All it takes is the right key words. Thanks, found a lot there. Apertium does just what I want and does it quite painlessly in Unix-like fashion:

$ echo 'Esta es Gloria, mi amiga argentina' | apertium es-en
This is Gloria, my Argentinian friend

Can also provide infile outfile arguments.

http://linuxgazette.net/152/oregan.html
http://wiki.apertium.org/wiki/Main_Page

On Ubuntu, install with:

apt-get install apertium

Only thing which wasn't obvious to me is that you will also need to install the language pairs for the languages you wish to translate.

eg, for English <-> Spanish,

apt-get install apertium-en-es

list of language pairs:

http://wiki.apertium.org/wiki/List_of_language_pairs

I haven't checked if there is an Ubuntu package for every one of the pairs listed, but every one I've tried to install using the above example so far has worked.

If you get this error, it means that you don't have the language pair installed:

$ echo 'Esta es Gloria, mi amiga argentina' | apertium es-en
Error: Mode es-en does not exist. Try one of:
<list of installed language pairs, or "*" if none are installed>

See also man-page.

Thank you very much, Paul.
 
GeeCON Prague 2014
 
subject: Offline Language Translation API?