/// <summary> /// Converte o array fornecido em um objeto do Tipo PartialRecognitionResult, que é um dos tipos possíveis de reposta do servidor descrita pelo Protocolo /// </summary> /// <param name="arrValue"></param> /// <returns></returns> private PartialRecognitionResult PreparePartialRecognitionResult(string[] arrValues) { PartialRecognitionResult objPartialRecognitionResult = new PartialRecognitionResult(); RecognitionResultCode? ResultCode = null; string Handle = ""; foreach (string value in arrValues) { if (value.IndexOf("Result-Status: ") != -1 && (value.IndexOf("PROCESSING") == -1)) { //especificamente no retorno de resultado de reconhecimento, o status do servidor vem na tag RESULT e não na tag STATUS ResultCode = value.Replace("Result-Status: ", "").ToEnum <RecognitionResultCode>(); } if (value.IndexOf("Handle: ") != -1) { //especificamente no retorno de resultado de reconhecimento, o status do servidor vem na tag RESULT e não na tag STATUS Handle = value.Replace("Handle: ", "").ToString(); } if (value.IndexOf("[{") != -1) { //json contendo as sentencas identificadas objPartialRecognitionResult = JsonConvert.DeserializeObject <PartialRecognitionResult>(value); } } ; if (objPartialRecognitionResult != null) { objPartialRecognitionResult.Handle = Handle; objPartialRecognitionResult.ResultCode = ResultCode; } return(objPartialRecognitionResult); }
/// <summary> /// Dispara os eventos de reconhecimento parcial /// </summary> internal virtual void SendOnPartialResult(PartialRecognitionResult objResult) { new Thread(() => { OnPartialResult?.Invoke(this, objResult); }).Start(); }
void objASR_OnPartialResult(object sender, PartialRecognitionResult e) { OnPartialResult?.Invoke(this, e); }
private void SpeechRecognizer_OnPartialRecognitionResult(PartialRecognitionResult Result) { Events.OnPartialRecognitionResult = true; }
private void ObjASR_OnPartialResult(object sender, PartialRecognitionResult e) { OnPartialRecognitionResult?.Invoke(e); }
private static void Obj_OnPartialRecognitionResult(PartialRecognitionResult Result) { Console.WriteLine("Resultado parcial: " + Result.Text); }