locked
Unable to capture the wild card(Garbage) word in speech recognition using SRGS namepsace C# RRS feed

  • Question

  • I am a developing a C#.net application using speech recognition grammar specification (SRGS) namespace. I like to capture the wild card word. I have seen some examples where wild card word is captured using GrammarBuilder, But I am using SRGS namespace. I could not find any way to capture using this SRGS namespace.

    I have written the below code to capture wildcard word. Below code should recognize phrases like " Execute report call statistics for E080755 event number:

    SrgsOneOf reportsList = new SrgsOneOf(); reportsList.Add(new SrgsItem("Call Statistics"));

    SrgsRule reportName = new SrgsRule("ReportName");
            reportName.Add(reportsList);
            reportName.Scope = SrgsRuleScope.Public;
    
            SrgsRule executeReportRule = new SrgsRule("ExecuteReport");
            SrgsItem executeReportWord = new SrgsItem("Execute report");
            executeReportRule.Scope = SrgsRuleScope.Public;
    
            SrgsItem forWord = new SrgsItem("for");
            SrgsRule wildCardRule = new SrgsRule("WildCardRule");
            wildCardRule.Scope = SrgsRuleScope.Public;
    
    
            wildCardRule.Add(SrgsRuleRef.Garbage);
            SrgsRuleRef wildCardRuleref = new SrgsRuleRef(wildCardRule, "WildCardWord");
    
            SrgsItem eventNumberWord = new SrgsItem("event number");
    
    
    
            executeReportRule.Add(executeReportWord);
            executeReportRule.Add(new SrgsRuleRef(reportName, "ReportName"));
            executeReportRule.Add(forWord);
            executeReportRule.Add(wildCardRuleref);
            executeReportRule.Add(eventNumberWord);
    
            SrgsDocument document = new SrgsDocument();
            document.Rules.Add(new SrgsRule[] { reportName, executeReportRule, wildCardRule });
    
            document.Root = executeReportRule;
    
            Grammar grammar = new Grammar(document, "ExecuteReport");
    
            // Write the completed grammar to an XML-format SRGS grammar file.
            System.Xml.XmlWriter writer =
              System.Xml.XmlWriter.Create("c:\\Temp\\EventNumberGrammar.grxml");
            document.WriteSrgs(writer);
    
            writer.Close();

    Tried to capture wild card word using "WildCardWord" semanti key . but i could get only "..." instead of original spoken word.

    Thanks, Vamshi Epuri

    Tuesday, October 18, 2016 9:09 AM