blob: 4d993268084c13658c0b21d06e8b999f3485817c [file] [log] [blame]
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar version="1.0" root="mytime" xml:lang="en-US"
xmlns="http://www.w3.org/2001/06/grammar">
<!--
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
-->
<rule id="mytime" scope="public">
<item>
<one-of>
<item><ruleref uri="#hr"/><tag><![CDATA[$ = $hr + "00?"; ]]></tag></item>
<item><ruleref uri="#hr"/><ruleref uri="#minutes"/><ruleref uri="#ampm"/><tag><![CDATA[$ = $hr + $minutes +$ampm; ]]></tag></item>
<item><ruleref uri="#hr"/><ruleref uri="#minutes"/><tag><![CDATA[$ = $hr + $minutes +"?"; ]]></tag></item>
</one-of>
</item>
</rule>
<rule id="hr">
<one-of>
<item><ruleref uri="#digits01To09"/><tag><![CDATA[$ = $digits01To09; ]]></tag></item>
<item> ten <tag><![CDATA[ $="10"; ]]></tag></item>
<item> eleven <tag><![CDATA[ $="11"; ]]></tag></item>
<item> twelve <tag><![CDATA[ $="12"; ]]></tag></item>
</one-of>
</rule>
<rule id="minutes">
<one-of>
<item><ruleref special="NULL"/><tag><![CDATA[
$ = "00";
]]></tag></item>
<item> o'clock <tag><![CDATA[
$ = "00";
]]></tag></item>
<item>
<one-of>
<item> ten <tag><![CDATA[ $ ="10"; ]]></tag></item>
<item> eleven <tag><![CDATA[ $ ="11"; ]]></tag></item>
<item> twelve <tag><![CDATA[ $ ="12"; ]]></tag></item>
</one-of>
</item>
<item>
<item>
<one-of>
<item> oh </item>
<item> zero </item>
</one-of>
</item><ruleref uri="#digits01To09"/><tag><![CDATA[
$ = $digits01To09;
]]></tag>
</item>
<item><ruleref uri="#numbers01to59"/><tag><![CDATA[
$ = $numbers01to59;
]]></tag></item>
</one-of>
</rule>
<rule id="ampm">
<one-of>
<item><ruleref special="NULL"/><tag><![CDATA[
]]></tag></item>
<item>
<item>
<one-of>
<item> a.m. </item>
</one-of>
</item><tag><![CDATA[
$ = "am";
]]></tag>
</item>
<item>
<item>
<one-of>
<item> p.m. </item>
</one-of>
</item><tag><![CDATA[
$ = "pm";
]]></tag>
</item>
</one-of>
</rule>
<rule id="digits01To09">
<one-of>
<item>One<tag><![CDATA[$="01";]]></tag></item>
<item>Two<tag><![CDATA[$="02";]]></tag></item>
<item>Three<tag><![CDATA[$="03";]]></tag></item>
<item>Four<tag><![CDATA[$="04";]]></tag></item>
<item>Five<tag><![CDATA[$="05";]]></tag></item>
<item>Six<tag><![CDATA[$="06";]]></tag></item>
<item>Seven<tag><![CDATA[$="07";]]></tag></item>
<item>Eight<tag><![CDATA[$="08";]]></tag></item>
<item>Nine<tag><![CDATA[$="09";]]></tag></item>
</one-of>
</rule>
<rule id="numbers01to59">
<one-of>
<item> ten <tag><![CDATA[ $="10"; ]]></tag></item>
<item><ruleref uri="#teens"/><tag><![CDATA[ $ = $teens + ""; ]]></tag></item>
<item><ruleref uri="#tens20to50"/><tag><![CDATA[ $ =$tens20to50 + "0"; ]]></tag></item>
<item><ruleref uri="#tens20to50"/><ruleref uri="#numbers1to9"/><tag><![CDATA[ var s=$tens20to50;
var s0 = $numbers1to9;
$ =s+s0; ]]></tag></item>
</one-of>
</rule>
<rule id="teens">
<one-of>
<item> eleven <tag><![CDATA[ $ ="11"; ]]></tag></item>
<item> twelve <tag><![CDATA[ $ ="12"; ]]></tag></item>
<item> thirteen <tag><![CDATA[ $ ="13"; ]]></tag></item>
<item> fourteen <tag><![CDATA[ $ ="14"; ]]></tag></item>
<item> fifteen <tag><![CDATA[ $ ="15"; ]]></tag></item>
<item> sixteen <tag><![CDATA[ $ ="16"; ]]></tag></item>
<item> seventeen <tag><![CDATA[ $ ="17"; ]]></tag></item>
<item> eighteen <tag><![CDATA[ $ ="18"; ]]></tag></item>
<item> nineteen <tag><![CDATA[ $ ="19"; ]]></tag></item>
</one-of>
</rule>
<rule id="tens20to50">
<one-of>
<item> twenty <tag><![CDATA[ $ ="2"; ]]></tag></item>
<item> thirty <tag><![CDATA[ $ ="3"; ]]></tag></item>
<item> forty <tag><![CDATA[ $ ="4"; ]]></tag></item>
<item> fifty <tag><![CDATA[ $ ="5"; ]]></tag></item>
</one-of>
</rule>
<rule id="numbers1to9">
<one-of>
<item> one <tag><![CDATA[ $="1"; ]]></tag></item>
<item><ruleref uri="#numbers2to9"/><tag><![CDATA[ $=$numbers2to9; ]]></tag></item>
</one-of>
</rule>
<rule id="numbers2to9">
<one-of>
<item> two <tag><![CDATA[ $="2"; ]]></tag></item>
<item> three <tag><![CDATA[ $="3"; ]]></tag></item>
<item> four <tag><![CDATA[ $="4"; ]]></tag></item>
<item> five <tag><![CDATA[ $="5"; ]]></tag></item>
<item> six <tag><![CDATA[ $="6"; ]]></tag></item>
<item> seven <tag><![CDATA[ $="7"; ]]></tag></item>
<item> eight <tag><![CDATA[ $="8"; ]]></tag></item>
<item> nine <tag><![CDATA[ $="9"; ]]></tag></item>
</one-of>
</rule>
</grammar>