如何使用 flutter(dart) 将韩语转换为文本?

How to convert Korean to text using flutter(dart)?

我目前正在开发一个使用 flutter 将韩语转换为文本的应用程序。 我一直在尝试使用 speech_to_text 包,但我想知道我是否只能使用英语。

或者您还有其他建议吗?

查看 speech_to_text's Switching Recognition Language 文档:

The speech_to_text plugin uses the default locale for the device for speech recognition by default. However it also supports using any language installed on the device. To find the available languages and select a particular language use these properties.

There's a locales property on the SpeechToText instance that provides the list of locales installed on the device as LocaleName instances. Then the listen method takes an optional localeId named param which would be the localeId property of any of the values returned in locales. A call looks like this:

    var locales = await speech.locales();

    // Some UI or other code to select a locale from the list
    // resulting in an index, selectedLocale

    var selectedLocale = locales[selectedLocale];
    speech.listen(
        onResult: resultListener,
        localeId: selectedLocale.localeId,
        ); ```

如果用户的设备上安装了韩语区域设置,您应该能够在 locales 中找到它。为什么不在 var selectedLocale ... 或 运行 print(locales).

上放置一个断点