Share via


Rule Expansion

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

A rule expansion specifies the sets of words or phrases within a rule that the system uses to match user input. Rule expansions also specify the required sequence of user input phrases.

When creating a rule, place each item of user input in an XML element. Each piece of input contained in an XML element is known as an alternative. For example, a single word contained in a token element is known as an alternative. A one-of element that contains one or many item elements is an alternative. Each item within the set of item elements is also an alternative.

Alternatives can also be thought of as rule expansions. A valid rule expansion is any valid alternative or logical combination of alternatives. A rule expansion is valid if it follows grammar logic.

Use the following XML elements to create rule expansions.

  • ruleref
  • item
  • one-of
  • token
  • tag

Examples

In the following example, the word "very" is contained in a token element that is contained in an item element that is contained in a one-of element. These three elements are valid rule expansions.

<rule ...>
   <one-of>
      <item repeat="0-1">
         <token>very</token>
      </item>
   </one-of>
</rule>

In the following example, each ruleref element is contained in an item element and both item elements are contained in a single one-of element. All of these elements are valid rule expansions.

<rule ...>
   <one-of>
      <item repeat="1-3">
         <ruleref uri="#digit"/>
      </item>

      <item repeat="5-">
         <ruleref uri="#date"/>
      </item>
   </one-of>
</rule>

See Also

Concepts

Grammar XML