3.35. one-of

Element typeone-of
Attributesxml:lang
Parentsitem | rule
Childrenitem
DescriptionIndicates a set of possible choices for a phrase in a rule expansion.

DTD

<!ELEMENT one-of (item)* >
<!ATTLIST one-of
  xml:lang NMTOKEN #IMPLIED >

Language model



Attributes

xml:lang : NMTOKEN

Specifies the spoken language used with this element - for example, en-US for US English.

Children

item

Each choice within a one-of element is represented by an item element containing a rule expansion.

Examples

In Example 3-41, the rule uses the one-of elements to accept either "like" or "hate" and either "dogs" or "cats." Hence it will match the following phrases:

  • I like dogs.

  • I hate dogs.

  • I like cats.

  • I hate cats.

Example 3-41. Using one-of to permit multiple utterances to be accepted
<?xml version="1.0" encoding="iso-8859-1"?>
<vxml version="2.0">
  <form id="test">
    <initial name="dogscats">
      <prompt>How do you feel about dogs and cats?</prompt>
    </initial>
    <grammar xml:lang="en-US" version="1.0" root="colors">
      <rule id="colors" scope="public">
        <one-of>
          <item tag="emotion='like';">like</item>
          <item tag="emotion='hate';">hate</item>
        </one-of>
        <one-of>
          <item tag="animal='dogs';">dogs</item>
          <item tag="animal='cats';">cats</item>
        </one-of>
      </rule>
    </grammar>

    <field name="emotion"/>
    <field name="animal"/>

    <filled>
      <prompt>
        You said you 
        <value expr="emotion"/> <value expr="animal"/>.
      </prompt>
    </filled>
  </form>
</vxml>

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.59.210