コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <summary>
 /// Dispara os eventos de reconhecimento parcial
 /// </summary>
 internal virtual void SendOnPartialResult(PartialRecognitionResult objResult)
 {
     new Thread(() =>
     {
         OnPartialResult?.Invoke(this, objResult);
     }).Start();
 }
コード例 #3
0
 void objASR_OnPartialResult(object sender, PartialRecognitionResult e)
 {
     OnPartialResult?.Invoke(this, e);
 }
コード例 #4
0
 private void SpeechRecognizer_OnPartialRecognitionResult(PartialRecognitionResult Result)
 {
     Events.OnPartialRecognitionResult = true;
 }
コード例 #5
0
 private void ObjASR_OnPartialResult(object sender, PartialRecognitionResult e)
 {
     OnPartialRecognitionResult?.Invoke(e);
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: tomferreira/asr-sdk-dotnet
 private static void Obj_OnPartialRecognitionResult(PartialRecognitionResult Result)
 {
     Console.WriteLine("Resultado parcial: " + Result.Text);
 }