private Grammar buildStartGrammar(ObjectLibrary lib) { this.prefix = "nao"; GrammarBuilder builder = new GrammarBuilder("nao"); Choices topLevel = new Choices(); topLevel.Add("identify known objects"); this.strings.Add("identify known objects"); topLevel.Add("learn unknown objects"); this.strings.Add("learn unknown objects"); string[] properties = lib.getProperties().ToArray(); if (properties.Length != 0) { GrammarBuilder propertyGrammar = new GrammarBuilder("find all"); propertyGrammar.Append(new Choices(properties)); propertyGrammar.Append("objects"); topLevel.Add(propertyGrammar); this.strings.Add("find all {" + toString(properties) + "} objects"); } string[] identifiers = lib.getIdentifiers().ToArray(); if (identifiers.Length != 0) { GrammarBuilder identifierGrammar = new GrammarBuilder("locate"); identifierGrammar.Append(new Choices(identifiers)); topLevel.Add(identifierGrammar); this.strings.Add("locate {" + toString(identifiers) + "}"); } builder.Append(topLevel); return new Grammar(builder); }