저는 Microsoft 음성 인식기 (Microsoft 음성 플랫폼 SDK 버전 11 사용)로 작업 한 경험이 없으며 각각의 신뢰도와 함께 간단한 문법에서 n 개의 최상의 인식 결과를 출력하려고합니다. .Microsoft 음성 인식 : 신뢰도가있는 대체 결과?
문서에 따르면 (in the answer to this question과 같이) e.Result.Alternates
을 사용하면 최상위 점수 이외의 단어를 인식 할 수 있습니다. 그러나 신뢰 거부 임계 값을 0으로 재설정 한 후에도 (아무 것도 거부되지 않아야 함을 의미 함) 여전히 결과가 하나만 표시되며 대체 단어는 표시되지 않습니다 (SpeechHypothesized
이벤트는 다른 단어 중 적어도 하나가 어떤 시점에서 0이 아닌 신뢰도).
내 질문 : 신뢰 거부 임계 값을 0으로 설정 한 경우에도 왜 내가 인식 된 단어 하나만 얻었는지 설명 할 수 있습니까? 다른 가능한 경기와 자신감 점수를 얻으려면 어떻게해야합니까? 내가 여기서 무엇을 놓치고 있니?
아래 코드는 제 코드입니다. 아래의 예제에서 :
을 도울 수있는 사람에게 미리 감사는 인식기는 "뉴스"라는 단어의 wav 파일을 전송하고, 유사한 단어 ("올가미", "도롱뇽 선택해야한다 "). 그 결과 최상의 단어 ("뉴스") 만 반환하더라도 각 단어에 대한 인식기의 신뢰도 점수 목록을 추출하고 싶습니다 (모두 0이 아니어야합니다).
Original recognizer settings:
CFGConfidenceRejectionThreshold = 20
HighConfidenceThreshold = 80
NormalConfidenceThreshold = 50
LowConfidenceThreshold = 20
Updated recognizer settings:
CFGConfidenceRejectionThreshold = 0
HighConfidenceThreshold = 0
NormalConfidenceThreshold = 0
LowConfidenceThreshold = 0
Speech from grammar g hypothesized: noose, 0.2214646
Speech from grammar g hypothesized: news, 0.640804
Number of Alternates from Grammar g: 1
news, 0.9208503
Speech recognized: news, 0.9208503
Number of Alternates from Recognizer: 1
news, 0.9208503
I는 (대신 세 가지 선택 중 하나 구문)에도 각각 별도의 문법 각 단어에 대한 별도의 구문과이를 구현하는 시도 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Speech.Recognition;
namespace SimpleRecognizer
{
class Program
{
static readonly string[] settings = new string[] {
"CFGConfidenceRejectionThreshold",
"HighConfidenceThreshold",
"NormalConfidenceThreshold",
"LowConfidenceThreshold"};
static void Main(string[] args)
{
// Create a new SpeechRecognitionEngine instance.
SpeechRecognitionEngine sre = new SpeechRecognitionEngine(); //en-US SRE
// Configure the input to the recognizer.
sre.SetInputToWaveFile(@"C:\Users\Anjana\Documents\news.wav");
// Display Recognizer Settings (Confidence Thresholds)
ListSettings(sre);
// Set Confidence Threshold to Zero (nothing should be rejected)
sre.UpdateRecognizerSetting("CFGConfidenceRejectionThreshold", 0);
sre.UpdateRecognizerSetting("HighConfidenceThreshold", 0);
sre.UpdateRecognizerSetting("NormalConfidenceThreshold", 0);
sre.UpdateRecognizerSetting("LowConfidenceThreshold", 0);
// Display New Recognizer Settings
ListSettings(sre);
// Build a simple Grammar with three choices
Choices topics = new Choices();
topics.Add(new string[] { "news", "newts", "noose" });
GrammarBuilder gb = new GrammarBuilder();
gb.Append(topics);
Grammar g = new Grammar(gb);
g.Name = "g";
// Load the Grammar
sre.LoadGrammar(g);
// Register handlers for Grammar's SpeechRecognized Events
g.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(gram_SpeechRecognized);
// Register a handler for the recognizer's SpeechRecognized event.
sre.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sre_SpeechRecognized);
// Register Handler for SpeechHypothesized
sre.SpeechHypothesized += new EventHandler<SpeechHypothesizedEventArgs>(sre_SpeechHypothesized);
// Start recognition.
sre.Recognize();
Console.ReadKey(); //wait to close
}
static void gram_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("\nNumber of Alternates from Grammar {1}: {0}", e.Result.Alternates.Count.ToString(), e.Result.Grammar.Name);
foreach (RecognizedPhrase phrase in e.Result.Alternates)
{
Console.WriteLine(phrase.Text + ", " + phrase.Confidence);
}
}
static void sre_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
{
Console.WriteLine("\nSpeech recognized: " + e.Result.Text + ", " + e.Result.Confidence);
Console.WriteLine("Number of Alternates from Recognizer: {0}", e.Result.Alternates.Count.ToString());
foreach (RecognizedPhrase phrase in e.Result.Alternates)
{
Console.WriteLine(phrase.Text + ", " + phrase.Confidence);
}
}
static void sre_SpeechHypothesized(object sender, SpeechHypothesizedEventArgs e)
{
Console.WriteLine("Speech from grammar {0} hypothesized: {1}, {2}", e.Result.Grammar.Name, e.Result.Text, e.Result.Confidence);
}
private static void ListSettings(SpeechRecognitionEngine recognizer)
{
foreach (string setting in settings)
{
try
{
object value = recognizer.QueryRecognizerSetting(setting);
Console.WriteLine(" {0,-30} = {1}", setting, value);
}
catch
{
Console.WriteLine(" {0,-30} is not supported by this recognizer.",
setting);
}
}
Console.WriteLine();
}
}
}
이
다음과 같은 출력을 제공한다 단어/문구. 결과는 기본적으로 동일합니다. 단 하나의 "대체"입니다.
[recognizer.MaxAlternates]의 값은 무엇입니까 (http://msdn.microsoft.com/en-us/ library/microsoft.speech.recognition.speechrecognitionengine.maxalternates (v = office.14) .aspx)? –
MaxAlternates는 10 (기본적으로 추측합니다) 인 것 같습니다. – pilikia
"각 단어 (모두 0이 아니어야 함)에 대한 인식기의 신뢰도 점수 목록을 추출하고 싶습니다."- 반드시 그런 것은 아닙니다. 엔진은 SAPI 엔진 측 계약에 대한 내 이해를 바탕으로 최종 승인에서 "실행 불가능한"대체품을 제거 할 수 있습니다. –