KeywordRecognizer クラス

定義

キーワード (keyword) モデルを使用して単語または短い語句を認識します。

public sealed class KeywordRecognizer : IDisposable
type KeywordRecognizer = class
    interface IDisposable
Public NotInheritable Class KeywordRecognizer
Implements IDisposable
継承
KeywordRecognizer
実装

まず、オブジェクトをインスタンス化する必要があります。

// (This sample uses the microphone. You can use any input source.)
var audioConfig = Microsoft.CognitiveServices.Speech.Audio.AudioConfig.FromDefaultMicrophoneInput();
var recognizer = new KeywordRecognizer (audioConfig);

(省略可能)その後、通知を受信するには、イベントをワイヤードする必要があります。

recognizer.Recognized += (s, e) =>
{
    // Keyword detected!
};

すべて設定します。 認識を開始します。

// for .table, see:
// https://docs.microsoft.com/azure/cognitive-services/speech-service/custom-keyword-basics
var keywordModel = KeywordRecognitionModel.FromFile(@"C:\path\to\your\tablefile.table");
var result = recognizer.RecognizeOnceAsync(keywordModel);
result.Wait();

注釈

Speech Studio でキーワード (keyword) モデルを作成し、それを '.table' ファイルに保存します。

関連項目:

コンストラクター

KeywordRecognizer(AudioConfig)

から KeywordRecognizer を作成します AudioConfig。 構成では、認識エンジン オブジェクトで使用されるオーディオ入力を定義します。

プロパティ

Properties

この KeywordRecognizerに対して定義されているプロパティとその値のコレクション。

メソッド

Dispose()

このメソッドは、リソースのクリーンアップを実行します。

RecognizeOnceAsync(KeywordRecognitionModel)

非同期操作としてキーワード (keyword)認識セッションを開始します。

StopRecognitionAsync()

現在アクティブなキーワード (keyword)認識セッションを非同期的に停止します。

イベント

Canceled

相互作用の取り消しに関連するイベントのシグナル。 イベントは、理由が直接取り消しまたはエラーであるかどうかを示します。

Recognized

キーワードの認識に関連するイベントのシグナル。

適用対象