AWS Amplify - Android - 将未知语言的文本翻译成英语

AWS Amplify - Android - Translate text in an unknown language to English

在我的 Android 应用程序中,我正在使用 OCR。我想将图片中的文字翻译成英文。文本的语言未知。我正在使用 AWS 服务和 Amplify,所以我想使用 Predictions 模块来翻译文字.

Amazon Translate FAQ中写道,Amazon Translate 具有自动源语言检测功能:

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.

不幸的是,在 Amplify backendconfiguration 期间,需要注明源语言:

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

稍后可以覆盖源语言,但必须给出。我听说过 Lingua 等语言检测工具,但它们需要大量内存或使用不同的服务。

能否借助 Amplify 在 [=40] 中使用 AWS Translate 的自动源语言检测功能=]申请?

在这里放大开发。

A​​mplify Android 目前(自 v1.4.2 起)不支持直接使用 Amazon Translate 的源语言检测功能。但是,这是我们积压工作中的一项功能,将来会得到支持。

为了达到你目前的 use-case,你有两个稍微 less-convenient 的选择:

  1. 使用 escape-hatch to access the low-level AmazonTranslateClient service client. See the following doc 作为其使用指南。
  2. 对源文本调用 Amplify.Predictions.interpret(...) 方法以识别其语言。