public GrammarBuilder(SemanticResultValue value) : this() { Append(value); }
public void Append(SemanticResultValue value) { Helpers.ThrowIfNull(value, "builder"); AddItem(value.Tag); }
public sp.Grammar UpdateGrammar() { bool atLeastOnePhrase = false; sp.Choices choices = new sp.Choices(); foreach (Action action in this.Actions) { foreach (string phrase in action.Phrases) { sp.SemanticResultValue temp = new sp.SemanticResultValue(phrase, action.ActionName); choices.Add(temp); atLeastOnePhrase = true; } } if (atLeastOnePhrase) { sp.GrammarBuilder builder = new sp.GrammarBuilder(); builder.Append(new sp.SemanticResultKey("command", choices)); this.Grammar = new sp.Grammar(builder); this.Grammar.Name = this.ProfileName; return this.Grammar; } else return null; }
private sp.Grammar GeneratePauseGrammar() { sp.Choices choices = new sp.Choices(); foreach (string pausePhrase in this.currentProfile.PauseRecognitionPhrases) { sp.SemanticResultValue temp = new sp.SemanticResultValue(pausePhrase, "PauseVoiceRecognitionCommand"); choices.Add(temp); } foreach (string unpausePhrase in this.currentProfile.UnpauseRecognitionPhrases) { sp.SemanticResultValue temp = new sp.SemanticResultValue(unpausePhrase, "UnpauseVoiceRecognitionCommand"); choices.Add(temp); } sp.GrammarBuilder builder = new sp.GrammarBuilder(); builder.Append(new sp.SemanticResultKey("command", choices)); sp.Grammar grammar = new sp.Grammar(builder); grammar.Name = "PauseCommands"; return grammar; }
public sp.Grammar UpdateGrammar() { sp.GrammarBuilder commands = new sp.GrammarBuilder(); sp.Choices choices = new sp.Choices(); foreach (Action action in this.Actions) { foreach (string phrase in action.Phrases) { sp.SemanticResultValue temp = new sp.SemanticResultValue(phrase, action.ActionName); choices.Add(temp); commands.Append(temp); } } commands.Append(choices); sp.GrammarBuilder builder = new sp.GrammarBuilder(); builder.Append(new sp.SemanticResultKey("command", choices)); this.Grammar = new sp.Grammar(builder); this.Grammar.Name = this.ProfileName; return this.Grammar; }