SpeechRecognitionEngine.InstalledRecognizers 메서드

정의

현재 시스템에 설치된 음성 인식기의 모든 정보를 반환합니다.Returns information for all of the installed speech recognizers on the current system.

public:
 static System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::Recognition::RecognizerInfo ^> ^ InstalledRecognizers();
public static System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Recognition.RecognizerInfo> InstalledRecognizers ();
static member InstalledRecognizers : unit -> System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.Recognition.RecognizerInfo>
Public Shared Function InstalledRecognizers () As ReadOnlyCollection(Of RecognizerInfo)

반환

설치된 인식기를 설명하는 RecognizerInfo 개체의 읽기 전용 컬렉션A read-only collection of the RecognizerInfo objects that describe the installed recognizers.

예제

다음 예제에서는 기본 음성 인식 기능을 보여 주는 콘솔 애플리케이션 부분을 보여 줍니다.The following example shows part of a console application that demonstrates basic speech recognition. 이 예제에서는 사용 하 여 반환 된 컬렉션을 InstalledRecognizers 메서드 영어 언어를 지 원하는 음성 인식기를 합니다.The example uses the collection returned by the InstalledRecognizers method to find a speech recognizer that supports the English language.

using System;  
using System.Speech.Recognition;  
  
namespace SpeechRecognitionApp  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
  
      // Select a speech recognizer that supports English.  
      RecognizerInfo info = null;  
      foreach (RecognizerInfo ri in SpeechRecognitionEngine.InstalledRecognizers())  
      {  
        if (ri.Culture.TwoLetterISOLanguageName.Equals("en"))  
        {  
          info = ri;  
          break;  
        }  
      }  
      if (info == null) return;  
  
      // Create the selected recognizer.  
      using (SpeechRecognitionEngine recognizer =  
        new SpeechRecognitionEngine(info))  
      {  
  
        // Create and load a dictation grammar.  
        recognizer.LoadGrammar(new DictationGrammar());  
  
        // Add a handler for the speech recognized event.  
        recognizer.SpeechRecognized +=   
          new EventHandler<SpeechRecognizedEventArgs>(recognizer_SpeechRecognized);  
  
        // Configure input to the speech recognizer.  
        recognizer.SetInputToDefaultAudioDevice();  
  
        // Start asynchronous, continuous speech recognition.  
        recognizer.RecognizeAsync(RecognizeMode.Multiple);  
  
        // Keep the console window open.  
        while (true)  
        {  
          Console.ReadLine();  
        }  
      }  
    }  
  
    // Handle the SpeechRecognized event.  
    static void recognizer_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)  
    {  
      Console.WriteLine("Recognized text: " + e.Result.Text);  
    }  
  }  
}  

설명

현재 인식기에 대 한 정보를 얻으려면 사용 된 RecognizerInfo 속성입니다.To get information about the current recognizer, use the RecognizerInfo property.

적용 대상

추가 정보