Exportieren (0) Drucken
Alle erweitern

SpeechRecognitionEngine-Klasse

Aktualisiert: November 2007

Provides access to run any properly installed speech recognition services found on a Windows Desktop system.

Namespace:  System.Speech.Recognition
Assembly:  System.Speech (in System.Speech.dll)

public class SpeechRecognitionEngine : IDisposable
public class SpeechRecognitionEngine implements IDisposable
public class SpeechRecognitionEngine implements IDisposable

Applications using SpeechRecognitionEngine select anyone of the Windows Desktop Speech Technology compatible recognition engine available on a given system, as well as choose a particular form of audio input -- including the stantdard audio input, streams, and files.

Therefore, SpeechRecognitionEngine based applications can be constructed as clients of a particular recognition engine, as standalone speech recognition applications using inprocess recognition engines, and as servers, providing access to a recognition engine to clients.

ms587635.alert_note(de-de,VS.90).gifHinweis:

While SpeechRecognitionEngine based applications can use the system default audio input and recognition engines, it is recommended that the SpeechRecognitionEngine object be used instead for that purpose.

Applications using SpeechRecognitionEngine effectively do so by selecting the correct recognizer and culture when constructing an instance, connecting to the appropriate audio input, creating event handlers to receive audio recognition results, controlling the grammars used in recognition, and by starting and stopping recognition engines.

To support this, SpeechRecognitionEngine provides programmatic control over:

SpeechRecognitionEngine implements [IDispose].

The example below queries the system to find a recognition engine with the identification string and CultureID. Note, before this instance of SpeechRecognitionEngine can be used, it must have its input set, using SetInputToNull, SetInputToWaveStream, or SetInputToDefaultAudioDevice).

private SpeechRecognitionEngine SelectRecognitionEngine(CultureInfo requiredCulture, string requiredId) {
  // Select based on a specific recognitionEngine configuration:
  SpeechRecognitionEngine speechRecognitionEngine=null;
  foreach (RecognzierInfo config in SpeechRecognitionEngine.InstalledRecognizers()) {
    if (config.Culture.Equals(requiredCulture) && config.Id== requiredId) {
      speechRecognitionEngine = new SpeechRecognitionEngine(config);
      break;
    }
    
  }
  return speechRecognitionEngine;
}

System.Object
  System.Speech.Recognition.SpeechRecognitionEngine

Alle öffentlichen static (Shared in Visual Basic)-Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework und .NET Compact Framework unterstützen nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen für .NET Framework.

.NET Framework

Unterstützt in: 3.5, 3.0

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2015 Microsoft