本文整理汇总了C#中Choices.Append方法的典型用法代码示例。如果您正苦于以下问题:C# Choices.Append方法的具体用法?C# Choices.Append怎么用?C# Choices.Append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Choices
的用法示例。
在下文中一共展示了Choices.Append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getGrammar
public Grammar getGrammar()
{
Choices setChoices = new Choices("I'd like to set an alarm for", "Set alarm for", "Set Alarm Clock", "Set Alarm");
GrammarBuilder morningChoices = new Choices("am", "in the morning");
morningChoices.Append(new SemanticResultValue(true));
GrammarBuilder eveningChoices = new Choices("pm", "tonight", "at night");
eveningChoices.Append(new SemanticResultValue(false));
Choices amOrPm = new Choices(morningChoices, eveningChoices);
SemanticResultKey amOrPmKey = new SemanticResultKey("AmPm", amOrPm);
Choices hours = new Choices("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
Choices minutes = new Choices("10", "15", "20", "25", "30", "35", "40", "45", "50", "55", "60", "o'clock", " ");
GrammarBuilder thisGB = new GrammarBuilder();
thisGB.Append(setChoices);
thisGB.Append(new SemanticResultKey("Hours", hours));
thisGB.Append(new SemanticResultKey("Minutes", minutes));
thisGB.Append(amOrPmKey);
Grammar thisGrammar = new Grammar(thisGB);
// Set the Grammar name
thisGrammar.Name = _grammarName;
return thisGrammar;
}
示例2: InitGrammar
private void InitGrammar()
{
GrammarBuilder readGrammar = new Choices(new string[] { "read article" });
Choices articleChoice = new Choices();
for (int i = 1; i <= 30; i++)
{
articleChoice.Add(i.ToString());
}
readGrammar.Append(articleChoice);
GrammarBuilder saveGrammar = new Choices(new string[] { "save article" });
saveGrammar.Append(articleChoice);
GrammarBuilder otherGrammar = new Choices(new string[] { "receive hacker news", "stop", "test" });
//GrammarBuilder commands = new Choices(new string[] { "receive hacker news", "stop", "test" });
Choices commands = new Choices();
commands.Add(new Choices(new GrammarBuilder[] { readGrammar, saveGrammar, otherGrammar }));
var grammar = new Grammar(commands);
this._speechRecognizer.LoadGrammar(grammar);
}