Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Speech SDK 5.1 Grammar Problem

Posted on 2005-03-22
Medium Priority
Last Modified: 2008-01-09

I am new to speech technologies and trying to develop a calculator application with speech recognition with c#.
As for now i encountered two major problems which i couldn't overcome.

The first one is while writing an xml grammar for the speech api i couldn't add recursive context free grammar rules to the grammar. Every time i added such a rule and compiled the grammar file i received compilation error because of circular referencing. Is there a way to implement recursive CFG grammars.The recursive part of my grammar is like :

<RULE ID = "OperationExpr">
      <RULEREF REFID="Operation"/>
      <RULEREF REFID="Operators"/>
      <RULEREF REFID="Operation"/>
<RULE ID = "Operation">
            <L PROPID="Operation_Value">
                  <RULEREF REFID="OperationExpr"/>
                  <RULEREF REFID="NUMBER"/>

The second problem is about accessing values of recognized phrases.
For example in the code when defining two child phrases like

<P DISP="1">one</P>
<P DISP="2">two</P>

is there a way to make the grammar such that i can add the return values of these two phrases and make the speech engine return me "3" as recognized phrase. I need to implement this function in the xml grammar not as a program functionality in c#

Question by:ozencozturk

Accepted Solution

thedude112286 earned 1000 total points
ID: 13606182
I don't think you can have the kind of recursion that you're looking for.  Instead, I would define opperations like +, -, /, * and define numbers but don't include operationExpr in operation.  Then, define OperationExpr to contain operator-number sequences of arbitrary length.

For the return values, can't you just change the disp value?

Author Comment

ID: 13611497
>> Then, define OperationExpr to contain operator-number sequences of arbitrary length.
     Can you explain how I can do this for arbitrary length sequences without recursion?

>>For the return values, can't you just change the disp value?
    Basically what I am trying to do is to develop a grammar for recognizing numbers. (I couldn't find some structure in SAPI that recognizes numbers. If you know such a structure, I would be glad to know;) ) However when recognizing some numbers there are problems

For example, consider:

one thousand and one
one thousand and eleven
one thousand one hundred and eleven

and I have a grammar like:  

<rule name = "num100-1000">
     <ruleref refid = "digit"/>
     <p disp = ...>thousand</p>
     <ruleref refid = "num100">

if I write "" for disp, the grammar returns 11 for 1001 and 111 for 1011. Thus I need to have some value associated with childs and should use those values from parent nodes.

However I have found an alternative way (filling '0's at the beginning of a number ie: represent 1 as 0001) and if I can create sth like:

<rule name = "newRule">
      <p disp = "some string"><p>
      </ruleref refid = "existingrule">

my grammar will work. (Basically what I am trying to do here is to add some new string at the beginning of an existing rule. ie: 978 becomes 000978) However since SAPI does not allow <p disp = "some string"><p>, I cannot create my grammar this way either. It would be great if anyone knows how to do this in sapi.  





Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question