Anshul Malhan
Anshul Malhan

Reputation: 3

Export 'Final' output of ExampleStreaming from Watson Unity SDK

I am trying to export the 'Final' result of Speech to text from Watson Unity SDK's ExampleStreaming script.

I'm trying to append it with a CSV output of another SDK(Affectiva). What is the best way to ensure I capture just the final output + timestamp of the ResultsField and not the Interim responses?

Upvotes: 0

Views: 48

Answers (1)

taj
taj

Reputation: 1138

SpeechRecognitionResult has a final property. You can look for this bool value and only save final results. From ExampleStreaming.cs.

private void OnRecognize(SpeechRecognitionEvent result, Dictionary<string, object> customData)
{
    if (result != null && result.results.Length > 0)
    {
        foreach (var res in result.results)
        {
            foreach (var alt in res.alternatives)
            {
                if (res.final)
                {
                    //  do something
                }
            }
        }
    }
}

Upvotes: 0

Related Questions