Share via


Cardinal Rules for English (United States)

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.

Cardinal rules recognize numeric values ranging from zero to one million.

The numeric range that each rule recognizes is encoded in the rule name. For example, Cardinal_1_to_9 can recognize the numbers in the range of one to nine.

The Cardinal rule recognizes the full range of values from zero (or "oh") to one million.

All Cardinal rules return a value of type integer.

The voice mode grammar library contains two additional rules for recognizing cardinal numbers. The Number rule recognizes values from -1,000,000.00 to 1,000,000.00 and the Number_upto1000 rule recognizes values from -1000.00 to 1,000.00.

The Number rules return a value of type float.

Rules

Cardinal

Cardinal_0

Cardinal_0_to_9

Cardinal_0_to_10

Cardinal_0_to_100

Cardinal_0_to_1000

Cardinal_1_to_9

Cardinal_1_to_99

Cardinal_1_to_999

Cardinal_2_to_9

Cardinal_10_to_19

Cardinal_10_to_99

Cardinal_20_to_29

Cardinal_20_to_99

Cardinal_100_to_999

Cardinal_1000_to_999999

Number

Number_upto1000

Usage

<ruleref uri="Library.grxml#Cardinal" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_0" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_0_to_9" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_0_to_10" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_0_to_100" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_0_to_1000" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_1_to_9" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_1_to_99" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_1_to_999" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_2_to_9" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_10_to_19" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_10_to_99" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_20_to_29" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_20_to_99" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_100_to_999" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Cardinal_1000_to_999999" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Number" type="application/srgs+xml"/>
<ruleref uri="Library.grxml#Number_upto1000" type="application/srgs+xml"/>

The grammar can be used as follows (using the Cardinal rule as an example).

<grammar xmlns:sapi="http://schemas.microsoft.com/Speech/2002/06/SRGSExtensions"
         xml:lang="en-US" tag-format="semantics-ms/1.0" version="1.0" mode="voice"
         root="Rule1" xmlns="http://www.w3.org/2001/06/grammar">
    <rule id="Rule1" scope="public">
        <ruleref uri="Library.grxml#Cardinal" type="application/srgs+xml"/>
    <tag>$ = $$</tag>
    </rule>
</grammar>

JScript Objects

$Cardinal._value: integer [0...1,000,000]
$Cardinal_0._value: integer [0]
$Cardinal_0_to_9._value: integer [0...9]
$Cardinal_0_to_10._value: integer [0...10]
$Cardinal_0_to_100._value: integer [0...100]
$Cardinal_0_to_1000._value: integer [0...1000]
$Cardinal_1_to_9._value: integer [1...9]
$Cardinal_1_to_99._value: integer [1...99]
$Cardinal_1_to_999._value: integer [1...999]
$Cardinal_2_to_9._value: integer [2...9]
$Cardinal_10_to_19._value: integer [10...19]
$Cardinal_10_to_99._value: integer [10...99]
$Cardinal_20_to_29._value: integer [20...29]
$Cardinal_20_to_99._value: integer [20...99]
$Cardinal_100_to_999._value: integer [100...999]
$Cardinal_1000_to_999999._value: integer [1000...999999]
$Number._value: float [-1000000.00...1000000.00]
$Number_upto1000._value: float [-1000000.00...1000000.00]

Examples: Cardinal

Example 1

User says: "One hundred fifty."

SML returned by the recognition engine.

<SML text="one hundred fifty" utteranceConfidence="1.000" confidence="1.000">150</SML>

Example 2

User says: "Fifty thousand six hundred and four."

SML returned by the recognition engine.

<SML text="fifty thousand six hundred and four" utteranceConfidence="1.000" confidence="1.000">50604</SML>

Example 3

User says: "Seven hundred sixty five thousand four hundred thirty two."

SML returned by the recognition engine.

<SML text="seven hundred sixty five thousand four hundred thirty two" utteranceConfidence="1.000" confidence="1.000">765432</SML>

See Also

Concepts

Voice Mode Grammar Library for English (United States)