本文整理匯總了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);
}