我目前正在使用 Microsoft.Speech API 将语音听写为文本,但我真正需要的是程序可以使用的替代听写。我将其用于我的荣誉论文,为此我希望知道任何话语的前 10 种解释。
2011 年,有人提出了一个非常相似(即使不完全一样)的问题:C# system.speech.recognition 替代方案
但从未得到答复。因此,我的问题是:如何使用 Microsoft.Speech API 获得听写解释的替代方案?
这个 MSDN 页面很好地处理你的要求。作为参考,我将发布包含的代码。最后的 for 循环包含
// Handle the SpeechRecognized event.
void SpeechRecognizedHandler(object sender, SpeechRecognizedEventArgs e)
{
//... Code handling the result
// Display the recognition alternates for the result.
foreach (RecognizedPhrase phrase in e.Result.Alternates)
{
Console.WriteLine(" alt({0}) {1}", phrase.Confidence, phrase.Text);
}
}
指某东西的用途e.Result.Alternates
是获取其他可能单词的官方方法。
如果这还没有给你足够的结果,这个 MSDN 页面为您提供所需的信息。你需要使用UpdateRecognizerSetting
在你的SpeechRecognitionEngine
更改置信拒绝级别。设置为 0 将使每个结果都显示在Alternates
以及置信水平,您可以对其进行排序以获得前 10 个。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)