Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

No results with is_final true for single utterance set to true

I am using below configuration to identify my voice input stream (Hindi language)  :

 
config.set_language_code("hi-IN");
config.set_sample_rate_hertz(8000);
config.set_encoding(RecognitionConfig::LINEAR16);
config.set_model("command_and_search");
streaming_config.set_single_utterance(true);
streaming_config.set_interim_results(true);
 
After setting single utterance to true I am not getting any results with is_final as "True" in the sample application : https://github.com/GoogleCloudPlatform/cpp-samples/blob/main/speech/api/streaming_transcribe.cc 
 
for (auto response = read(); response.has_value(); response = read()) {
// Dump the transcript of all the results.
std::cout<<"Printing speech - event type = "<<response->speech_event_type()<<std::endl;
 
for (auto const& result : response->results()) {
std::cout<<"Is final = "<<result.is_final()<<std::endl;
for (auto const& alternative : result.alternatives()) {
if(!result.is_final())
{
std::cout<<"Interim results ==-========="<<"\t";
std::cout //<< alternative.confidence() << "\t"
<< alternative.transcript() << "\n";
}
else
{
std::cout<<"is_final has returned true"<<"\t";
std::cout //<< alternative.confidence() << "\t"
<< alternative.transcript() << "\n";
}
std::cout<<"Printing speech - event type = "<<response->speech_event_type()<<std::endl;
}
}
}
 
For Hindi inputs like single words :  इस,  21(इक्कीस)
I never get a response with is_final set to true even after getting  response->speech_event_type() as '1' (END_OF_SINGLE_UTTERANCE)
 
 
0 3 850
3 REPLIES 3