Share via


類別 Intent::IntentRecognizer

class Intent::IntentRecognizer
  : public AsyncRecognizer< IntentRecognitionResult, IntentRecognitionEventArgs, IntentRecognitionCanceledEventArgs >

除了執行語音轉換文字辨識之外,IntentRecognizer 還會擷取說話者意圖的結構化資訊,可用來驅動使用專用意圖觸發程式的進一步動作, (請參閱 IntentTrigger) 。

成員

屬性

語法: public PropertyCollection & Properties;

為這個 IntentRecognizer 定義的屬性及其值集合。

IntentRecognizer

語法: public inline explicit IntentRecognizer ( SPXRECOHANDLE hreco );

內部建構函式。 使用提供的句柄建立新的實例。

參數

  • hreco 辨識器句柄。

~IntentRecognizer

語法: public inline ~IntentRecognizer ( );

解構函式

RecognizeOnceAsync

語法: public inline virtual std::future< std::shared_ptr< IntentRecognitionResult > > RecognizeOnceAsync ( );

啟動意圖辨識,並在辨識單一語句之後傳回。 單一語句的結尾會藉由聽取結束時的靜默來決定,或是在處理音訊達 15 秒的上限時結束。 此工作會傳回辨識文字作為結果。 注意:由於 RecognizeOnceAsync () 只會傳回單一語句,因此它只適用於單次辨識,例如命令或查詢。 針對長時間執行的多重語句辨識,請改用 StartContinuousRecognitionAsync () 。

傳回

未來包含結果值 (異步意圖辨識) IntentRecognitionResult 的共享指標。

RecognizeOnceAsync

語法: public inline std::future< std::shared_ptr< IntentRecognitionResult > > RecognizeOnceAsync ( std::string text );

啟動意圖辨識,並從傳入的文字產生結果。 當語音輸入未系結至 IntentRecognizer 時,這適用於測試和其他時間。 注意:意圖服務目前不支援此功能,因此它只適用於離線模式比對或完全比對意圖。

參數

  • text 要評估的文字。

傳回

未來包含結果值 (異步意圖辨識) IntentRecognitionResult 的共享指標。

StartContinuousRecognitionAsync

語法: public inline virtual std::future< void > StartContinuousRecognitionAsync ( );

以異步方式起始連續意圖辨識作業。

傳回

空的未來。

StopContinuousRecognitionAsync

語法: public inline virtual std::future< void > StopContinuousRecognitionAsync ( );

以異步方式終止進行中的連續意圖辨識作業。

傳回

空的未來。

StartKeywordRecognitionAsync

語法: public inline virtual std::future< void > StartKeywordRecognitionAsync ( std::shared_ptr< KeywordRecognitionModel > model );

以異步方式起始關鍵詞辨識作業。

參數

  • model 指定要使用的關鍵詞模型。

傳回

空的未來。

StopKeywordRecognitionAsync

語法: public inline virtual std::future< void > StopKeywordRecognitionAsync ( );

以異步方式終止關鍵詞辨識作業。

傳回

空的未來。

AddIntent

語法: public inline void AddIntent ( const std::string & simplePhrase );

新增使用者可能說出的簡單片語,指出特定使用者意圖。 這個簡單片語可以是一種模式,包括和 enitity 以大括弧括住。 例如「按兩下 」{checkboxName} 複選框」。

參數

  • simplePhrase 對應至意圖的片語。

一旦辨識,IntentRecognitionResult 的 IntentId 屬性將會符合此處指定的 simplePhrase。 如果指定並符合任何實體,則會在 IntentResult-GetEntities> () 呼叫中取得這些實體。

AddIntent

語法: public inline void AddIntent ( const std::string & simplePhrase , const std::string & intentId );

新增使用者可能說出的簡單片語,指出特定使用者意圖。 這個簡單片語可以是一種模式,包括和 enitity 以大括弧括住。 例如「按兩下 」{checkboxName} 複選框」。

參數

  • simplePhrase 對應至意圖的片語。

  • intentId 在 IntentRecognitionResult 的 IntentId 屬性中傳回的自定義標識符字串。

一旦辨識,結果的意圖標識碼將會符合此處提供的標識符。 如果指定並符合任何實體,則會在 IntentResult-GetEntities> () 呼叫中取得這些實體。

AddIntent

語法: public inline void AddIntent ( std::shared_ptr< LanguageUnderstandingModel > model , const std::string & intentName );

依名稱從指定的 Language Understanding 模型新增單一意圖。 針對 PatternMatchingModel 和 ConversationalLanguageUnderstandingModel 類型,這會在啟用之前先清除任何現有的模型。 針對這些類型,會忽略 intentName。

參數

  • model 包含意圖的語言理解模型。

  • intentName 要包含在語言理解模型中的單一意圖名稱。

一旦辨識,IntentRecognitionResult 的 IntentId 屬性將會包含此處指定的 intentName。

AddIntent

語法: public inline void AddIntent ( std::shared_ptr< LanguageUnderstandingModel > model , const std::string & intentName , const std::string & intentId );

依名稱從指定的 Language Understanding 模型新增單一意圖。 針對 PatternMatchingModel 和 ConversationalLanguageUnderstandingModel 類型,這會在啟用之前先清除任何現有的模型。 針對這些類型,會忽略 intentName 和 intentId。

參數

  • model 包含意圖的語言理解模型。

  • intentName 要包含在語言理解模型中的單一意圖名稱。

  • intentId 在 IntentRecognitionResult 的 IntentId 屬性中傳回的自定義標識符字串。

AddAllIntents

語法: public inline void AddAllIntents ( std::shared_ptr< LanguageUnderstandingModel > model );

從指定的 Language Understanding 模型加入所有意圖。 針對 PatternMatchingModel 和 ConversationalLanguageUnderstandingModel 類型,這會在啟用之前先清除任何現有的模型。

參數

  • model 包含意圖的語言理解模型。

辨識之後,IntentRecognitionResult 的 IntentId 屬性將包含已辨識意圖的名稱。

AddAllIntents

語法: public inline void AddAllIntents ( std::shared_ptr< LanguageUnderstandingModel > model , const std::string & intentId );

從指定的 Language Understanding 模型新增所有意圖。 針對 PatternMatchingModel 和 ConversationalLanguageUnderunderunderModel 類型,這會在啟用之前清除任何現有的模型。

參數

  • model 包含意圖的語言理解模型。

  • intentId 在 IntentRecognitionResult 的 IntentId 屬性中要傳回的自定義字串標識符。

AddIntent

語法: public inline void AddIntent ( std::shared_ptr< IntentTrigger > trigger , const std::string & intentId );

加入指定的 IntentTrigger。

參數

  • trigger 對應至意圖的 IntentTrigger。

  • intentId 在 IntentRecognitionResult 的 IntentId 屬性中要傳回的自定義字串標識符。

SetAuthorizationToken

語法: public inline void SetAuthorizationToken ( const std::string & token );

設定將用於連線至服務的授權令牌。 注意:呼叫端必須確定授權令牌有效。 授權令牌到期之前,呼叫端必須使用新的有效令牌呼叫這個 setter 來重新整理它。 否則,辨識器會在辨識期間發生錯誤。

參數

  • token 表示授權令牌的字串。

GetAuthorizationToken

語法: public inline std::string GetAuthorizationToken ( );

取得授權令牌。

傳回

授權權杖

ApplyLanguageModels

語法: public inline bool ApplyLanguageModels ( const std::vector< std::shared_ptr< LanguageUnderstandingModel > > & collection );

採用語言理解模型的集合、製作它們的複本,並將其套用至辨識器。 根據語言理解模型類型,此應用程式會在不同的時間發生。 簡單語言模型幾乎會立即作用中,而使用 LUIS 的語言理解模型在下一個語音回合中將會變成作用中。 這會取代任何先前套用的模型。

參數

  • collection LanguageUnder understandingModels 共用指標的向量。

傳回

如果模型的應用程式立即生效,則為 True。 否則為 false。

FromConfig

語法: public inline static std::shared_ptr< IntentRecognizer > FromConfig ( std::shared_ptr< SpeechConfig > speechConfig , std::shared_ptr< Audio::AudioConfig > audioInput );

從語音設定和音訊組態建立意圖辨識器。用戶應該使用此函式來建立意圖辨識器的新實例。

參數

  • speechConfig 語音設定。

  • audioInput 音訊組態。

傳回

意圖辨識器的實例。

FromConfig

語法: public inline static std::shared_ptr< IntentRecognizer > FromConfig ( std::shared_ptr< EmbeddedSpeechConfig > speechConfig , std::shared_ptr< Audio::AudioConfig > audioInput );

從內嵌語音設定和音訊設定建立意圖辨識器。用戶應該使用此函式來建立意圖辨識器的新實例。 已在1.19.0版中新增。

參數

  • speechConfig 內嵌語音設定。

  • audioInput 音訊組態。

傳回

意圖辨識器的實例。

BaseType

語法: typedef BaseType;