SpeechRecognizer class

マイク、ファイル、またはその他のオーディオ入力ストリームから音声認識を実行し、結果として文字起こしされたテキストを取得します。

Extends

コンストラクター

SpeechRecognizer(SpeechConfig, AudioConfig)

SpeechRecognizer コンストラクター。

プロパティ

authorizationToken

サービスとの通信に使用される承認トークンを取得します。

canceled

イベントが取り消されると、認識中にエラーが発生したことが通知されます。

endpointId

音声認識に使用されるカスタマイズされた音声モデルのエンドポイント ID を取得します。

internalData
outputFormat

認識の出力形式を取得します。

properties

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

recognized

イベントが認識されると、最終的な認識結果が受信されたことを通知します。

recognizing

イベント認識は、中間認識結果が受信されたことを通知します。

speechRecognitionLanguage

認識の読み上げ言語を取得します。

telemetryEnabled

このメソッドは、テレメトリ設定の現在の状態を返します。

継承されたプロパティ

sessionStarted

セッション開始イベントのイベント ハンドラーを定義します。

sessionStopped

セッション停止イベントのイベント ハンドラーを定義します。

speechEndDetected

音声停止イベントのイベント ハンドラーを定義します。

speechStartDetected

音声開始イベントのイベント ハンドラーを定義します。

メソッド

close(() => void, (error: string) => void)

は、このクラスのインスタンスによって保持されているすべての外部リソースを閉じます。

dispose(boolean)

オブジェクトが保持するすべてのリソースを破棄します。

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, AudioConfig)

SpeechRecognizer コンストラクター。

recognizeOnceAsync((e: SpeechRecognitionResult) => void, (e: string) => void)

音声認識を開始し、最初の発話が認識された後に停止します。 このタスクからは、結果として認識テキストが返されます。 注: RecognizeOnceAsync() は、最初の発話が認識されたときに を返します。そのため、コマンドやクエリなどのシングル ショット認識にのみ適しています。 実行時間の長い認識の場合は、代わりに StartContinuousRecognitionAsync() を使用します。

startContinuousRecognitionAsync(() => void, (e: string) => void)

stopContinuousRecognitionAsync() が呼び出されるまで、音声認識を開始します。 ユーザーは、認識結果を受け取るためにイベントをサブスクライブする必要があります。

startKeywordRecognitionAsync(KeywordRecognitionModel, () => void, (e: string) => void)

stopKeywordRecognitionAsync() が呼び出されるまで、キーワード (keyword)スポッティングを使用して音声認識を開始します。 ユーザーは、認識結果を受け取るためにイベントをサブスクライブする必要があります。 注: キーワードスポッティング機能は、Speech Devices SDK でのみ使用できます。 この機能は現在、SDK 自体には含まれていません。

stopContinuousRecognitionAsync(() => void, (e: string) => void)

継続的な音声認識を停止します。

stopKeywordRecognitionAsync(() => void)

継続的な音声認識を停止します。 注: キーワードスポッティング機能は、Speech Devices SDK でのみ使用できます。 この機能は現在、SDK 自体には含まれていません。

継承されたメソッド

enableTelemetry(boolean)

このメソッドは、テレメトリをグローバルに有効または無効にします。

コンストラクターの詳細

SpeechRecognizer(SpeechConfig, AudioConfig)

SpeechRecognizer コンストラクター。

new SpeechRecognizer(speechConfig: SpeechConfig, audioConfig?: AudioConfig)

パラメーター

speechConfig
SpeechConfig

この認識エンジンの初期プロパティのセット

audioConfig
AudioConfig

認識エンジンに関連付けられているオプションのオーディオ構成

プロパティの詳細

authorizationToken

サービスとの通信に使用される承認トークンを取得します。

string authorizationToken

プロパティ値

string

承認トークン。

canceled

イベントが取り消されると、認識中にエラーが発生したことが通知されます。

public canceled: (sender: Recognizer, event: SpeechRecognitionCanceledEventArgs) => void

プロパティ値

(sender: Recognizer, event: SpeechRecognitionCanceledEventArgs) => void

endpointId

音声認識に使用されるカスタマイズされた音声モデルのエンドポイント ID を取得します。

string endpointId

プロパティ値

string

音声認識に使用されるカスタマイズされた音声モデルのエンドポイント ID。

internalData

object internalData

プロパティ値

object

outputFormat

認識の出力形式を取得します。

OutputFormat outputFormat

プロパティ値

認識の出力形式。

properties

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

PropertyCollection properties

プロパティ値

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

recognized

イベントが認識されると、最終的な認識結果が受信されたことを通知します。

public recognized: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void

プロパティ値

(sender: Recognizer, event: SpeechRecognitionEventArgs) => void

recognizing

イベント認識は、中間認識結果が受信されたことを通知します。

public recognizing: (sender: Recognizer, event: SpeechRecognitionEventArgs) => void

プロパティ値

(sender: Recognizer, event: SpeechRecognitionEventArgs) => void

speechRecognitionLanguage

認識の読み上げ言語を取得します。

string speechRecognitionLanguage

プロパティ値

string

認識の話し言葉。

telemetryEnabled

このメソッドは、テレメトリ設定の現在の状態を返します。

static boolean telemetryEnabled

プロパティ値

boolean

テレメトリが有効な場合は true、それ以外の場合は false。

継承されたプロパティの詳細

sessionStarted

セッション開始イベントのイベント ハンドラーを定義します。

public sessionStarted: (sender: Recognizer, event: SessionEventArgs) => void

プロパティ値

(sender: Recognizer, event: SessionEventArgs) => void

Recognizer.sessionStartedから継承

sessionStopped

セッション停止イベントのイベント ハンドラーを定義します。

public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void

プロパティ値

(sender: Recognizer, event: SessionEventArgs) => void

Recognizer.sessionStoppedから継承

speechEndDetected

音声停止イベントのイベント ハンドラーを定義します。

public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

プロパティ値

(sender: Recognizer, event: RecognitionEventArgs) => void

Recognizer.speechEndDetectedから継承

speechStartDetected

音声開始イベントのイベント ハンドラーを定義します。

public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void

プロパティ値

(sender: Recognizer, event: RecognitionEventArgs) => void

Recognizer.speechStartDetectedから継承

メソッドの詳細

close(() => void, (error: string) => void)

は、このクラスのインスタンスによって保持されているすべての外部リソースを閉じます。

function close(cb?: () => void, errorCb?: (error: string) => void)

パラメーター

cb

() => void

errorCb

(error: string) => void

dispose(boolean)

オブジェクトが保持するすべてのリソースを破棄します。

function dispose(disposing: boolean): Promise<void>

パラメーター

disposing

boolean

オブジェクトを破棄する場合は true。

戻り値

Promise<void>

FromConfig(SpeechConfig, AutoDetectSourceLanguageConfig, AudioConfig)

SpeechRecognizer コンストラクター。

static function FromConfig(speechConfig: SpeechConfig, autoDetectSourceLanguageConfig: AutoDetectSourceLanguageConfig, audioConfig?: AudioConfig): SpeechRecognizer

パラメーター

speechConfig
SpeechConfig

この認識エンジンの初期プロパティのセット

autoDetectSourceLanguageConfig
AutoDetectSourceLanguageConfig

認識エンジンに関連付けられているソース言語検出構成

audioConfig
AudioConfig

認識エンジンに関連付けられているオプションのオーディオ構成

戻り値

recognizeOnceAsync((e: SpeechRecognitionResult) => void, (e: string) => void)

音声認識を開始し、最初の発話が認識された後に停止します。 このタスクからは、結果として認識テキストが返されます。 注: RecognizeOnceAsync() は、最初の発話が認識されたときに を返します。そのため、コマンドやクエリなどのシングル ショット認識にのみ適しています。 実行時間の長い認識の場合は、代わりに StartContinuousRecognitionAsync() を使用します。

function recognizeOnceAsync(cb?: (e: SpeechRecognitionResult) => void, err?: (e: string) => void)

パラメーター

cb

(e: SpeechRecognitionResult) => void

SpeechRecognitionResult を受け取ったコールバック。

err

(e: string) => void

エラーが発生した場合に呼び出されるコールバック。

startContinuousRecognitionAsync(() => void, (e: string) => void)

stopContinuousRecognitionAsync() が呼び出されるまで、音声認識を開始します。 ユーザーは、認識結果を受け取るためにイベントをサブスクライブする必要があります。

function startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void)

パラメーター

cb

() => void

認識が開始されると呼び出されるコールバック。

err

(e: string) => void

エラーが発生した場合に呼び出されるコールバック。

startKeywordRecognitionAsync(KeywordRecognitionModel, () => void, (e: string) => void)

stopKeywordRecognitionAsync() が呼び出されるまで、キーワード (keyword)スポッティングを使用して音声認識を開始します。 ユーザーは、認識結果を受け取るためにイベントをサブスクライブする必要があります。 注: キーワードスポッティング機能は、Speech Devices SDK でのみ使用できます。 この機能は現在、SDK 自体には含まれていません。

function startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void)

パラメーター

model
KeywordRecognitionModel

認識するキーワード (keyword)を指定するキーワード (keyword)認識モデル。

cb

() => void

認識が開始されると呼び出されるコールバック。

err

(e: string) => void

エラーが発生した場合に呼び出されるコールバック。

stopContinuousRecognitionAsync(() => void, (e: string) => void)

継続的な音声認識を停止します。

function stopContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void)

パラメーター

cb

() => void

認識が停止した後に呼び出されるコールバック。

err

(e: string) => void

エラーが発生した場合に呼び出されるコールバック。

stopKeywordRecognitionAsync(() => void)

継続的な音声認識を停止します。 注: キーワードスポッティング機能は、Speech Devices SDK でのみ使用できます。 この機能は現在、SDK 自体には含まれていません。

function stopKeywordRecognitionAsync(cb?: () => void)

パラメーター

cb

() => void

認識が停止した後に呼び出されるコールバック。

継承済みメソッドの詳細

enableTelemetry(boolean)

このメソッドは、テレメトリをグローバルに有効または無効にします。

static function enableTelemetry(enabled: boolean)

パラメーター

enabled

boolean

テレメトリ収集のグローバル設定。 true に設定すると、マイク エラー、認識エラーなどのテレメトリ情報が収集され、Microsoft に送信されます。 false に設定すると、テレメトリは Microsoft に送信されません。

Recognizer.enableTelemetryから継承