如何使用 MS Azure 语音转文本服务获得每个单词的单词级别置信度?目前,我正在获得句子级别的置信度值,并且我需要单词级别的置信度以进行进一步处理。
2 回答
1
您可以通过将 'format=detailed' & 'wordLevelConfidence=true' 添加到 URI 来检索 wordLevelConfidence
例如,使用美国西部端点设置为美国英语的语言是:https ://westus.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=en-US&format=detailed&wordLevelConfidence=true 。
如果您使用 SDK:
var config = SpeechConfig.FromSubscription(sub, "westeurope");
config.SetServiceProperty("wordLevelConfidence", "true", ServicePropertyChannel.UriQueryParameter);
//config.RequestWordLevelTimestamps(); in case you also want wordleveltimestamps
config.OutputFormat = OutputFormat.Detailed;
单词置信度值不是直接结果的一部分,请查看下面的 JSON 格式的完整结果。识别器.Recognized += (s, e) => { var j = e.Result.Properties.GetProperty(PropertyId.SpeechServiceResponse_JsonResult);
于 2020-02-17T03:32:16.450 回答
1
通过使用此代码: setServiceProperty("wordLevelConfidence","true", ServicePropertyChannel.UriQueryParameter);
我就是这样做的
SpeechConfig config = SpeechConfig.fromSubscription(speechSubscriptionKey, serviceRegion);
config.setServiceProperty("wordLevelConfidence","true", ServicePropertyChannel.UriQueryParameter);
config.setServiceProperty("format", "detailed", ServicePropertyChannel.UriQueryParameter); //you have to do it in this order
这是为了得到结果
PropertyCollection properties = result.getProperties();
String property = properties.getProperty(PropertyId.SpeechServiceResponse_JsonResult);
于 2020-05-02T23:54:58.610 回答