1

In my Android application I am using OCR. I would like to translate the text from the image to English. The language of the text is unknown. I am using AWS services together with Amplify, so I would like to use Predictions module to translate the text.

In Amazon Translate FAQ it is written that Amazon Translate has the automatic source language detection:

If the source language is unknown, Amazon Translate will identify the source language using Amazon Comprehend behind the scenes, and report that language back along with the translation to the target language.

Unfortunately,during configuration of Amplify backend it is necessary to indicate the source language:

? What is the source language? (Use arrow keys) US English?

Later it is possible to override the source language, but it has to be given. I've heard about tools for language detection like Lingua, however they require lots of memory or usage of different services.

Is it possible to use the feature of automatic source language detection of AWS Translate with the aid of Amplify in an Android application?

MiHu
  • 157
  • 1
  • 10
  • Yes do it as two steps, one to obtain the language (and don't hardcode aws translate), then pass the language to the next step – Blundell Oct 24 '20 at 19:51
  • What do you mean by "one to obtain the language"? Is it possible to obtain the language from Amplify Predictions? – MiHu Oct 24 '20 at 20:40
  • Your post says you can get the Lang from was comprehend, so do that and then pass it on. Perhaps add some code for what you are trying to your question if you want more detailed help – Blundell Oct 24 '20 at 21:20

1 Answers1

3

Amplify dev here.

Amplify Android currently (as of v1.4.2) does not support directly using Amazon Translate's source language detection feature. However, it is a feature in our backlog to be supported in the future.

To achieve your use-case at the moment, you have two slightly less-convenient options:

  1. Use the escape-hatch to access the low-level AmazonTranslateClient service client. See the following doc for its usage guidance.
  2. Call Amplify.Predictions.interpret(...) method on source text to identify its language.
  • 1
    I didn't know that with Amplify.Predictions.interpret(...) you can get the language, thanks! Actually, that is more or less the same as using Amazon Translate 'auto' language detection, because under the hood both are using Amazon Comprehend. – MiHu Oct 30 '20 at 13:47