我目前正在使用Microsoft.Speech应用程序接口将话语口述成文本,但我真正需要的是程序可以使用的替代口述。我在我的荣誉论文中使用了这一点,因此我希望知道对任何话语的前十种解释。
一个非常类似的问题,如果不是确切的问题,也是在2011年提出的:C# system.speech.recognition alternates
但一直没人接。因此,我的问题是:如何使用Microsoft.Speech应用程序接口获得口述解释的替代方案?
发布于 2013-06-22 05:10:09
This MSDN page很好地处理了您的请求。作为参考,我将发布包含的代码。最后一个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
是获取其他可能单词的官方方式。
如果这不能为您提供足够的结果,this MSDN page会提供所需的信息。您需要在SpeechRecognitionEngine
上使用UpdateRecognizerSetting
来更改置信度拒绝级别。将其设置为0将使每个单独的结果与置信度一起显示在Alternates
中,您可以对置信度进行排序以获得前10名。
https://stackoverflow.com/questions/17247473
复制