コード例 #1
0
        public static void GetWordDetails(List <Speech> textResult)
        {
            Console.WriteLine($"\r\n\tDetailed Information:");
            Console.WriteLine($"\t{ new string('=', 80)}");

            foreach (var result in textResult)
            {
                // Sort by confidence
                var text = result.NBest?.OrderByDescending(x => x.Confidence).FirstOrDefault();

                if (text?.Words != null)
                {
                    foreach (var word in text.Words)
                    {
                        var timestamp = SpeechToText.TicksToTime(word.Offset);
                        var duration  = SpeechToText.TicksToTime(word.Duration);
                        PrintWordDetails(timestamp, duration, word.Word);
                    }
                }
            }
        }