Offline language translation API

Anurag Bhandari picture Anurag Bhandari · Jan 2, 2017 · Viewed 17.6k times · Source

Please note that I am aware that this question has appeared in various forms at several places, including stackoverflow, but I have yet to see a satisfying answer.

There are several pretty solid language translation APIs out there (eg., Microsoft and Google). They are HTTP RESTful APIs that work well for web or mobile applications, apps that operate in online mode.

However, I am looking for a language translation API that can translate short (or long) sentences in offline mode, when no Internet connectivity is available.

Another version of my question: Google Translate app comes with an option to download certain language models to allow it to operate in offline mode. Is there an Android Java library (official or unofficial; free or paid) that allows leveraging Google Translate's downloadable models for offline translations?

Answer

Adam picture Adam · Jan 27, 2017

There are no web APIs that could operate in offline mode alone, without a client library component providing some offline functionality, since the nature of a web API is that that you are making requests to an external host.

That leaves client libraries. Both Google Translate offline and Microsoft Translator offline exist, but these are implemented as applications and not exposed as a developer accessible client library. Mature translation libraries exist in the form of Apache Joshua and Stanford Phrasal, however these are based on statistical rather than neural models.

If you're looking for the one perfect Java library for offline, neural based translation that has already been developed and ready to use you'd be out of luck. For now you'd need to roll your own, for example as you've mentioned using TensorFlow and the sample models. The trained models used by translation service providers are somewhat of a "secret sauce", so it is unlikely these would be made available to developers for free any time soon for use in offline translation, but its completely possible that quality open source or otherwise free translation models will be developed and released by the ML community or third parties.