csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
387 stars 235 forks source link

reset the buffer of Recognized Words #546

Closed benlyazid closed 1 month ago

benlyazid commented 2 months ago

Hi, I am working on an app like a voice chat but the problem is that I can't reset the recognized words buffer after each voice message because each time I want to get recognized words it returns all the words from the beginning, Is there any solution to that?

I have tried to add the resetBuffer() function in the SpeechRecognitionResult class that clears the alternates list, but it doesn't work.

sowens-csd commented 2 months ago

Sounds like you might be getting intermediate results? You can control that by setting the SpeechListenOptions.partialResults' to false when you calllisten. That way the results callback will only be triggered with the final results. Alternately you can use thefinalResultproperty of theSpeechRecognitionResult` to see if the results are final.