VoiceXML 2.1 Development GuideHome  |  Frameset Home


<item>  element

The item element defines a valid utterance match within an XML grammar. This element also allows repeats and probability weighting to be added to the utterance in question.


usage
<item repeat="NMTOKEN" repeat-prob="NMTOKEN" weight="NMTOKEN">


attributes
repeatData Type: NMTOKENDefault: Optional
The repeat attribute is an SRGS addition to VWS2.0 that alolows the developer to specify the number of times, if any, that the utterance is allowed to be repeated by the caller. The allowed formats for this attribute are as follows:

item repeat="3"                The utterance must be repeated 3 times
item repeat="2-4"              The utterance must be repeated 2 to 4 times
item repeat="2-"                The utterance must be repeated 2 or more times
item repeat="0-3"              The utterance is not required to be repeated, but can be repeated for up to 3 times
repeat-probData Type: NMTOKENDefault: Optional
The repeat-prob attribute allows the developer to specify a probability that an utterance will be repeated by the caller. The value should be a number ranging from '0.0', (least likely to be repeated), to '1.0', (most likely to be repeated).
weightData Type: NMTOKENDefault: Optional
The weight attribute specifies the increased or decreased likelihood for a particular grammar match. For instance, specifying the value as '0.8' would increase the chances that an approximate utterance would be considered a valid grammar match, while a value of '0.2' would make it highly unlikely that a match would ever be considered valid. Note that the parent Item element must be enclosed by the One-Of element, else the grammar weighting is ignored.



shadow variables
none


parents
<item> <one-of> <rule>


children
<item> <one-of> <ruleref> <tag> <token>


code samples
<ItemWeightCode.vxml>
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">

  <field name="F_1">
    <prompt>
      What in gods name is that thing on James Trafficants head?
      Is it a marmot, a stabilizing fin or pile of goat vomit?
    </prompt>

    <grammar src="MyItemWeightGrammar.xml" type="application/grammar-xml"/>

    <filled>
      <prompt>
        Say, that guess is as good as any, I suppose.
    </prompt>

  </filled>

  </field>

</form>

</vxml>

<MyItemWeightGrammar.xml>
<?xml version= "1.0"?>

<grammar xmlns="http://www.w3.org/2001/06/grammar"
          xml:lang="en-US" root = "MYRULE">

  <rule id="MYRULE" scope="public">

    <one-of>
      <item> marmot
<tag> <![CDATA[  <F_1 "marmot">  ]]>  </tag>
      </item>

      <item weight="0.0"> goat vomit
<tag> <![CDATA[  <F_1 "goat vomit">  ]]>  </tag>
      </item>

    <item weight="1.0"> stabilizing fin
<tag> <![CDATA[  <F_1 "stabilizing fin">  ]]>  </tag>
    </item>
  </one-of>
    </rule>

</grammar>

<ItemRepeatProbCode.vxml>
<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.1">

<meta name="author" content="Matthew Henry"/>
<meta name="copyright" content="2005 voxeo corporation"/>
<meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/>


<form id="F1">

  <field name="F_1">
    <prompt>
      What was Marlon Brandos famous last line in the movie Apocalypse Now?
    </prompt>

    <grammar src="MyRepeatGram.xml" type="application/grammar-xml"/>

    <filled>

      <prompt>Yes, thats right. The horror.</prompt>

  </filled>

  </field>

  </form>

</vxml>

<MyRepeatGram.xml>
<?xml version= "1.0"?>

<grammar xmlns="http://www.w3.org/2001/06/grammar"
        xml:lang="en-US" root = "MYRULE">

<rule id="MYRULE" scope="public">

  <one-of lang-list="en-US">
<item repeat="0-2" repeat-prob="0.6">
          the horror
        </item>

<item repeat="2">

            nanoo
        </item>

<item repeat-prob="0.0" repeat="0-1">

            machines are gonna fail, lewis
        </item>
  </one-of>
  </rule>
</grammar>



additional links
W3C SRGS 1.0 Specification


  ANNOTATIONS: EXISTING POSTS
hstclair
8/24/2006 12:04 PM (EDT)
I suggest that you replace the text:

item repeat="3"                The utterance must be repeated 3 times
item repeat="2-4"              The utterance must be repeated 2 to 4 times
item repeat="2-"                The utterance must be repeated 2 or more times
item repeat="0-3"              The utterance is not required to be repeated, but can be repeated for up to 3 times

with:

item repeat="3"                The utterance must be spoken 3 times
item repeat="2-4"              The utterance must be spoken 2 to 4 times
item repeat="2-"                The utterance must be spoken 2 or more times
item repeat="0-3"              The utterance is not required, but may be spoken up to 3 times


Admittedly, it's a minor point but I think that it might help others down the road.  I remember experiencing some uncertainty about how to interpret the 'repeat' count and whether it could be used to make an item optional when I first read this page.

mikethompson
8/24/2006 1:09 PM (EDT)
Hey Hal,

I must admit, your rendition of the repeat="0-3" row is a bit more clear.  I will let our keepers of the doucmentation know about the ambiguity of the current statement.

Best,
Mike Thompson
Voxeo Corporation
mtatum111
10/8/2008 10:49 AM (EDT)
In preparing for my certification test, I have been presented the following practice question

1. Which grammar rule accepts the following input and produces the indicated output?  The answer here is C.  However, I was told that D will also work.  I am a little confused about D working because we have the following <item repeat = "0-1"> the </item>.  It was my understanding that when we have this and the caller speaks "the" then it will be returned as the text output.  Am I missing something here.  For instance, if the caller says "Raise the Volume" then according to D, I would have thought the text output would be "Raise the Volume" and not "Raise Volume"
Thanks for any input


Spoken Input Text Output
Raise volume Raise volume
Raise the volume Raise volume
Lower volume Lower volume
Lower the volume Lower volume
Raise air         Raise air
Raise the air Raise air
Lower air         Lower air
Lower the air Lower air

<rule id = "direction">
<one-of>
<item> Raise</item>
<item> Lower </item>
<one-of>
</rule>

<rule id = "control">
<one-of>
<item> volume</item>
<item> air </item>
<one-of>
</rule>

A. <rule id = "spoken_commands">
  <ruleref uri = "#direction"/>
  <ruleref uri = "#control"/>
            </rule>

B. <rule id = "spoken_commands">
  <ruleref uri = "#direction"/>
<item> the </item>
  <ruleref uri = "#control"/>
            </rule>
C. <rule id = "spoken_commands">
  <ruleref uri = "#direction"/>
<ruleref special = "GARBAGE"/>
  <ruleref uri = "#control"/>
            </rule>

D. <rule id = "spoken_commands">
  <ruleref uri = "#direction"/>
<item repeat = "0-1"> the </item>
  <ruleref uri = "#control"/>
            </rule>
VoxeoDustin
10/8/2008 10:53 AM (EDT)
Hey Melissa,

You are correct. In this instance, option D will return 'the' as part of the interpretation if it is spoken. The GARBAGE rule in C will not return any value in the interpretation.

Cheers,
Dustin

login



© 2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site