Ejemplo n.º 1
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_JSGF()
        {
            if (currentCMUSphinxDoc != null) return currentCMUSphinxDoc;
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();

            StringBuilder bld = new StringBuilder();
            ret.JSGFRuleStart("<ISAWAKE>", bld);
            ret.JSGFRuleAddChoicesStart(bld, new List<string>(new string[] { "i'm awake", "turn off the alarm", "i am awake" }));
            ret.JSGFRuleAddChoicesEnd(bld);
            ret.JSGFRuleEnd("<ISAWAKE>", bld);

            ret.JSGFRuleStart("<ROOT>", bld);
            ret.JSGFRuleAddToken(bld, "Holly");
            ret.JSGFRuleAddToken(bld, "<ISAWAKE>");
            ret.JSGFRuleAddToken(bld, "please");
            ret.JSGFRuleEnd("<ROOT>", bld);

            ret.JSGFSetRootRule("<ROOT>");

            ret.BuildJSGFGrammarAndDict();

            currentCMUSphinxDoc = ret;
            return ret;
        }
Ejemplo n.º 2
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_FSG()
        {
            if (currentCMUSphinxDoc != null) return currentCMUSphinxDoc;
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();

            CMUSphinx_FSGState root = ret.FSGCreate(ret.GrammarName);
            CMUSphinx_FSGState s;// = ret.FSGTransitionToNewState(root, "Holly i'm awake");
            //ret.FSGGroupStates(s, ret.FSGGetEndState());
            s = ret.FSGTransitionToNewState(root, "Holly i am awake");
            ret.FSGGroupStates(s, ret.FSGGetEndState());
            s = ret.FSGTransitionToNewState(root, "Holly turn off the alarm please");
            ret.FSGGroupStates(s, ret.FSGGetEndState());

            ret.BuildFSGGrammarAndDict();

            currentCMUSphinxDoc = ret;
            return ret;
        }
Ejemplo n.º 3
0
        string JSGFActionsFromCapabilities(DeviceCapabilities caps, CMUSphinx_GrammarDict cgd)
        {
            string capsName = "<caps_" + caps.CapsAsIntString + ">";
            if (caps_rules_jsgf.Keys.Contains(caps.Caps))
            {
                return caps_rules_jsgf[caps.Caps];
            }
            else
            {
                StringBuilder b = new StringBuilder();

                cgd.JSGFRuleStart(capsName, b);

                List<string> capsAsString = caps.Actions;
                if (capsAsString == null || capsAsString.Count == 0)
                {
                    cgd.JSGFRuleCancel(capsName, b);
                    return null;
                }
                cgd.JSGFRuleAddChoicesStart(b, capsAsString);
                cgd.JSGFRuleAddChoicesEnd(b);
                cgd.JSGFRuleEnd(capsName, b);

                caps_rules_jsgf.Add(caps.Caps, capsName);
            }
            //return new SrgsRuleRef(r, "action");
            return capsName;
        }
Ejemplo n.º 4
0
 bool FSGActionsFromCapabilities(DeviceCapabilities caps, CMUSphinx_GrammarDict cgd, 
     ref CMUSphinx_FSGState startState, ref CMUSphinx_FSGState endState)
 {
     string capsName = "<caps_" + caps.CapsAsIntString + ">";
     if (caps_rules_fsg.Keys.Contains(caps.Caps))
     {
         startState = caps_rules_fsg[caps.Caps].Item1;
         endState = caps_rules_fsg[caps.Caps].Item2;
         return true;
     }
     List<string> capsAsString = caps.Actions;
     if (capsAsString == null || capsAsString.Count == 0)
     {
         startState = null;
         endState = null;
         return false;
     }
     CMUSphinx_FSGState start = cgd.FSGCreateOrphanState();
     CMUSphinx_FSGState end = cgd.FSGCreateOrphanState();
     foreach (string s in capsAsString)
     {
         cgd.FSGLinkStates(start, end, s);
     }
     caps_rules_fsg.Add(caps.Caps, new Tuple<CMUSphinx_FSGState,CMUSphinx_FSGState>(start, end));
     startState = start;
     endState = end;
     //return new SrgsRuleRef(r, "action");
     return true;
 }
Ejemplo n.º 5
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_JSGF()
        {
            if (currentCMUDoc != null) return currentCMUDoc;
            caps_rules_jsgf = new Dictionary<EDeviceCapabilities, string>();
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();
            StringBuilder bld = new StringBuilder();
            StringBuilder actionItemLocs = new StringBuilder();

            ret.JSGFRuleStart("<ACTIONITEMLOCS>", actionItemLocs);
            List<string> actionItemLocation_choices = new List<string>();
            foreach (Room rm in ListRooms())
            {
                if (rm.Name == "") continue;
                Dictionary<string, string> actionsPerDevice = new Dictionary<string, string>();
                foreach (Device d in rm.ListDevices())
                {
                    string caps_ruleref = JSGFActionsFromCapabilities(d.Capabilities, ret);
                    if (caps_ruleref == null) continue;
                    string cl = SoundsLike.Get(d.Class, false);
                    if (cl != "" && !actionsPerDevice.ContainsKey(cl))
                    {
                        actionsPerDevice.Add(cl, caps_ruleref);
                    }
                    if (d.FriendlyName != "")
                    {
                        if (!actionsPerDevice.ContainsKey(d.FriendlyName))
                            actionsPerDevice.Add(d.FriendlyName, caps_ruleref);
                    }
                }
                //actionsperdevice.Value + actionsperdevice.Key+room
                if (actionsPerDevice.Count == 0) continue; //nothing in the room
                StringBuilder bld_ail_gb = new StringBuilder();
                string name_ail_gb = "<"+AudioRecog_SAPI.SrgsCleanupID(rm.Name + "__ail")+">";
                ret.JSGFRuleStart(name_ail_gb, bld_ail_gb);

                List<string> action_items = new List<string>();
                bool action_items_valid = false;
                foreach (string item in actionsPerDevice.Keys)
                {
                    if (item == "") continue;
                    StringBuilder bld_ai_gb = new StringBuilder();
                    string name_ai_gb = "<" + AudioRecog_SAPI.SrgsCleanupID(rm.Name + "_" + item) + ">";

                    ret.JSGFRuleStart(name_ai_gb, bld_ai_gb);
                    ret.JSGFRuleAddToken(bld_ai_gb, actionsPerDevice[item]);
                    ret.JSGFRuleAddToken(bld_ai_gb, item);
                    ret.JSGFRuleEnd(name_ai_gb, bld_ai_gb);

                    action_items.Add(name_ai_gb);
                    action_items_valid = true;
                }
                if (!action_items_valid)
                {
                    ret.JSGFRuleCancel(name_ail_gb, bld_ail_gb);
                    continue;
                }
                ret.JSGFRuleAddChoicesStart(bld_ail_gb, action_items);
                ret.JSGFRuleAddChoicesEnd(bld_ail_gb);
                if (rm != CurrentLocation)
                {
                    ret.JSGFRuleAddToken(bld_ail_gb, "in the " + rm.Name);
                    ret.JSGFRuleUnaryOp(bld_ail_gb, true, false);
                }
                else
                {
                    ret.JSGFRuleAddChoicesStart(bld_ail_gb, new List<string>(new string[] { "in the " + rm.Name, "here" }));
                    ret.JSGFRuleAddChoicesEnd(bld_ail_gb);
                    ret.JSGFRuleUnaryOp(bld_ail_gb, true, false);
                }
                ret.JSGFRuleEnd(name_ail_gb, bld_ail_gb);
                actionItemLocation_choices.Add(name_ail_gb);
            }
            ret.JSGFRuleAddChoicesStart(actionItemLocs, actionItemLocation_choices);
            ret.JSGFRuleAddChoicesEnd(actionItemLocs);
            ret.JSGFRuleEnd("<ACTIONITEMLOCS>", actionItemLocs);

            ret.JSGFRuleStart("<ROOT>", bld);
            ret.JSGFRuleAddToken(bld, "Holly");
            ret.JSGFRuleAddToken(bld, "<ACTIONITEMLOCS>");
            ret.JSGFRuleAddToken(bld, "please");
            ret.JSGFRuleEnd("<ROOT>", bld);

            ret.JSGFSetRootRule("<ROOT>");

            ret.BuildJSGFGrammarAndDict();

            currentCMUDoc = ret;
            return ret;
        }
Ejemplo n.º 6
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_FSG()
        {
            if (currentCMUDoc != null) return currentCMUDoc;
            caps_rules_fsg = new Dictionary<EDeviceCapabilities,Tuple<CMUSphinx_FSGState,CMUSphinx_FSGState>>();
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();

            CMUSphinx_FSGState root = ret.FSGCreate(GetName());
            CMUSphinx_FSGState holly = ret.FSGTransitionToNewState(root, "Holly");
            // HOLLY <ACTION> (<DEVICECLASS> [(<ROOM> | HERE)] | <DEVICENAME> ) PLEASE

            //only add to this list if the action only has a single output, "Please"
            CMUSphinx_FSGState preSinglePlease = ret.FSGCreateOrphanState();
            CMUSphinx_FSGState postSinglePlease = ret.FSGCreateOrphanState();
            ret.FSGLinkStates(preSinglePlease, postSinglePlease, "please");
            foreach (Room rm in ListRooms())
            {
                if (rm.Name == "") continue;
                CMUSphinx_FSGState actionDevicePreRoom = null;

                foreach (Device d in rm.ListDevices())
                {
                    CMUSphinx_FSGState startAction = null, endAction = null;
                    bool caps_valid = FSGActionsFromCapabilities(d.Capabilities, ret, ref startAction, ref endAction);
                    if (!caps_valid) continue;
                    ret.FSGGroupStates(holly, startAction); //Action immediately follows Holly
                    string cl = SoundsLike.Get(d.Class, false);
                    if (cl != "")
                    {
                        if(actionDevicePreRoom == null)
                            actionDevicePreRoom = ret.FSGCreateOrphanState();
                        ret.FSGLinkStates(startAction, actionDevicePreRoom, cl);
                    }
                    if (d.FriendlyName != "")
                    {
                        ret.FSGLinkStates(endAction, preSinglePlease, d.FriendlyName);
                    }
                }
                if (actionDevicePreRoom == null) continue; //no device classes in room

                if (rm != CurrentLocation)
                {
                    ret.FSGLinkStates(actionDevicePreRoom, preSinglePlease, "in the "+rm.Name);
                }
                else
                {
                    ret.FSGLinkStates(actionDevicePreRoom, preSinglePlease, "in the " + rm.Name);
                    ret.FSGLinkStates(actionDevicePreRoom, preSinglePlease, "here");
                }
                ret.FSGLinkStates(actionDevicePreRoom, postSinglePlease, "please");
            }
            ret.FSGGroupStates(ret.FSGGetEndState(), postSinglePlease);

            ret.BuildFSGGrammarAndDict();

            currentCMUDoc = ret;
            return ret;
        }
Ejemplo n.º 7
0
 bool AddGrammar(string name, CMUSphinx_GrammarDict cgd)
 {
     if (cgd == null || !cgd.DictIsValid || !cgd.GrammarIsValid) return false;
     return mSphinx.AddGrammar(name, cgd.GrammarType, cgd.Grammar, cgd.Dict);
 }
Ejemplo n.º 8
0
        bool CreateNumberJSGF(string rulename, CMUSphinx_GrammarDict cgd)
        {
            List<string> digit_single = new List<string>();
            digit_single.Add("one");
            digit_single.Add("two");
            digit_single.Add("three");
            digit_single.Add("four");
            digit_single.Add("five");
            digit_single.Add("six");
            digit_single.Add("seven");
            digit_single.Add("eight");
            digit_single.Add("nine");

            List<string> digit_tens = new List<string>();
            digit_tens.Add("twenty");
            digit_tens.Add("thirty");
            digit_tens.Add("fourty");
            digit_tens.Add("fifty");
            digit_tens.Add("sixty");

            List<string> digit_special = new List<string>();
            digit_special.Add("zero");
            digit_special.Add("ten");
            digit_special.Add("eleven");
            digit_special.Add("twelve");
            digit_special.Add("thirteen");
            digit_special.Add("fourteen");
            digit_special.Add("fifteen");
            digit_special.Add("sixteen");
            digit_special.Add("seventeen");
            digit_special.Add("eighteen");
            digit_special.Add("nineteen");

            StringBuilder bld_twodigit = new StringBuilder();
            cgd.JSGFRuleStart("<"+rulename+"_twodigit>", bld_twodigit);
            cgd.JSGFRuleAddChoicesStart(bld_twodigit, digit_tens);
            cgd.JSGFRuleAddChoicesEnd(bld_twodigit);
            cgd.JSGFRuleAddChoicesStart(bld_twodigit, digit_single);
            cgd.JSGFRuleAddChoicesEnd(bld_twodigit);
            cgd.JSGFRuleEnd("<"+rulename + "_twodigit>", bld_twodigit);

            StringBuilder bld_onedigit = new StringBuilder();
            cgd.JSGFRuleStart("<"+rulename + "_onedigit>", bld_onedigit);
            cgd.JSGFRuleAddChoicesStart(bld_onedigit, digit_single);
            cgd.JSGFRuleAddChoicesMore(bld_onedigit, digit_tens);
            cgd.JSGFRuleAddChoicesMore(bld_onedigit, digit_special);
            cgd.JSGFRuleAddChoicesEnd(bld_onedigit);
            cgd.JSGFRuleEnd("<"+rulename + "_onedigit>", bld_onedigit);

            StringBuilder bld = new StringBuilder();
            cgd.JSGFRuleStart("<"+rulename+">", bld);
            cgd.JSGFRuleAddChoicesStart(bld, new List<string>(new string[] { "<"+rulename + "_onedigit>", "<"+rulename + "_twodigit>" }));
            cgd.JSGFRuleAddChoicesEnd(bld);
            cgd.JSGFRuleEnd("<"+rulename+">", bld);

            return true;
        }
Ejemplo n.º 9
0
        CMUSphinx_FSGState CreateNumberFSG(CMUSphinx_FSGState startState, CMUSphinx_GrammarDict cgd)
        {
            CMUSphinx_FSGState start_special = cgd.FSGCreateOrphanState();
            CMUSphinx_FSGState start_digits = cgd.FSGCreateOrphanState();
            CMUSphinx_FSGState start_tens = cgd.FSGCreateOrphanState();
            CMUSphinx_FSGState end = cgd.FSGCreateOrphanState();
            CMUSphinx_FSGState end_tens = cgd.FSGCreateOrphanState();

            //fillers
            cgd.FSGLinkStates(startState, start_digits, "");
            cgd.FSGLinkStates(startState, start_special, "");
            cgd.FSGLinkStates(startState, start_tens, "");

            //digits
            cgd.FSGLinkStates(start_digits, end, "one");
            cgd.FSGLinkStates(start_digits, end, "two");
            cgd.FSGLinkStates(start_digits, end, "seven");
            //TODO

            //specials
            cgd.FSGLinkStates(start_special, end, "ten");
            cgd.FSGLinkStates(start_special, end, "eleven");
            cgd.FSGLinkStates(start_special, end, "twelve");
            //TODO: Finish these

            //tens
            cgd.FSGLinkStates(start_tens, end_tens, "twenty");
            cgd.FSGLinkStates(start_tens, end_tens, "thirty");
            //TODO: Finish the tens
            cgd.FSGLinkStates(end_tens, start_digits, "");
            cgd.FSGLinkStates(end_tens, end, "");

            return end;
        }
Ejemplo n.º 10
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_FSG()
        {
            if (currentJSGFDoc != null) return currentJSGFDoc;
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();

            CMUSphinx_FSGState root = ret.FSGCreate(ret.GrammarName);
            CMUSphinx_FSGState end = ret.FSGGetEndState();

            //numbers
            CMUSphinx_FSGState epNumsStart = ret.FSGCreateOrphanState();
            CMUSphinx_FSGState epNumsEnd = CreateNumberFSG(epNumsStart, ret);
            CMUSphinx_FSGState seasonNumsStart = ret.FSGCreateOrphanState();
            CMUSphinx_FSGState seasonNumsEnd = CreateNumberFSG(seasonNumsStart, ret);

            //TV Shows
            if (mTVShows == null)
            {
                mTVShows = ListTVShows();
            }
            if (mTVShows == null) return null;
            List<string> tvShowNames = new List<string>();
            foreach (XBMCProto.TVShow s in mTVShows)
            {
                string temps = CleanString(s.label);
                temps = temps.Trim();
                if (temps == "" || s.tvshowid < 1) continue;
                tvShowNames.Add(temps);
            }

            CMUSphinx_FSGState play = ret.FSGTransitionToNewState(root, "Holly play show");
            CMUSphinx_FSGState temp1 = ret.FSGTransitionToNewState(root, "Holly resume show");
            ret.FSGGroupStates(play, temp1);
            temp1 = ret.FSGCreateOrphanState();
            CMUSphinx_FSGState temp2;
            foreach (string s in tvShowNames)
            {
                temp2 = ret.FSGTransitionToNewState(play, s);
                ret.FSGGroupStates(temp1, temp2);
            }
            temp1 = ret.FSGTransitionToNewState(temp1, "season");
            temp1 = CreateNumberFSG(temp1, ret);
            temp1 = ret.FSGTransitionToNewState(temp1, "episode");
            temp1 = CreateNumberFSG(temp1, ret);
            temp1 = ret.FSGTransitionToNewState(temp1, "please");
            ret.FSGGroupStates(end, temp1);

            //Movies
            if (mMovies == null)
            {
                mMovies = ListMovies();
            }
            if (mMovies == null) return null;
            List<string> movieNames = new List<string>();
            foreach (XBMCProto.Movie m in mMovies)
            {
                string temps = CleanString(m.label);
                temps = temps.Trim();
                if (temps == "" || m.movieid < 1) continue;
                movieNames.Add(temps);
            }

            play = ret.FSGTransitionToNewState(root, "Holly play movie");
            temp1 = ret.FSGTransitionToNewState(root, "Holly resume movie");
            ret.FSGGroupStates(play, temp1);
            temp1 = ret.FSGCreateOrphanState();
            foreach (string s in movieNames)
            {
                temp2 = ret.FSGTransitionToNewState(play, s);
                ret.FSGGroupStates(temp1, temp2);
            }
            temp1 = ret.FSGTransitionToNewState(temp1, "please");
            ret.FSGGroupStates(end, temp1);

            //Music Genres
            SrgsOneOf audioGenres = new SrgsOneOf();
            if (mGenres == null)
            {
                mGenres = ListAudioGenres();
            }
            if (mGenres == null) return null;
            List<string> genreNames = new List<string>();
            foreach (XBMCProto.Genre m in mGenres)
            {
                string temps = CleanString(m.label);
                temps = temps.Trim();
                if (temps == "" || m.genreid < 1) continue;
                genreNames.Add(temps);
            }

            play = ret.FSGTransitionToNewState(root, "Holly play me some");
            temp1 = ret.FSGCreateOrphanState();
            foreach (string s in movieNames)
            {
                temp2 = ret.FSGTransitionToNewState(play, s);
                ret.FSGGroupStates(temp1, temp2);
            }
            temp1 = ret.FSGTransitionToNewState(temp1, "music please");
            ret.FSGGroupStates(end, temp1);

            //Other
            play = ret.FSGTransitionToNewState(root, "Holly stop media please");
            ret.FSGGroupStates(end, play);
            play = ret.FSGTransitionToNewState(root, "Holly pause media please");
            ret.FSGGroupStates(end, play);
            play = ret.FSGTransitionToNewState(root, "Holly resume media please");
            ret.FSGGroupStates(end, play);

            ret.BuildFSGGrammarAndDict();
            currentJSGFDoc = ret;
            return ret;
        }
Ejemplo n.º 11
0
        public CMUSphinx_GrammarDict CreateGrammarDoc_JSGF()
        {
            if (currentJSGFDoc != null) return currentJSGFDoc;
            CMUSphinx_GrammarDict ret = new CMUSphinx_GrammarDict();
            ret.GrammarName = GetName();
            StringBuilder bld = new StringBuilder();

            List<string> ops = new List<string>();

            //numbers
            CreateNumberJSGF("NUMS", ret);

            //TV Shows
            if (mTVShows == null)
            {
                mTVShows = ListTVShows();
            }
            if (mTVShows == null) return null;
            List<string> tvShowNames = new List<string>();
            foreach (XBMCProto.TVShow s in mTVShows)
            {
                string temps = CleanString(s.label);
                temps = temps.Trim();
                if (temps == "" || s.tvshowid < 1) continue;
                tvShowNames.Add(temps);
            }

            string tvshow_name = "<TVSHOW>";
            StringBuilder tvshow_bld = new StringBuilder();
            ret.JSGFRuleStart(tvshow_name, tvshow_bld);
            ret.JSGFRuleAddChoicesStart(tvshow_bld, new List<string>(new string[]{ "play show", "resume show"}));
            ret.JSGFRuleAddChoicesEnd(tvshow_bld);
            ret.JSGFRuleAddChoicesStart(tvshow_bld, tvShowNames);
            ret.JSGFRuleAddChoicesEnd(tvshow_bld);
            ret.JSGFRuleAddToken(tvshow_bld, "SEASON");
            ret.JSGFRuleAddToken(tvshow_bld, "<NUMS>");
            ret.JSGFRuleAddToken(tvshow_bld, "EPISODE");
            ret.JSGFRuleAddToken(tvshow_bld, "<NUMS>");
            ret.JSGFRuleEnd(tvshow_name, tvshow_bld);

            ops.Add(tvshow_name);

            //Movies
            if (mMovies == null)
            {
                mMovies = ListMovies();
            }
            if (mMovies == null) return null;
            List<string> movieNames = new List<string>();
            foreach (XBMCProto.Movie m in mMovies)
            {
                string temps = CleanString(m.label);
                temps = temps.Trim();
                if (temps == "" || m.movieid < 1) continue;
                movieNames.Add(temps);
            }

            string movie_name = "<MOVIE>";
            StringBuilder movie_bld = new StringBuilder();
            ret.JSGFRuleStart(movie_name, movie_bld);
            ret.JSGFRuleAddChoicesStart(movie_bld, new List<string>(new string[] { "play movie", "resume movie" }));
            ret.JSGFRuleAddChoicesEnd(movie_bld);
            ret.JSGFRuleAddChoicesStart(movie_bld, movieNames);
            ret.JSGFRuleAddChoicesEnd(movie_bld);
            ret.JSGFRuleEnd(movie_name, movie_bld);

            ops.Add(movie_name);

            //Music Genres
            SrgsOneOf audioGenres = new SrgsOneOf();
            if (mGenres == null)
            {
                mGenres = ListAudioGenres();
            }
            if (mGenres == null) return null;
            List<string> genreNames = new List<string>();
            foreach (XBMCProto.Genre m in mGenres)
            {
                string temps = CleanString(m.label);
                temps = temps.Trim();
                if (temps == "" || m.genreid < 1) continue;
                genreNames.Add(temps + " music");
            }

            string audiogenre_name = "<AUDIOGENRE>";
            StringBuilder audiogenre_bld = new StringBuilder();
            ret.JSGFRuleStart(audiogenre_name, audiogenre_bld);
            ret.JSGFRuleAddToken(audiogenre_bld, "play me some");
            ret.JSGFRuleAddChoicesStart(audiogenre_bld, genreNames);
            ret.JSGFRuleAddChoicesEnd(audiogenre_bld);
            ret.JSGFRuleEnd(audiogenre_name, audiogenre_bld);

            ops.Add(audiogenre_name);

            //Other
            ops.Add("stop media");
            ops.Add("pause media");
            ops.Add("resume media");

            StringBuilder bld_ops= new StringBuilder();
            ret.JSGFRuleStart("<OPS>", bld_ops);
            ret.JSGFRuleAddChoicesStart(bld_ops, ops);
            ret.JSGFRuleAddChoicesEnd(bld_ops);
            ret.JSGFRuleEnd("<OPS>", bld_ops);

            ret.JSGFRuleStart("<ROOT>", bld);
            ret.JSGFRuleAddToken(bld, "Holly");
            ret.JSGFRuleAddToken(bld, "<OPS>");
            ret.JSGFRuleAddToken(bld, "please");
            ret.JSGFRuleEnd("<ROOT>", bld);

            ret.JSGFSetRootRule("<ROOT>");

            ret.BuildJSGFGrammarAndDict();
            currentJSGFDoc = ret;
            return ret;
        }