protected internal virtual void OnChunkRecieved(ChunkRecievedEventArgs e)
 {
     if (ChunkRecieved != null)
     {
         ChunkRecieved(this, e);
     }
 }
        private static void SpeechToTextResponseReader_ChunksRecived(object sender, ChunkRecievedEventArgs e)
        {
            notFinalBuf = e.AsJson();
            Log.Information(notFinalBuf); // Log partial results

            if (e.SpeechToTextChunk.Final)
            {
                outFile.Write(Encoding.UTF8.GetBytes(notFinalBuf)); //Write final results into file
                notFinalBuf = null;
            }
        }
        private static void SpeechToTextResponseReader_ChunksRecived(object sender, ChunkRecievedEventArgs e)
        {
            String eventPayload = e.AsJson();

            Log.Information(eventPayload);                         // Log partial results

            File.AppendAllText(TraceResultsOutFile, eventPayload); //Write final results into file

            if (e.EventCase == StreamingResponse.EventOneofCase.Final)
            {
                File.AppendAllText(FinalTextResultsOutFile, Helpers.extractText(eventPayload, "Final.Alternatives[*].Text"));//Write final results into file
            }
            else if (e.EventCase == StreamingResponse.EventOneofCase.Partial)
            {
                string PartialTextResultsTxtFile = args.inputFilePath + ".partial.txt";
                File.AppendAllText(PartialTextResultsTxtFile, Helpers.extractText(eventPayload, "Partial.Alternatives[*].Text"));//Write partial results into file

                Log.Information($"Results output file: {PartialTextResultsTxtFile}");
            }
        }
Example #4
0
 private void OnChunkRecieved(object sender, ChunkRecievedEventArgs chunkRecievedEventArgs)
 {
 }