private void OnRecognize(SpeechResultList result) { // m_ResultOutput.SendData( new SpeechToTextData( result ) ); string speechToText = new SpeechToTextData(result).AllText; if (!string.IsNullOrEmpty(speechToText)) { Cloudspace.NotificationCenter.DefaultCenter().PostNotification(this, "OnTextFromSpeech", speechToText); } Log.Debug("recognise", "result: {0}", new SpeechToTextData(result).Text); if (result != null && result.Results.Length > 0) { if (m_Transcript != null) { m_Transcript.text = ""; } foreach (var res in result.Results) { foreach (var alt in res.Alternatives) { string text = alt.Transcript; if (m_Transcript != null) { m_Transcript.text += string.Format("{0} ({1}, {2:0.00})\n", text, res.Final ? "Final" : "Interim", alt.Confidence); } } } } }
private void OnSpeechInput(Data data) { SpeechToTextData speech = data as SpeechToTextData; if (speech != null && speech.Results.HasFinalResult()) { Translate(speech.Results.results[0].alternatives[0].transcript); } }