英文:
Google Speech to Text Locale creation for language other than English
问题
我想在我的安卓应用中集成乌尔都语言,使用谷歌的语音转文本功能。根据谷歌的支持,乌尔都语言是可以用于语音转文本的。您能指导我如何创建这个功能吗?
class AimyboxApplication : Application(), AimyboxProvider {
companion object {
private const val AIMYBOX_API_KEY = "Ldf0j7WZi3KwNah2aNeXVIACz0lb9qMH"
}
override val aimybox by lazy { createAimybox(this) }
private fun createAimybox(context: Context): Aimybox {
val unitId = UUID.randomUUID().toString()
val textToSpeech = GooglePlatformTextToSpeech(context, Locale.UKRAINIAN)
val speechToText = GooglePlatformSpeechToText(context, Locale.UKRAINIAN)
val dialogApi = AimyboxDialogApi(AIMYBOX_API_KEY, unitId)
return Aimybox(Config.create(speechToText, textToSpeech, dialogApi))
}
}
如您在谷歌网站中所示,乌尔都巴基斯坦已被支持,因此您可以将语音转文本的Locale设置为乌尔都语言:
<details>
<summary>英文:</summary>
I want to integrate Urdu Language in my android application using Google Speech to Text. Urdu language is supported according to google for speech to text. Can you guide me as to how I can create this:
class AimyboxApplication : Application(), AimyboxProvider {
companion object {
private const val AIMYBOX_API_KEY = "Ldf0j7WZi3KwNah2aNeXVIACz0lb9qMH"
}
override val aimybox by lazy { createAimybox(this) }
private fun createAimybox(context: Context): Aimybox {
val unitId = UUID.randomUUID().toString()
val textToSpeech = GooglePlatformTextToSpeech(context, Locale.ENGLISH)
val speechToText = GooglePlatformSpeechToText(context, Locale.ENGLISH)
val dialogApi = AimyboxDialogApi(AIMYBOX_API_KEY, unitId)
return Aimybox(Config.create(speechToText, textToSpeech, dialogApi))
}
}
It has Locale.English I want it for Urdu as shown on google here:
[![][1]][1]
[1]: https://i.stack.imgur.com/U4OGy.png
As you can see Urdu Pakistan is present on googles website.
</details>
# 答案1
**得分**: 0
你正在使用 Android SpeechKit 库(GooglePlatform),而不是 Google Cloud SpeechKit。我认为第一个仅支持英语,但你可以使用第二个,并且可以从 Google Cloud 控制台配置 API 的默认语言(为此,你需要一个活跃的计费账户),然后将其集成到 Aimubox。
参考文档及代码:https://github.com/just-ai/aimybox-android-sdk/tree/master/google-cloud-speechkit
<details>
<summary>英文:</summary>
You are using the android speechkit library (GooglePlatform), not the Google Cloud speechkit. I think the first one supports only English, but you can use the second one, and configure your API default language from Google Cloud Console (for that, you will need an active billing account), and then integrate it with aimubox.
Reference to documentation with code: https://github.com/just-ai/aimybox-android-sdk/tree/master/google-cloud-speechkit
</details>
专注分享java语言的经验与见解,让所有开发者获益!
评论