我使用此代碼通過 Azure 認(rèn)知服務(wù)轉(zhuǎn)錄 wav 文件。整個(gè)內(nèi)容轉(zhuǎn)錄完畢后,我可以獲得置信度分?jǐn)?shù)嗎? private static async Task<string> TranscribeWav(SpeechConfig config, string fileName) { var taskCompleteionSource = new TaskCompletionSource<int>(); var transcriptionStringBuilder = new StringBuilder(); using (var audioInput = AudioConfig.FromWavFileInput(fileName)) { using (var recognizer = new SpeechRecognizer(config, audioInput)) { // Subscribes to events. recognizer.Recognizing += (sender, eventargs) => { //TODO: Handle recognized intermediate result //Console.WriteLine(eventargs.Result.Text); }; recognizer.Recognized += (sender, eventargs) => { if (eventargs.Result.Reason == ResultReason.RecognizedSpeech) { transcriptionStringBuilder.Append(eventargs.Result.Text); } else if (eventargs.Result.Reason == ResultReason.NoMatch) { //TODO: Handle not recognized value } }; recognizer.Canceled += (sender, eventargs) => { if (eventargs.Reason == CancellationReason.Error) { //TODO: Handle error } if (eventargs.Reason == CancellationReason.EndOfStream) { Console.WriteLine($"End of stream ({transcriptionStringBuilder.ToString()})..."); } taskCompleteionSource.TrySetResult(0); };我的目的是將 wav 文件提交給認(rèn)知服務(wù)進(jìn)行轉(zhuǎn)錄。我是天藍(lán)色的新手,想按順序執(zhí)行此操作,因此也請(qǐng)隨時(shí)告訴我我的代碼效率低下或錯(cuò)誤。
我可以從 Azure 認(rèn)知服務(wù)檢索轉(zhuǎn)錄的置信度嗎?
繁星點(diǎn)點(diǎn)滴滴
2023-06-25 14:25:42