IntentRecognizer class
意圖辨識器。
- Extends
建構函式
Intent |
初始化 IntentRecognizer 的實例。 |
屬性
authorization |
取得用來與服務通訊的授權權杖。 取得/設定用來與服務通訊的授權權杖。 注意:請使用衍生自 LanguageUnder understanding 訂用帳戶金鑰的權杖作為意圖辨識器。 |
canceled | 事件已取消,表示辨識期間發生錯誤。 |
properties | 針對這個 IntentRecognizer 定義的屬性及其值的集合。 |
recognized | 事件已辨識的訊號,表示收到最終辨識結果。 |
recognizing | 事件辨識訊號表示收到中繼辨識結果。 |
speech |
取得辨識的口語。 |
telemetry |
這個方法會傳回遙測設定的目前狀態。 |
繼承的屬性
session |
定義會話已啟動事件的事件處理常式。 |
session |
定義會話已停止事件的事件處理常式。 |
speech |
定義語音停止事件的事件處理常式。 |
speech |
定義語音啟動事件的事件處理常式。 |
方法
繼承的方法
enable |
這個方法會全域啟用或停用遙測。 |
建構函式詳細資料
IntentRecognizer(SpeechConfig, AudioConfig)
初始化 IntentRecognizer 的實例。
new IntentRecognizer(speechConfig: SpeechConfig, audioConfig?: AudioConfig)
參數
- speechConfig
- SpeechConfig
組態屬性集。
- audioConfig
- AudioConfig
與辨識器相關聯的選擇性音訊輸入組態
屬性詳細資料
authorizationToken
取得用來與服務通訊的授權權杖。 取得/設定用來與服務通訊的授權權杖。 注意:請使用衍生自 LanguageUnder understanding 訂用帳戶金鑰的權杖作為意圖辨識器。
string authorizationToken
屬性值
string
授權權杖。
canceled
事件已取消,表示辨識期間發生錯誤。
public canceled: (sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void
屬性值
(sender: IntentRecognizer, event: IntentRecognitionCanceledEventArgs) => void
properties
針對這個 IntentRecognizer 定義的屬性及其值的集合。
PropertyCollection properties
屬性值
針對這個 IntentRecognizer 定義的屬性及其值的集合。
recognized
事件已辨識的訊號,表示收到最終辨識結果。
public recognized: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void
屬性值
(sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void
recognizing
事件辨識訊號表示收到中繼辨識結果。
public recognizing: (sender: IntentRecognizer, event: IntentRecognitionEventArgs) => void
屬性值
(sender: IntentRecognizer, event: IntentRecognitionEventArgs) => 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
sessionStopped
定義會話已停止事件的事件處理常式。
public sessionStopped: (sender: Recognizer, event: SessionEventArgs) => void
屬性值
(sender: Recognizer, event: SessionEventArgs) => void
speechEndDetected
定義語音停止事件的事件處理常式。
public speechEndDetected: (sender: Recognizer, event: RecognitionEventArgs) => void
屬性值
(sender: Recognizer, event: RecognitionEventArgs) => void
speechStartDetected
定義語音啟動事件的事件處理常式。
public speechStartDetected: (sender: Recognizer, event: RecognitionEventArgs) => void
屬性值
(sender: Recognizer, event: RecognitionEventArgs) => void
方法詳細資料
addAllIntents(LanguageUnderstandingModel, string)
function addAllIntents(model: LanguageUnderstandingModel, intentId?: string)
參數
包含意圖的語言理解模型。
- intentId
-
string
在 IntentRecognitionResult 的 getIntentId () 方法中傳回的自訂識別碼字串。
addIntent(string, string)
新增應該辨識為意圖的片語。
function addIntent(simplePhrase: string, intentId?: string)
參數
- simplePhrase
-
string
- intentId
-
string
String,表示要辨識之意圖的識別碼。
addIntentWithLanguageModel(string, LanguageUnderstandingModel, string)
從Language Understanding服務新增意圖以進行辨識。
function addIntentWithLanguageModel(intentId: string, model: LanguageUnderstandingModel, intentName?: string)
參數
- intentId
-
string
String,表示要辨識之意圖的識別碼。 如果 intentName 是空的,則會忽略。
來自Language Understanding服務的意圖模型。
- intentName
-
string
意圖模型中定義的意圖名稱。 如果它是空的,則會新增模型中定義的所有意圖名稱。
close(() => void, (error: string) => void)
關閉這個類別實例所持有的所有外部資源。
function close(cb?: () => void, errorCb?: (error: string) => void)
參數
- cb
-
() => void
- errorCb
-
(error: string) => void
recognizeOnceAsync((e: IntentRecognitionResult) => void, (e: string) => void)
啟動意圖辨識,並在辨識第一個語句之後停止。 工作會傳回辨識文字和意圖作為結果。 注意:RecognizeOnceAsync () 會在辨識第一個語句時傳回,因此它只適用于單次辨識,例如命令或查詢。 針對長時間執行的辨識,請改用 StartContinuousRecognitionAsync () 。
function recognizeOnceAsync(cb?: (e: IntentRecognitionResult) => void, err?: (e: string) => void)
參數
- cb
-
(e: IntentRecognitionResult) => void
接收辨識的回呼已完成 IntentRecognitionResult。
- 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 () 為止。 使用者必須訂閱事件,才能接收辨識結果。 注意:關鍵字辨識功能僅適用于語音裝置 SDK。 此功能目前不包含在 SDK 本身中。
function startKeywordRecognitionAsync(model: KeywordRecognitionModel, cb?: () => void, err?: (e: string) => void)
參數
- model
- KeywordRecognitionModel
關鍵字辨識模型,指定要辨識的關鍵字。
- 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, (e: string) => void)
停止連續語音辨識。 注意:關鍵字辨識功能僅適用于語音裝置 SDK。 此功能目前不包含在 SDK 本身中。
function stopKeywordRecognitionAsync(cb?: () => void, err?: (e: string) => void)
參數
- cb
-
() => void
一旦辨識停止,就會叫用回呼。
- err
-
(e: string) => void
發生錯誤時叫用回呼。
繼承的方法的詳細資料
enableTelemetry(boolean)
這個方法會全域啟用或停用遙測。
static function enableTelemetry(enabled: boolean)
參數
- enabled
-
boolean
遙測收集的全域設定。 如果設定為 true,則會收集遙測資訊,例如麥克風錯誤、辨識錯誤並傳送給 Microsoft。 如果設定為 false,則不會將任何遙測傳送至 Microsoft。