RecognizerUpdateReachedEventArgs 클래스

정의

RecognizerUpdateReached 또는 RecognizerUpdateReached 이벤트의 데이터를 반환합니다.

public ref class RecognizerUpdateReachedEventArgs : EventArgs
public class RecognizerUpdateReachedEventArgs : EventArgs
type RecognizerUpdateReachedEventArgs = class
    inherit EventArgs
Public Class RecognizerUpdateReachedEventArgs
Inherits EventArgs
상속
RecognizerUpdateReachedEventArgs

예제

다음 예제에서는 콘솔 애플리케이션을 로드 하 고 언로드합니다 Grammar 개체입니다. 애플리케이션을 사용 합니다 RequestRecognizerUpdate 음성 인식 엔진 업데이트를 받을 수 있도록 일시 중지를 요청 하는 방법입니다. 애플리케이션을 로드 하거나 언로드합니다를 Grammar 개체입니다.

각 업데이트에 대 한 처리기에서 SpeechRecognitionEngine.RecognizerUpdateReached 이름 및 현재 로드 된 상태의 이벤트 기록 Grammar 콘솔에는 개체입니다. 문법, 로드 및 언로드될 때 팜 동물의 이름은 팜에 동물 이름과 과일을 차례로 과일의 이름만 먼저 애플리케이션에 인식 합니다.

using System;  
using System.Speech.Recognition;  
using System.Collections.Generic;  
using System.Threading;  

namespace SampleRecognition  
{  
  class Program  
  {  
    private static SpeechRecognitionEngine recognizer;  
    public static void Main(string[] args)  
    {  

      // Initialize an in-process speech recognition engine and configure its input.  
      using (recognizer = new SpeechRecognitionEngine(new System.Globalization.CultureInfo("en-US")))  
      {  
        recognizer.SetInputToDefaultAudioDevice();  

        // Create the first grammar - Farm.  
        Choices animals = new Choices(new string[] { "cow", "pig", "goat" });  
        GrammarBuilder farm = new GrammarBuilder(animals);  
        Grammar farmAnimals = new Grammar(farm);  
        farmAnimals.Name = "Farm";  

        // Create the second grammar - Fruit.  
        Choices fruit = new Choices(new string[] { "apples", "peaches", "oranges" });  
        GrammarBuilder favorite = new GrammarBuilder(fruit);  
        Grammar favoriteFruit = new Grammar(favorite);  
        favoriteFruit.Name = "Fruit";  

        // Attach event handlers.  
        recognizer.SpeechRecognized +=  
          new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);  
        recognizer.RecognizerUpdateReached +=  
          new EventHandler<RecognizerUpdateReachedEventArgs>(recognizer_RecognizerUpdateReached);  
        recognizer.SpeechRecognitionRejected +=  
          new EventHandler<SpeechRecognitionRejectedEventArgs>(recognizer_SpeechRecognitionRejected);  

        // Load the Farm grammar.  
        recognizer.LoadGrammar(farmAnimals);  

        // Start asynchronous, continuous recognition.  
        recognizer.RecognizeAsync(RecognizeMode.Multiple);  
        Console.WriteLine("Starting asynchronous, continuous recognition");  
        Console.WriteLine("  Farm grammar is loaded and enabled.");  

        // Pause to recognize farm animals.  
        Thread.Sleep(7000);  
        Console.WriteLine();  

        // Request an update and load the Fruit grammar.  
        recognizer.RequestRecognizerUpdate();  
        recognizer.LoadGrammarAsync(favoriteFruit);  
        Thread.Sleep(7000);  

        // Request an update and unload the Farm grammar.  
        recognizer.RequestRecognizerUpdate();  
        recognizer.UnloadGrammar(farmAnimals);  
        Thread.Sleep(7000);  
      }  

      // Keep the console window open.  
      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  

    // At the update, get the names and enabled status of the currently loaded grammars.  
    public static void recognizer_RecognizerUpdateReached(  
      object sender, RecognizerUpdateReachedEventArgs e)  
    {  
      Console.WriteLine();  
      Console.WriteLine("Update reached:");  
      Thread.Sleep(1000);  

      string qualifier;  
      List<Grammar> grammars = new List<Grammar>(recognizer.Grammars);  
      foreach (Grammar g in grammars)  
      {  
        qualifier = (g.Enabled) ? "enabled" : "disabled";  
        Console.WriteLine("  {0} grammar is loaded and {1}.",  
        g.Name, qualifier);  
      }  
    }  

    // Write the text of the recognized phrase to the console.  
    static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)  
    {  
      Console.WriteLine("    Speech recognized: " + e.Result.Text);  
    }  

    // Write a message to the console when recognition fails.  
    static void recognizer_SpeechRecognitionRejected(object sender, SpeechRecognitionRejectedEventArgs e)  
    {  
      Console.WriteLine("    Recognition attempt failed");  
    }  
  }  
}  

설명

RecognizerUpdateReached 이벤트 로드 및 언로드 문법 등 원자성 및 동기 수정을 적용할 음성 인식 엔진을 일시 중지 하는 메커니즘을 제공 합니다.

애플리케이션을 사용 하는 경우는 SpeechRecognitionEngine 인스턴스를 인식 관리, 중 하나를 사용 하는 SpeechRecognitionEngine.RequestRecognizerUpdate 엔진 업데이트 메시지를 일시 중지를 요청 하는 방법입니다. 합니다 SpeechRecognitionEngine 발생 시키는 인스턴스는 SpeechRecognitionEngine.RecognizerUpdateReached 업데이트에 대 한 준비가 되 면 이벤트입니다.

하는 동안를 SpeechRecognitionEngine 인스턴스는 일시 중지, 로드, 언로드, 설정 및 해제 수 있습니다 Grammar 개체 및에 대 한 값을 수정 합니다 BabbleTimeout, InitialSilenceTimeout, 및 EndSilenceTimeout 속성.

애플리케이션을 사용 하는 경우는 SpeechRecognizer 인스턴스를 인식 관리, 중 하나를 사용 하는 SpeechRecognizer.RequestRecognizerUpdate 엔진 업데이트 메시지를 일시 중지를 요청 하는 방법입니다. 합니다 SpeechRecognizer 발생 시키는 인스턴스는 SpeechRecognizer.RecognizerUpdateReached 업데이트에 대 한 준비가 되 면 이벤트입니다.

하지만 SpeechRecognizer 인스턴스는 일시 중지, 로드, 언로드, 설정 및 해제 수 있습니다 Grammar 개체입니다.

SpeechRecognizer.RecognizerUpdateReached 이벤트를 처리할 SpeechRecognitionEngine.RecognizerUpdateReached 때 인식 엔진은 이벤트 처리기가 반환될 때까지 일시 중지됩니다.

RecognizerUpdateReachedEventArgsEventArgs로부터 파생됩니다.

속성

AudioPosition

이벤트와 연결된 오디오 위치를 가져옵니다.

UserToken

애플리케이션이 UserToken 또는 RequestRecognizerUpdate를 호출 RequestRecognizerUpdate 할 때 시스템에 전달된 를 가져옵니다.

메서드

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

적용 대상

추가 정보