4

저는 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(); 
     } 
    } 
} 

다음과 같은 출력을 제공한다 단어/문구. 결과는 기본적으로 동일합니다. 단 하나의 "대체"입니다.

+0

[recognizer.MaxAlternates]의 값은 무엇입니까 (http://msdn.microsoft.com/en-us/ library/microsoft.speech.recognition.speechrecognitionengine.maxalternates (v = office.14) .aspx)? –

+0

MaxAlternates는 10 (기본적으로 추측합니다) 인 것 같습니다. – pilikia

+0

"각 단어 (모두 0이 아니어야 함)에 대한 인식기의 신뢰도 점수 목록을 추출하고 싶습니다."- 반드시 그런 것은 아닙니다. 엔진은 SAPI 엔진 측 계약에 대한 내 이해를 바탕으로 최종 승인에서 "실행 불가능한"대체품을 제거 할 수 있습니다. –

답변

1

나는 이것이 SAP 엔진이 SR 엔진이 실제로 지원하지 않는 것을 요구할 수있는 또 다른 장소라고 생각한다.

Microsoft.Speech.Recognition 및 System.Speech.Recognition은 기본 SAPI 인터페이스를 사용하여 작업을 수행합니다. 유일한 차이점은 SR 엔진이 사용되는 것입니다. (Microsoft.Speech.Recognition은 서버 엔진을 사용하고 System.Speech.Recognition은 데스크톱 엔진을 사용합니다.)

대체 메시지는 문맥에 구애받지 않는 문법이 아니라 받아쓰기 용으로 주로 설계되었습니다. 언제든지 을 CFG로 대체 할 수 있지만 대체 세대 코드는 CFG의 대체 문자를 확장하지 않는 것처럼 보입니다.

불행히도 Microsoft.Speech.Recognition 엔진은 받아쓰기를 지원하지 않습니다. 그러나 훨씬 낮은 품질의 오디오로 작동하므로 교육이 필요하지 않습니다.

+0

설명해 주셔서 감사합니다. 전화 기반 대화 시스템을 시뮬레이션 중이므로 Microsoft.Speech를 사용해야합니다. 대체 제품은 데스크톱 엔진/받아쓰기 용입니다. – pilikia