I have got a project in react native, the main idea is – speech to text from user. I have one problem: If the user makes a short pause, then the translation of speech into text is allowed. How can i pass this? Code below
useEffect(() => {
Voice.onSpeechError = onSpeechError;
Voice.onSpeechResults = onSpeechResults;
return () => {-
Voice.destroy().then(Voice.removeAllListeners);
}
}, []);
const startSpeechToText = async () => {
await Voice.start("en-US");
};
const stopSpeechToText = async () => {
await Voice.stop();
setStarted(false);
};
2
Answers
Probably you can listen to events like
onSpeechEnd
oronSpeechPartialResults
and if it happens start recognition again. But in this case, you need the stop button or any way to stop recognition.Also you can check this issue it is related to your question https://github.com/react-native-voice/voice/issues/107
Below code snippet may help you in that