Groups > Microsoft > Microsoft Speech Tech > Re: How to make optional text in XML




How to make optional text in XML

How to make optional text in XML
Tue, 5 Feb 2008 11:57:00 -0800
Hi,

I am trying to make some words optional in my xml grammar so that you can 
name a person by their lastname only.  I've tried a few things like <OPT>
and 
repeat="0-1" and nothing seems to make it work.

I am using the System.Speech.Recognizer.

Post Reply
Re: How to make optional text in XML
Thu, 7 Feb 2008 18:18:04 -0800
Hi John,

It sounds like you're trying they right approach with the repeat attribute. 
Something like this should work for you:

<rule id="Names" scope="public">
    <one-of>
        <item>
            <item repeat="0-1">
                Susan
            </item>
            Jones
        </item>
        <item>
            <item repeat="0-1">
                Jim
            </item>
            Jones
        </item>
    </one-of>
</rule>

   See the W3C's Speech Recognition Grammar Specification Version 1.0 at 
http://www.w3.org/TR/speech-grammar/ for all the details.

-- Steve Meyer

This posting is provided "AS IS" with no warranties, and confers no
rights.

"John" <johnnypav@community.nospam.com> wrote in message 
news:1F518899-24F6-4139-8BC3-2B36419B5174@microsoft.com...
> Hi,
>
> I am trying to make some words optional in my xml grammar so that you can
> name a person by their lastname only.  I've tried a few things like
<OPT> 
> and
> repeat="0-1" and nothing seems to make it work.
>
> I am using the System.Speech.Recognizer.
>
> thanks 
Post Reply
about | contact