item Element

  Microsoft Speech Technologies Homepage

Contains any valid rule expansion. A valid rule expansion can consist of a word or other entity that can be spoken, a ruleref element, a tag element, or any logical combination of these. When an item element contains a combination of rule expansions (for example, a combination of words), the sequence in which the contents of the item element are listed must match the sequence in which the content occurs in the input in order for recognition to be successful.

<item
    repeat = (n | m–n | m– | 0–1)
    repeat-prob = (n | n. | n.nnnn | .nnnn)
    weight = (n | n. | .n | n.n) >
</item>

Attributes

  • repeat
    Optional. Specifies the number of times a contained expansion can be repeated. The value of this attribute can be 0, any positive integer, or any range of positive integers. The value of this attribute applies to the entire content of the item element.

    If omitted, the content of the item element must occur exactly once in the input. A value of m– indicates that the item must occur a minimum of m times, and can be repeated an infinite number of times. For example, a value of 1– indicates that the content of the item element can occur from one to any number of times. A value of 0–1 indicates that the occurrence of the content of the item element in the input is optional (a speaker can utter the content either zero times, or one time).

  • repeat-prob
    Optional. Specifies the probability of successive repetition of a repeated item. Applies only to items that have a repeat attribute. The value of this attributes is a positive floating-point value between 0.0 and 1.0 (inclusive). For example, a repeat-prob value of 0.8 indicates an 80% probability that the item will be repeated.

  • weight
    Optional. Specifies a multiplying factor that increases the likelihood that an alternative word or phrase will be chosen from an expansion of alternative words or phrases. The value of this attribute is a positive floating-point value. A weight of 1.0 is equivalent to providing no weight at all, a weight greater than 1.0 positively biases the alternative, and a weight less than 1.0 negatively biases the alternative.

Remarks

When the item element is contained by a rule element, use the item element to contain a rule expansion when it is necessary to make the rule expansion either optional or repeatable (in other words, in cases where the repeat attribute must be used). When the item element is contained by a one-of element, use the item element to contain a rule expansion when it is necessary to assign a weight to the rule expansion (in other words, in cases where the weight attribute must be used).

The effects of any tag elements contained within an item element are applied to the entire contents of the item element.

Example

<grammar root="IdentNumber" version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
 xml:lang="en-US" tag-format="semantics-ms/1.0">
  <rule id="IdentNumber" scope="public">
    <item repeat="4-6"><ruleref uri="#Digits"></item>
  </rule>
</grammar>

<grammar root="PizzaSize" version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
 xml:lang="en-US" tag-format="semantics-ms/1.0">
  <rule id="PizzaSize" scope="public">
    a
      <one-of>
        <item weight=".5">small</item> 
        <item>medium</item> 
        <item weight="2">large</item> 
      </one-of>
    pizza
  </rule>
</grammar>

See Also

Grammar XML | Using the <tag> Element