GrammarBuilder.DebugShowPhrases 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个字符串,此字符串显示 GrammarBuilder 包含的语法的内容和结构。
public:
property System::String ^ DebugShowPhrases { System::String ^ get(); };
public string DebugShowPhrases { get; }
member this.DebugShowPhrases : string
Public ReadOnly Property DebugShowPhrases As String
属性值
当前内容和结构 GrammarBuilder 的。
示例
以下示例创建一个语音识别语法,用于订购最多四个配料的披萨。 在创建语法之前,它会将 的状态 GrammarBuilder 写入控制台。 此方法生成以下输出:
GrammarBuilder status: I would like a [cheese,mushroom,tomato,onion,anchovy,chic ken,pepperoni] and [cheese,mushroom,tomato,onion,anchovy,chicken,pepperoni] pizza
private static Grammar CreatePizzaGrammar()
{
// Create a Choices object with alternatives for toppings.
Choices toppings = new Choices(new string[] {
"cheese", "mushroom", "tomato", "onion",
"anchovy", "chicken", "pepperoni"});
// Create a GrammarBuilder and append the Choices object.
GrammarBuilder andToppings = new GrammarBuilder("and", 0, 1);
andToppings.Append(toppings);
// Construct the phrase.
GrammarBuilder gb = new GrammarBuilder("I would like a", 0, 1);
gb.Append(toppings);
gb.Append(new GrammarBuilder(andToppings, 0, 3));
gb.Append("pizza");
// Write the contents and structure of the GrammarBuilder to the console.
Console.WriteLine("Grammar content and structure: {0}", gb.DebugShowPhrases);
// Create the Grammar from the GrammarBuilder.
Grammar grammar = new Grammar(gb);
grammar.Name = "Pizza Order";
return grammar;
}