SubsetMatchingMode SubsetMatchingMode SubsetMatchingMode SubsetMatchingMode Enum

定义

枚举匹配模式的子集值。Enumerates values of subset matching mode.

public enum class SubsetMatchingMode
public enum SubsetMatchingMode
type SubsetMatchingMode = 
Public Enum SubsetMatchingMode
继承
SubsetMatchingModeSubsetMatchingModeSubsetMatchingModeSubsetMatchingMode

字段

OrderedSubset OrderedSubset OrderedSubset OrderedSubset 1

指示子集匹配模式是 OrderedSubset。Indicates that subset matching mode is OrderedSubset.

OrderedSubsetContentRequired OrderedSubsetContentRequired OrderedSubsetContentRequired OrderedSubsetContentRequired 3

指示子集匹配模式是 OrderedSubsetContentRequired。Indicates that subset matching mode is OrderedSubsetContentRequired.

Subsequence Subsequence Subsequence Subsequence 0

指示子集匹配模式是 Subsequence。Indicates that subset matching mode is Subsequence.

SubsequenceContentRequired SubsequenceContentRequired SubsequenceContentRequired SubsequenceContentRequired 2

指示子集匹配模式是 SubsequenceContentRequired。Indicates that subset matching mode is SubsequenceContentRequired.

示例

下面是一个测试例程, 它为Grammar每个SubsetMatchingModes使用相同的短语生成四个对象。Below is a test routine which generates four Grammar objects, using the same phrase, for each of the SubsetMatchingModes. 然后Grammar , 可以对这些对象进行测试。These Grammar objects can then be tested.

private void CreateSubsetMatchTest()   
{  
  foreach ( System.Speech.Recognition.SubsetMatchingMode mode   
              in Enum.GetValues(typeof(System.Speech.Recognition.SubsetMatchingMode)))  
  {  
    GrammarBuilder gb = new GrammarBuilder("a car the truck a boat that plane",mode);  
    Grammar grammar = new Grammar(gb);  
    grammar.Name = mode.ToString();  
    grammar.Enabled=true;  
    _recognizer.LoadGrammar(grammar);  
  }  
}  

注解

在系统中, 可以构造一个成功识别某个短语的语法, 即使在音频输入中仅找到其内容的一个子集。In System.Speech, you can construct a grammar that successfully recognizes a phrase even though only a subset of its contents is found in the audio input.

默认情况下, 识别引擎要求与整个短语完全匹配。By default, a recognition engine requires an exact match against an entire phrase. 识别引擎SubsetMatchingMode还可以根据用作GrammarBuilderSrgsSubset构造函数的参数或方法的Append成员定义的参数匹配部分短语。The recognition engine can also match partial phrases according to parameters defined by a SubsetMatchingMode member used as an argument to the GrammarBuilder or SrgsSubset constructors, or the Append method.

下面说明了每个SubsetMatchingMode成员在包含短语 "汽车卡车 a 船 a 船" 的语法中使用时如何影响识别。The following illustrates how each of the SubsetMatchingMode members affects recognition when used in a grammar that contains the phrase "a car the truck a boat that plane".

OrderedSubsetOrderedSubset

此模式表明, 如果满足以下条件, 则将使用短语的子集来成功识别整个短语:This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:

  • 在音频输入中识别该短语中的一个或多个词。One or more words in the phrase are recognized in the audio input.

  • 这些被识别的单词的相对顺序与短语中的相对顺序相同。The relative order of those recognized words is the same as in the phrase.

  • 匹配的单词可能仅由介词和文章构成。Matched words may consist of only prepositions and articles.

使用 OrderedSubset 模式向语法添加短语 "汽车汽车卡车 a 船 a 船", 将在识别时生成以下结果:Adding the phrase "a car the truck a boat that plane" to a grammar using OrderedSubset mode produces the following result on recognition:

输入短语Input Phrase 结果Result
"汽车卡车成为飞机的船""a car the truck a boat that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"汽车卡车成为船形""a car the truck a boat" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"该平面的汽车""a car the that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized. 可识别的子集不需要是原始字符串的序列。A recognized subset is not required to be a sequence of the original string.
"汽车船成为飞机"a car the boat a truck that plane" 识别不成功。Recognition is not successful. 字词顺序不对。The words are out of order.
"a""a the" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized. 介词和文章用于识别。Prepositions and articles are used for recognition.

OrderedSubsetContentRequiredOrderedSubsetContentRequired

此模式表明, 如果满足以下条件, 则将使用短语的子集来成功识别整个短语:This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:

  • 在音频输入中识别该短语中的一个或多个词, 并One or more words in the phrase are recognized in the audio input, and

  • 这些被识别的单词的相对顺序与短语中的相对顺序相同。The relative order of those recognized words is the same as in the phrase.

  • 匹配的单词不能仅包含介词和文章。Matched words cannot consist of only prepositions and articles.

使用 OrderedSubsetContentRequired 模式向语法添加短语 "汽车汽车卡车 a 船 a 船", 将在识别时生成以下结果:Adding the phrase "a car the truck a boat that plane" to a grammar using OrderedSubsetContentRequired mode produces the following result on recognition:

输入短语Input Phrase 结果Result
"汽车卡车成为飞机的船""a car the truck a boat that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"汽车卡车成为船形""a car the truck a boat" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"该平面的汽车""a car the that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized. 可识别的子集不需要是原始字符串的序列。A recognized subset is not required to be a sequence of the original string.
"汽车船成为飞机"a car the boat a truck that plane" 识别不成功。Recognition is not successful. 字词顺序不对。The words are out of order.
"a""a the" 识别不成功。Recognition is not successful. 语音输入必须包含项目和介词以外的单词。Speech input must contain words other than articles and prepositions.

子序列Subsequence:

此模式表明, 如果满足以下条件, 则将使用短语的子集来成功识别整个短语:This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:

  • 该短语中的一个或多个词在音频输入中被识别为一系列短语,One or more words in the phrase are recognized in the audio input as a sequence of the phrase, and

  • 这些被识别的单词的相对顺序与短语中的相对顺序相同。The relative order of those recognized words is the same as in the phrase.

  • 匹配的单词可能仅由介词和文章构成。Matched words may consist of only prepositions and articles.

使用子序列模式向语法添加短语 "汽车汽车卡车 a 船 a 船", 将在识别时生成以下结果:Adding the phrase "a car the truck a boat that plane" to a grammar using Subsequence mode produces the following result on recognition:

输入短语Input Phrase 结果Result
"汽车卡车成为飞机的船""a car the truck a boat that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"汽车卡车成为船形""a car the truck a boat" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"该平面的汽车""a car the that plane" 识别不成功。Recognition is not successful. 已识别子集必须是原始字符串的序列。A recognized subset is required to be a sequence of the original string.
"汽车船成为飞机"a car the boat a truck that plane" 识别不成功。Recognition is not successful. 字词顺序不对。The words are out of order.
"a""a the" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized. 介词和文章用于识别。Prepositions and articles are used for recognition.

SubsequenceContentRequiredSubsequenceContentRequired

此模式表明, 如果满足以下条件, 则将使用短语的子集来成功识别整个短语:This mode indicates that a subset of the phrase will be used to successfully recognize the entire phrase if the following are true:

  • 匹配字符串中的一个或多个词在音频输入中被识别为一系列短语。One or more words in the match string are recognized in the audio input as a sequence of the phrase.

  • 匹配的单词不能仅包含介词和文章。Matched words cannot consist of only prepositions and articles.

使用 SubsequenceContentRequired 模式向语法添加短语 "汽车汽车卡车 a 船 a 船", 将在识别时生成以下结果:Adding the phrase "a car the truck a boat that plane" to a grammar using SubsequenceContentRequired mode produces the following result on recognition:

输入短语Input Phrase 结果Result
"汽车卡车成为飞机的船""a car the truck a boat that plane" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"汽车卡车成为船形""a car the truck a boat" 识别整个短语 "汽车卡车成为飞机的船"。The entire phrase "a car the truck a boat that plane" is recognized.
"该平面的汽车""a car the that plane" 识别不成功。Recognition is not successful. 已识别子集必须是原始字符串的序列。A recognized subset is required to be a sequence of the original string.
"汽车船成为飞机"a car the boat a truck that plane" 识别不成功。Recognition is not successful. 字词顺序不对。The words are out of order.
"a""a the" 识别不成功。Recognition is not successful. 语音输入必须包含项目和介词以外的单词。Speech input must contain words other than articles and prepositions.

适用于

另请参阅