DialogServiceConnector class

對話方塊服務連接器

Extends

建構函式

DialogServiceConnector(DialogServiceConfig, AudioConfig)

初始化 DialogServiceConnector 的實例。

屬性

activityReceived

事件活動已收到活動訊號。

authorizationToken

取得用來與服務通訊的授權權杖。

canceled

事件已取消,表示辨識期間發生錯誤。

internalData
properties

針對這個 DialogServiceConnector 定義的屬性及其值集合。

recognized

事件可辨識的訊號表示收到最終辨識結果。

recognizing

事件辨識訊號表示收到中繼辨識結果。

speechActivityTemplate

從語音取得服務所產生的活動範本。 來自範本的屬性將會在產生的活動上加戳記。 它可以是空的

telemetryEnabled

此方法會傳回遙測設定的目前狀態。

turnStatusReceived

事件 turnStatusReceived 表示已收到回合狀態訊息。 這些訊息會與互動和交談相關聯。 它們可用來在與對話後端互動失敗時通知用戶端,例如網路問題、逾時、當機或其他問題時。

繼承的屬性

sessionStarted

定義會話啟動事件的事件處理常式。

sessionStopped

定義會話停止事件的事件處理常式。

speechEndDetected

定義語音停止事件的事件處理常式。

speechStartDetected

定義語音啟動事件的事件處理常式。

方法

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

關閉這個類別實例持有的所有外部資源。

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

啟動服務的連線。 使用者可以選擇性地呼叫 connect () ,以在開始互動之前,事先手動設定連線。

注意:傳回時,連線可能尚未就緒。 請訂閱 Connected 事件,以在建立連線時收到通知。

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

關閉服務的連線。 使用者可以選擇性地呼叫 disconnect () ,以手動關閉相關聯 DialogServiceConnector 的連接。

如果在辨識期間呼叫 disconnect () ,辨識將會失敗並取消並顯示錯誤。

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

啟動辨識,並在辨識第一個語句之後停止。

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

繼承的方法

enableTelemetry(boolean)

這個方法會全域啟用或停用遙測。

建構函式詳細資料

DialogServiceConnector(DialogServiceConfig, AudioConfig)

初始化 DialogServiceConnector 的實例。

new DialogServiceConnector(dialogConfig: DialogServiceConfig, audioConfig?: AudioConfig)

參數

dialogConfig
DialogServiceConfig

要設定這個辨識器的屬性集。

audioConfig
AudioConfig

與辨識器相關聯的選擇性音訊組態

屬性詳細資料

activityReceived

事件活動已收到活動訊號。

public activityReceived: (sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void

屬性值

(sender: DialogServiceConnector, event: ActivityReceivedEventArgs) => void

authorizationToken

取得用來與服務通訊的授權權杖。

string authorizationToken

屬性值

string

授權權杖。

canceled

事件已取消,表示辨識期間發生錯誤。

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

屬性值

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

internalData

object internalData

屬性值

object

properties

針對這個 DialogServiceConnector 定義的屬性及其值集合。

PropertyCollection properties

屬性值

針對這個 DialogServiceConnector 定義的屬性及其值集合。

recognized

事件可辨識的訊號表示收到最終辨識結果。

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

屬性值

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

recognizing

事件辨識訊號表示收到中繼辨識結果。

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

屬性值

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

speechActivityTemplate

從語音取得服務所產生的活動範本。 來自範本的屬性將會在產生的活動上加戳記。 它可以是空的

string speechActivityTemplate

屬性值

string

telemetryEnabled

此方法會傳回遙測設定的目前狀態。

static boolean telemetryEnabled

屬性值

boolean

如果已啟用遙測,則為 true,否則為 false。

turnStatusReceived

事件 turnStatusReceived 表示已收到回合狀態訊息。 這些訊息會與互動和交談相關聯。 它們可用來在與對話後端互動失敗時通知用戶端,例如網路問題、逾時、當機或其他問題時。

public turnStatusReceived: (sender: DialogServiceConnector, event: TurnStatusReceivedEventArgs) => void

屬性值

(sender: DialogServiceConnector, event: TurnStatusReceivedEventArgs) => void

繼承的屬性詳細資料

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, err?: (error: string) => void)

參數

cb

() => void

err

(error: string) => void

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

啟動服務的連線。 使用者可以選擇性地呼叫 connect () ,以在開始互動之前,事先手動設定連線。

注意:傳回時,連線可能尚未就緒。 請訂閱 Connected 事件,以在建立連線時收到通知。

function connect(cb?: () => void, err?: (error: string) => void)

參數

cb

() => void

err

(error: string) => void

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

關閉服務的連線。 使用者可以選擇性地呼叫 disconnect () ,以手動關閉相關聯 DialogServiceConnector 的連接。

如果在辨識期間呼叫 disconnect () ,辨識將會失敗並取消並顯示錯誤。

function disconnect(cb?: () => void, err?: (error: string) => void)

參數

cb

() => void

err

(error: string) => void

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

啟動辨識,並在辨識第一個語句之後停止。

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

參數

cb

(e: SpeechRecognitionResult) => void

當 reco 完成時收到結果的回呼。

err

(e: string) => void

發生錯誤時叫用回呼。

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

function sendActivityAsync(activity: string, cb?: () => void, errCb?: (error: string) => void)

參數

activity

string

cb

() => void

errCb

(error: string) => void

繼承的方法的詳細資料

enableTelemetry(boolean)

這個方法會全域啟用或停用遙測。

static function enableTelemetry(enabled: boolean)

參數

enabled

boolean

遙測收集的全域設定。 如果設定為 true,則會收集遙測資訊,例如麥克風錯誤、辨識錯誤,並傳送給 Microsoft。 如果設定為 false,則不會將任何遙測傳送給 Microsoft。

繼承自Recognizer.enableTelemetry