将本机语音反应为文本 [英] React Native Speech to Text

查看:76
本文介绍了将本机语音反应为文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个语言应用程序,可以记录用户尝试学习的任何新词汇.如果用户可以通过语音将他们的单词添加到文本程序中,而不必手动输入,那就太好了.我无法完成此任务.我知道苹果有一个 API,但没有 android.有没有可能这样做,使用 API?例如,谷歌语音到文本 API?但我想我首先必须能够访问设备的麦克风.我是初学者,使用网络这将非常容易.React Native 对这项任务来说还太年轻吗?

I am making a language app that records any new vocabulary a user is trying to learn. It would be great if users can add their words via a speech to text program, instead of having to enter it manually. I am having trouble achieving this task. I am aware that there is an API for apple but not android. Is there anyway possible of doing this, using an API? Like for instance, google speech to text API? But I guess I would first have to be able to access the device's microphone. I am a beginner and this would be very easy using the web. Is React Native still too young for this task?

推荐答案

你可能想看看 react-native-android-voice,一个支持 Android 语音到文本的 React Native 模块.

You might wanna look at react-native-android-voice, a React Native module that supports speech-to-text for Android.

正如@delkant 提到的,现在还有 react-native-voice 支持 Android 和 iOS.

As @delkant mentioned, there's now also react-native-voice that supports both Android and iOS.

或者,您始终可以使用 Android 的 SpeechRecognizer API.这里是您可能需要的所有类和接口的摘要对于这个任务.如果您熟悉开发原生 Android 应用程序,那么创建原生模块并将其绑定到您的 React Native 项目非常容易.这是关于如何实现这一点的官方文档.

Alternatively, you can always write your custom native module using Android's SpeechRecognizer API. Here's a summary of all the classes and interfaces you might need for this task. If you are familiar with developing native Android apps, it's pretty easy to create a native module and bind it to your React Native project. Here's the official documentation of how to achieve this.

这篇关于将本机语音反应为文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆