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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 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