当前位置: 首页>>代码示例>>C#>>正文


C# Choices.Append方法代码示例

本文整理汇总了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;
 }
开发者ID:EquinoxSoftware,项目名称:Alfred,代码行数:21,代码来源:AlarmClock.cs

示例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);
        }
开发者ID:srw,项目名称:hacker-news-voice-browsing-dotnet-sample,代码行数:22,代码来源:MainForm.cs


注:本文中的Choices.Append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。