one-of Element (Microsoft.Speech)

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

Specifies a set of alternative phrases that can possibly be matched by a user. Each alternative word or phrase must be enclosed within an item element.

Syntax

XML Copy imageCopy Code
<one-of>...</one-of>

Attributes

None.

Remarks

Unlike the Speech Recognition Grammar Specification (SRGS) Version 1.0 specification, the Microsoft Speech Platform SDK 11 does not support the use of the xml:lang attribute on the one-of element. Grammars in the Speech Platform SDK 11 can contain only one language, and this must be declared in the grammar Element (Microsoft.Speech). To support multiple languages for your applications, you can use multiple grammars in parallel, each with a separate single language.

Example

The rule named PhoneRule in the grammar shown below recognizes the following utterances:

  • call

  • call him

  • call her

  • call them

  • phone

  • phone him

  • phone her

  • phone them

The repeat attribute on the second item element indicates that the words in the one-of element can be spoken zero or one time, making them optional.

XML Copy imageCopy Code
<grammar root="PhoneRule" version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
 xml:lang="en-US" tag-format="semantics/1.0">

  <rule id="PhoneRule" scope="public">
    <item>
      <one-of>
        <item> call </item> 
        <item> phone </item> 
      </one-of>
    </item>

    <item repeat="0-1">
      <one-of>
        <item> him </item> 
        <item> her </item> 
        <item> them </item> 
      </one-of>
    </item>
  </rule>

</grammar>