IntentRecognizerSet class
跨一組意圖辨識器同盟 recognize() 呼叫。
- Extends
建構函式
| Intent |
建構 IntentRecognizerSet 的新實例。 |
屬性
| length | 集合中的辨識器數目。 |
方法
| clone(Intent |
傳回現有 IntentRecognizerSet 的複製品。 |
| on |
註冊函式以有條件地啟用/停用辨識器。 您可以註冊多個處理程式,並在任何其他處理程式之前執行新的處理程式。 |
| on |
註冊函式以篩選辨識器的輸出。 您可以註冊多個處理程式,並在任何其他處理程式之後執行新的處理程式。 |
| on |
實作實際的辨識邏輯。 |
| recognize(IRecognize |
嘗試比對用戶文字語句與意圖。 |
| recognizer(IIntent |
將新的辨識器外掛程式新增至集合。 |
建構函式詳細資料
IntentRecognizerSet(IIntentRecognizerSetOptions)
建構 IntentRecognizerSet 的新實例。
new IntentRecognizerSet(options?: IIntentRecognizerSetOptions)
參數
- options
- IIntentRecognizerSetOptions
(選擇性) 用來初始化集合和控制辨識流程的選項。
屬性詳細資料
length
集合中的辨識器數目。
length: number
屬性值
number
方法詳細資料
clone(IntentRecognizerSet)
傳回現有 IntentRecognizerSet 的複製品。
function clone(copyTo?: IntentRecognizerSet)
參數
- copyTo
- IntentRecognizerSet
(選擇性) 實例,將目前的 物件複製到 。 如果遺失新的實例,將會建立。
傳回
onEnabled((context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)
註冊函式以有條件地啟用/停用辨識器。 您可以註冊多個處理程式,並在任何其他處理程式之前執行新的處理程式。
function onEnabled(handler: (context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void)
參數
- handler
-
(context: IRecognizeContext, callback: (err: Error, enabled: boolean) => void) => void
針對每個訊息呼叫的函式。 您應該針對應該辨識的每個訊息呼叫 callback(null, true)。
傳回
onFilter((context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)
註冊函式以篩選辨識器的輸出。 您可以註冊多個處理程式,並在任何其他處理程式之後執行新的處理程式。
function onFilter(handler: (context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void)
參數
- handler
-
(context: IRecognizeContext, result: IIntentRecognizerResult, callback: (err: Error, result: IIntentRecognizerResult) => void) => void
針對每個產生分數大於 0.0 之意圖的訊息呼叫函式。 您應該呼叫 callback(null, { score: 0.0, intent: null }),以封鎖傳回意圖。
傳回
onRecognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)
實作實際的辨識邏輯。
function onRecognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)
參數
- context
- IRecognizeContext
- callback
-
(err: Error, result: IIntentRecognizerResult) => void
recognize(IRecognizeContext, (err: Error, result: IIntentRecognizerResult) => void)
嘗試比對用戶文字語句與意圖。
function recognize(context: IRecognizeContext, callback: (err: Error, result: IIntentRecognizerResult) => void)
參數
- context
- IRecognizeContext
正在辨識之已接收訊息的內容資訊。
- callback
-
(err: Error, result: IIntentRecognizerResult) => void
使用辨識作業結果叫用的函式。
recognizer(IIntentRecognizer)
將新的辨識器外掛程式新增至集合。
function recognizer(plugin: IIntentRecognizer)
參數
- plugin
- IIntentRecognizer
要加入的辨識器。