Home | History | Annotate | Download | only in grammars
      1 <?xml version="1.0" encoding="ISO-8859-1" ?>
      2 <grammar version="1.0" xml:lang="en-US" mode="voice" root="_digits">
      3 <!-- 
      4 	Test grammar, this digits grammar recognizes a variable number of
      5 	digits.  For best accuracy, is is always better to apply constraints
      6 	to the grammar, such as phone number constraints, length constraints
      7 	or other.   
      8 -->
      9 <meta name="word_penalty" content="160"/>
     10 
     11    <rule id="_digits" scope="public">
     12       <item>
     13       <ruleref uri="#S"/>
     14       <tag>MEANING=S.X;</tag>
     15       </item>
     16    </rule>
     17       
     18    <rule id="S">
     19       <item repeat="1-">
     20          <ruleref uri="#DIGIT"/>
     21          <tag>X=X?X:'';X=X+DIGIT.V;</tag>
     22       </item>
     23    </rule>
     24 
     25    <rule id="DIGIT">
     26       <one-of>
     27          <item>
     28             zero
     29             <tag>V='0'</tag>
     30          </item>
     31          <item>
     32             oh
     33             <tag>V='0'</tag>
     34          </item>
     35          <item>
     36             one
     37             <tag>V='1'</tag>
     38          </item>
     39          <item>
     40             two
     41             <tag>V='2'</tag>
     42          </item>
     43          <item>
     44             three
     45             <tag>V='3'</tag>
     46          </item>
     47          <item>
     48             four
     49             <tag>V='4'</tag>
     50          </item>
     51          <item>
     52             five
     53             <tag>V='5'</tag>
     54          </item>
     55          <item>
     56             six
     57             <tag>V='6'</tag>
     58          </item>
     59          <item>
     60             seven
     61             <tag>V='7'</tag>
     62          </item>
     63          <item>
     64             eight
     65             <tag>V='8'</tag>
     66          </item>
     67          <item>
     68             nine
     69             <tag>V='9'</tag>
     70          </item>
     71       </one-of>
     72    </rule>
     73 
     74 </grammar>
     75 
     76 
     77