共用方式為


SpeechRecognitionTopicConstraint 類別

定義

預先定義的文法條件約束 (由 SpeechRecognitionScenario) 透過 Web 服務提供。

public ref class SpeechRecognitionTopicConstraint sealed
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class SpeechRecognitionTopicConstraint final
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class SpeechRecognitionTopicConstraint final
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class SpeechRecognitionTopicConstraint
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Media.SpeechRecognition.ISpeechRecognitionTopicConstraintFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class SpeechRecognitionTopicConstraint
function SpeechRecognitionTopicConstraint(scenario, topicHint, tag)
Public NotInheritable Class SpeechRecognitionTopicConstraint
繼承
Object Platform::Object IInspectable SpeechRecognitionTopicConstraint
屬性
實作

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

限制式或文法定義可與語音辨識器相符的口說字詞和片語。

您可以指定其中一個預先定義的 Web 服務文法,也可以建立自己的自訂文法 (請參閱SpeechRecognitionGrammarFileConstraint、SpeechRecognitionListConstraintSpeechRecognitionVoiceCommandDefinitionConstraint) 隨您的應用程式一起安裝。

即使Constraints屬性中未指定任何條件約束,CompileConstraintsAsync也必須在RecognizeAsyncRecognizeWithUIAsync之前呼叫。

若要使用 Web 服務條件約束,必須在 [ 設定 ] 中啟用語音輸入和聽寫支援,方法是在 [設定 - > 隱私權 - > 語音]、筆跡和輸入中開啟 [瞭解我] 選項。 For more detail on recognition constraints, see "Recognize speech input" in Speech recognition.

注意

使用 SpeechRecognitionListConstraint 搭配 SpeechRecognitionTopicConstraint ,在冗長的聽寫會話期間提高辨識精確度。 這可讓您提供一組您認為在聽寫期間可能會使用的網域特定關鍵字。

建構函式

SpeechRecognitionTopicConstraint(SpeechRecognitionScenario, String)

使用預先定義的案例類型和內容,建立 SpeechRecognitionTopicConstraint 類別的實例。

SpeechRecognitionTopicConstraint(SpeechRecognitionScenario, String, String)

使用預先定義的案例類型、內容和識別碼,建立 SpeechRecognitionTopicConstraint 類別的實例。

屬性

IsEnabled

取得或設定 SpeechRecognizer 物件是否可以使用條件約束來執行辨識。

Probability

取得或設定條件約束的加權值。

Scenario

取得條件約束的預先定義案例類型。

Tag

取得或設定可用於識別條件約束的標記。

TopicHint

取得條件約束的主題提示。

Type

取得條件約束的類型。

適用於

另請參閱