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);
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)