Google React native 中的语音转文本
Google speech to text in React native
我想显示 google 语音转文本以在我的 React Native 项目中搜索项目。但是我无法找到与此相关的任何适当文档。我已经使用了 react-native-voice
,但我没有得到像 google 这样的结果。谁能帮我解决这个问题?
您可以使用 react-native-speech-to-text-android
来获得您想要的结果。
import SpeechToText from 'react-native-google-speech-to-text';
const speechToTextHandler = async () => {
let speechToTextData = null;
try {
speechToTextData = await SpeechToText.startSpeech('Try saying something', 'en_IN');
console.log('speechToTextData: ', speechToTextData);
} catch (error) {
console.log('error: ', error);
}
}
我想显示 google 语音转文本以在我的 React Native 项目中搜索项目。但是我无法找到与此相关的任何适当文档。我已经使用了 react-native-voice
,但我没有得到像 google 这样的结果。谁能帮我解决这个问题?
您可以使用 react-native-speech-to-text-android
来获得您想要的结果。
import SpeechToText from 'react-native-google-speech-to-text';
const speechToTextHandler = async () => {
let speechToTextData = null;
try {
speechToTextData = await SpeechToText.startSpeech('Try saying something', 'en_IN');
console.log('speechToTextData: ', speechToTextData);
} catch (error) {
console.log('error: ', error);
}
}