index.html 234 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org" />
<title>Speech Recognition Grammar Specification Version 1.0</title>
<style type="text/css" xml:space="preserve">
/*<![CDATA[*/
pre { 
   font-family: monospace;
   font-size: 85%;
   white-space: pre;
   background-color: rgb(204,204,255);
   padding: 0.5em;
   margin-left: 0;
   border: none;
   width: 97%;
}
pre.abnf {
   background-color: rgb(255,204,204);
   border: solid black thin;
   margin-left: 0;
}
pre.xml {
   background-color: rgb(204,204,255);
   border: solid black thin;
   margin-left: 0;
}
pre.dtd {
   background-color: rgb(204,255,204);
   border: solid black thin;
   margin-left: 0;
}
pre.syntax {
   background-color: rgb(232,255,255);
   border: solid black thin;
   margin-left: 0;
   font-style: italic;
}
code {
    font-size: 85%; 
    color: green; 
    font-weight: bold; 
}

.tocline { list-style: none; }
table.exceptions { background-color: rgb(255,255,153); }
table {
    border: black;
    border-width: 1px;
}

td { background-color: rgb(234,255,234) }

.issues {
    font-style: italic;
    color: green;
}
.remove {
  text-decoration: line-through;
  color: black;
}
.new { color: red; }
.hide { display: none }
/*]]>*/
</style>
<link rel="stylesheet" type="text/css" href=
"http://www.w3.org/StyleSheets/TR/W3C-REC" />
</head>
<body>
<div>
<div class="head"><a href="http://www.w3.org/" shape=
"rect"><img src="http://www.w3.org/Icons/w3c_home" alt="W3C" width=
"72" height="48" /></a>
<h1 class="notoc" id="title">Speech Recognition Grammar
Specification Version 1.0</h1>
</div>
<!-- W3C HEADER -->
<div class="head"><!-- DATE -->
<h2 class="notoc" id="pub-date">W3C Recommendation 16
March 2004</h2>
<dl>
<dt>This version:</dt>
<dd><a href=
"http://www.w3.org/TR/2004/REC-speech-grammar-20040316/">http://www.w3.org/TR/2004/REC-speech-grammar-20040316/</a></dd>
<dt>Latest version:</dt>
<dd><a href=
"http://www.w3.org/TR/speech-grammar/">http://www.w3.org/TR/speech-grammar/</a></dd>
<dt>Previous version:</dt>
<dd><a href=
"http://www.w3.org/TR/2003/PR-speech-grammar-20031218/">http://www.w3.org/TR/2003/PR-speech-grammar-20031218/</a></dd>
<dt>Editors:</dt>
<dd>Andrew Hunt, <span>ScanSoft</span></dd>
<dd>Scott McGlashan, <span>Hewlett-Packard</span></dd>
<dt>Contributors:</dt>
<dd>See <a href="#S6" shape="rect">Acknowledgements</a></dd>
</dl>

<p>Please refer to the <a href="http://www.w3.org/2004/03/speech-grammar-errata.html"><strong>errata</strong></a> for this document, which may include some normative corrections.</p>

<p>See also <a href="http://www.w3.org/2003/03/Translations/byTechnology?technology=speech-grammar"><strong>translations</strong></a>.</p>



<p class="copyright"><a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Copyright" shape=
"rect">Copyright</a> &copy; 2004 <a href="http://www.w3.org/" shape=
"rect"><acronym title=
"World Wide Web Consortium">W3C</acronym></a><sup>&reg;</sup>
(<a href="http://www.csail.mit.edu/" shape="rect"><acronym title=
"Massachusetts Institute of Technology">MIT</acronym></a>, <a href=
"http://www.ercim.org/" shape="rect"><acronym title=
"European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>,
<a href="http://www.keio.ac.jp/" shape="rect">Keio</a>), All Rights
Reserved. W3C <a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer"
shape="rect">liability</a>, <a href=
"http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks"
shape="rect">trademark</a>, <a href=
"http://www.w3.org/Consortium/Legal/copyright-documents" shape=
"rect">document use</a> and <a href=
"http://www.w3.org/Consortium/Legal/copyright-software" shape=
"rect">software licensing</a> rules apply.</p>
<hr title="Separator from Header" /></div>
<h2 class="notoc" id="id1"><a id="abstract" name="abstract" shape=
"rect">Abstract</a></h2>
<p>This document defines syntax for representing grammars for use
in speech recognition so that developers can specify the words and
patterns of words to be listened for by a speech recognizer. The
syntax of the grammar format is presented in two forms, an
Augmented BNF Form and an XML Form. The specification makes the two
representations mappable to allow automatic transformations between
the two forms.</p>

<h2 class="notoc" id="id2">Status of this Document</h2>

<p><em>This section describes the status of this document at
the time of its publication. Other documents may supersede this
document. A list of current W3C publications and the latest
revision of this technical report can be found in the
<a href="http://www.w3.org/TR/">W3C technical reports index</a>
at http://www.w3.org/TR/.</em></p>

<p>This document has been reviewed by W3C Members and other
interested parties, and it has been endorsed by the Director
as a <a
href="http://www.w3.org/2004/02/Process-20040205/tr.html#RecsW3C">W3C
Recommendation</a>. W3C's role in making the Recommendation is to
draw attention to the specification and to promote its widespread
deployment. This enhances the functionaility and interoperability
of the Web.</p>

<p>This specification is part of the W3C Speech Interface Framework
and has been developed within the <a href="http://www.w3.org/Voice/">W3C Voice Browser Activity</a> (<a href="http://www.w3.org/Voice/Activity.html">activity statement</a>) by participants in
the <a href="http://www.w3.org/Voice/Group/">Voice Browser Working
Group</a> (<a href="http://cgi.w3.org/MemberAccess/AccessRequest">W3C
Members only</a>).</p>

<p>The design of SRGS 1.0 has been widely reviewed (see the
<a href="http://www.w3.org/TR/2003/PR-speech-grammar-20031218/disposition.html">
disposition of comments</a>) and satisfies the Working Group's
technical requirements.  A list of implementations is included in the
<a href="http://www.w3.org/Voice/2003/srgs-ir/">SRGS 1.0
implementation report</a>, along with the associated test suite.</p>



<p>Comments are welcome on <a
href="mailto:www-voice@w3.org">www-voice@w3.org</a> (<a
href="http://lists.w3.org/Archives/Public/www-voice/">archive</a>).
See <a href="http://www.w3.org/Mail/">W3C mailing list and archive usage
guidelines</a>.</p>

<p>The W3C maintains a list of <a
href="http://www.w3.org/2001/09/voice-disclosures.html">any patent
disclosures related to this work</a>.</p>


<!-- END OF W3C HEADER -->
<div>
<h2 class="notoc" id="id-S0"><a id="S0" name="S0" shape=
"rect">Table of Contents</a></h2>
<ul class="toc">
<li class="tocline">1. <a href="#S1" shape="rect">Introduction</a>
<ul class="toc">
<li class="tocline">1.1 <a href="#S1.1" shape="rect">Grammar
Processors and User Agents</a></li>
<li class="tocline">1.2 <a href="#S1.2" shape="rect">Scope</a></li>
<li class="tocline">1.3 <a href="#S1.3" shape="rect">Grammar
Conversions</a></li>
<li class="tocline">1.4 <a href="#S1.4" shape="rect">Semantic
Interpretation</a></li>
<li class="tocline">1.5 <a href="#S1.5" shape="rect">Embedded
Grammars</a></li>
<li class="tocline">1.6 <a href="#S1.6" shape=
"rect">Terminology</a></li>
</ul>
</li>
<li class="tocline">2. <a href="#S2" shape="rect">Rule
Expansions</a>
<ul class="toc">
<li class="tocline">2.1 <a href="#S2.1" shape=
"rect">Tokens</a></li>
<li class="tocline">2.2 <a href="#S2.2" shape="rect">Rule
References</a>
<ul class="toc">
<li class="tocline">2.2.1 <a href="#S2.2.1" shape="rect">Local
References</a></li>
<li class="tocline">2.2.2 <a href="#S2.2.2" shape="rect">External
Reference by URI</a></li>
<li class="tocline">2.2.3 <a href="#S2.2.3" shape="rect">Special
Rules</a></li>
<li class="tocline">2.2.4 <a href="#S2.2.4" shape=
"rect">Referencing N-gram Documents</a></li>
</ul>
</li>
<li class="tocline">2.3 <a href="#S2.3" shape="rect">Sequences and
Encapsulation</a></li>
<li class="tocline">2.4 <a href="#S2.4" shape=
"rect">Alternatives</a>
<ul class="toc">
<li class="tocline">2.4.1 <a href="#S2.4.1" shape=
"rect">Weights</a></li>
</ul>
</li>
<li class="tocline">2.5 <a href="#S2.5" shape="rect">Repeats</a>
<ul class="toc">
<li class="tocline">2.5.1 <a href="#S2.5.1" shape="rect">Repeat
Probabilities</a></li>
</ul>
</li>
<li class="tocline">2.6 <a href="#S2.6" shape="rect">Tags</a></li>
<li class="tocline">2.7 <a href="#S2.7" shape=
"rect">Language</a></li>
<li class="tocline">2.8 <a href="#S2.8" shape=
"rect">Precedence</a></li>
</ul>
</li>
<li class="tocline">3. <a href="#S3" shape="rect">Rule
Definitions</a>
<ul class="toc">
<li class="tocline">3.1 <a href="#S3.1" shape="rect">Basic Rule
Definition</a></li>
<li class="tocline">3.2 <a href="#S3.2" shape="rect">Scoping of
Rule Definitions</a></li>
<li class="tocline">3.3 <a href="#S3.3" shape="rect">Example
Phrases</a></li>
</ul>
</li>
<li class="tocline">4. <a href="#S4" shape="rect">Grammar
Documents</a>
<ul class="toc">
<li class="tocline">4.1 <a href="#S4.1" shape="rect">Grammar Header
Declarations</a></li>
<li class="tocline">4.2 <a href="#S4.2" shape="rect">ABNF
Self-Identifying Header</a></li>
<li class="tocline">4.3 <a href="#S4.3" shape="rect">XML Form
Prolog and Root Element</a></li>
<li class="tocline">4.4 <a href="#S4.4" shape="rect">Character
Encoding</a></li>
<li class="tocline">4.5 <a href="#S4.5" shape=
"rect">Language</a></li>
<li class="tocline">4.6 <a href="#S4.6" shape="rect">Mode</a></li>
<li class="tocline">4.7 <a href="#S4.7" shape="rect">Root
Rule</a></li>
<li class="tocline">4.8 <a href="#S4.8" shape="rect">Tag
Format</a></li>
<li class="tocline">4.9 <a href="#S4.9" shape="rect">Base URI</a>
<ul class="toc">
<li class="tocline">4.9.1 <a href="#S4.9.1" shape="rect">Resolving
Relative URIs</a></li>
</ul>
</li>
<li class="tocline">4.10 <a href="#S4.10" shape=
"rect">Pronunciation Lexicon</a></li>
<li class="tocline">4.11 <a href="#S4.11" shape="rect">Meta
Data</a>
<ul class="toc">
<li class="tocline">4.11.1 <a href="#S4.11.1" shape="rect">Meta and
HTTP-Equiv</a></li>
<li class="tocline">4.11.2 <a href="#S4.11.2" shape="rect">XML
Metadata (XML Only)</a></li>
</ul>
</li>
<li class="tocline"><span>4.12</span> <a href="#S4.12" shape=
"rect"><span>Tag</span></a></li>
<li class="tocline"><span>4.13</span> <a href="#S4.13" shape=
"rect">Comments</a></li>
<li class="tocline"><span>4.14</span> <a href="#S4.14" shape=
"rect">Grammar Fetching</a></li>
<li class="tocline"><span>4.15</span> <a href="#S4.15" shape=
"rect">ABNF Keywords</a></li>
</ul>
</li>
<li class="tocline">5. <a href="#S5" shape="rect">Conformance</a>
<ul class="toc">
<li class="tocline">5.1 <a href="#S5.1" shape="rect">Conforming XML
Form Grammar Fragments</a></li>
<li class="tocline">5.2 <a href="#S5.2" shape="rect">Conforming
Stand-Alone XML Form Document</a></li>
<li class="tocline">5.3 <a href="#S5.3" shape="rect">Using XML Form
Grammars with other Namespaces</a></li>
<li class="tocline">5.4 <a href="#S5.4" shape="rect">Conforming XML
Form Grammar Processors</a></li>
<li class="tocline">5.5 <a href="#S5.5" shape="rect">Conforming
Stand-Alone ABNF Form Grammar Documents</a></li>
<li class="tocline">5.6 <a href="#S5.6" shape="rect">Conforming
ABNF Form Grammar Processors</a></li>
<li class="tocline">5.7 <a href="#S5.7" shape="rect">Conforming
ABNF/XML Form Grammar Processors</a></li>
<li class="tocline">5.8 <a href="#S5.8" shape="rect">Conforming
User Agents</a></li>
</ul>
</li>
<li class="tocline">6. <a href="#S6" shape=
"rect">Acknowledgements</a></li>
</ul>
<ul class="toc">
<li class="tocline">Appendix A. <a href="#AppA" shape=
"rect">References</a>
<ul class="toc">
<li class="tocline">A.1 <a href="#AppA.1" shape="rect">Normative
References</a></li>
<li class="tocline">A.2 <a href="#AppA.2" shape="rect">Informative
References</a></li>
</ul>
</li>
<li class="tocline">Appendix B. <a href="#AppB" shape="rect">DTD
for XML Form Grammars</a> (Informative)</li>
<li class="tocline">Appendix C. <a href="#AppC" shape="rect">XML Schema Definition
For XML Form Grammars</a> (Normative)</li>
<li class="tocline">Appendix D. <a href="#AppD" shape="rect">Formal
Syntax for Augmented BNF Form Grammars</a> (Normative)</li>
<li class="tocline">Appendix E. <a href="#AppE" shape="rect">DTMF
Grammars</a> (Normative)</li>
<li class="tocline">Appendix F. <a href="#AppF" shape="rect">XSLT
Style Sheet to Convert XML Form Grammars to the ABNF Form</a>
(Informative)</li>
<li class="tocline">Appendix G. <a href="#AppG" shape="rect">Media
Types and File Suffix</a> (Informative)</li>
<li class="tocline">Appendix H. <a href="#AppH" shape=
"rect">Logical Parse Structure</a> (Informative)
<ul class="toc">
<li class="tocline">H.1 <a href="#AppH.1" shape="rect">Terminology
and Notation</a></li>
<li class="tocline">H.2 <a href="#AppH.2" shape="rect">Parsing Rule
References</a></li>
<li class="tocline">H.3 <a href="#AppH.3" shape=
"rect">Recursion</a></li>
</ul>
</li>
<li class="tocline">Appendix I. <a href="#AppI" shape=
"rect">Features under Consideration for Future Versions</a>
(Informative)</li>
<li class="tocline">Appendix J. <a href="#AppJ" shape=
"rect">Example Grammars in ABNF Form and XML Form</a> (Informative)
<ul>
<li class="tocline">J.1 <a href="#AppJ.1" shape="rect">Simple
Examples (English)</a></li>
<li class="tocline">J.2 <a href="#AppJ.2" shape=
"rect">Cross-Reference Examples (English)</a></li>
<li class="tocline">J.3 <a href="#AppJ.3" shape="rect">Korean
Examples</a></li>
<li class="tocline">J.4 <a href="#AppJ.4" shape="rect">Chinese
Examples</a></li>
<li class="tocline">J.5 <a href="#AppJ.5" shape="rect">Swedish
Examples</a></li>
</ul>
</li>
</ul>
<p><a id="S1" name="S1" shape="rect"></a></p>
<h2 id="id-S1">1. Introduction</h2>
<p>This document defines the syntax for grammar representation. The
grammars are intended for use by speech recognizers and other
<a href="#S1.1" shape="rect">grammar processors</a> so that
developers can specify the words and patterns of words to be
listened for by a speech recognizer.</p>
<p>The syntax of the grammar format is presented in two forms, an
<em>Augmented BNF</em> (ABNF) Form and an XML Form. The
specification ensures that the two representations are <a href=
"#S1.3" shape="rect">semantically mappable</a> to allow automatic
transformations between the two forms.</p>
<ul>
<li><em>Augmented BNF syntax (ABNF):</em> this is a plain-text
(non-XML) representation which is similar to traditional BNF
grammar and to many existing BNF-like representations commonly used
in the field of speech recognition including the JSpeech Grammar
Format <a href="#ref-jsgf" shape="rect">[JSGF]</a> from which this
specification is derived. Augmented BNF should not be confused with
Extended BNF which is used in DTDs for XML and SGML.<br clear=
"none" />
&nbsp;</li>
<li><em>XML:</em> This syntax uses XML elements to represent the
grammar constructs and adapts designs from the PipeBeach grammar,
TalkML <a href="#ref-talkml" shape="rect">[TALKML]</a> and a
research XML variant of the JSpeech Grammar Format <a href=
"#ref-jsgf" shape="rect">[JSGF]</a>.</li>
</ul>
<p>Both the ABNF Form and XML Form have the expressive power of a
Context-Free Grammar (CFG). A <a href="#S1.1" shape="rect">grammar
processor</a> that does not support recursive grammars has the
expressive power of a Finite State Machine (FSM) or regular
expression language. For definitions of CFG, FSM, regular
expressions and other formal computational language theory see, for
example, <a href="#ref-hu79" shape="rect">[HU79]</a>. This form of
language expression is sufficient for the vast majority of speech
recognition applications.</p>
<p>This W3C standard is known as the Speech Recognition Grammar
Specification and is modelled on the JSpeech Grammar Format
specification <a href="#ref-jsgf" shape="rect">[JSGF]</a>, which is
owned by Sun Microsystems, Inc., California, U.S.A.</p>
<h3 id="id-S1.1"><a id="S1.1" name="S1.1" shape="rect">1.1 Grammar
Processors and User Agents</a></h3>
<p>A <em>grammar processor</em> is any entity that accepts as input
grammars as described in this specification.</p>
<p>A <em>user agent</em> is a grammar processor that accepts user
input and matches that input against a grammar to produce a
recognition result that represents the detected input.</p>
<p>As the specification title implies, speech recognizers are an
important class of grammar processor. Another class of grammar
processor anticipated by this specification is a <a href=
"#term-dtmf" shape="rect">Dual-Tone Multi-Frequency</a> (DTMF)
detector. The type of input accepted by a user agent is determined
by the <a href="#S4.6" shape="rect"><code>mode</code></a> or modes
of grammars it can process: e.g. speech input for <a href="#S4.6"
shape="rect">"voice"</a> mode grammars and DTMF input for <a href=
"#AppE" shape="rect">"dtmf"</a> mode grammars.</p>
<p>For simplicity, throughout this document references to a speech
recognizer apply to other types of grammar processor unless
explicitly stated otherwise.</p>
<p>A <em>speech recognizer</em> is a user agent with the following
inputs and outputs:</p>
<ul>
<li>Input: A grammar or multiple grammars as defined by this
specification. These grammars inform the recognizer of the words
and patterns of words to listen for.</li>
<li>Input: An audio stream that may contain speech content that
matches the grammar(s).</li>
<li>Output: Descriptions of <em>results</em> that indicate details
about the speech content detected by the speech recognizer. The
format and details of the content of the result are outside the
scope of this specification. For informative purposes, most
practical recognizers will include at least a transcription of any
detected words.</li>
<li>Output: Error and other performance information may be provided
to the host environment: e.g. to a voice browser that incorporates
a grammar processor. The method of interaction with the host
environment is outside the scope of this document. The
specification does, however, require that a <a href="#S5" shape=
"rect">conformant grammar processor</a> inform the environment of
errors in parsing and other processing of grammar documents.</li>
</ul>
<h3 id="id-S1.2"><a id="S1.2" name="S1.2" shape="rect">1.2
Scope</a></h3>
<p>The primary use of a speech recognizer grammar is to permit a
speech application to indicate to a recognizer what it should
listen for, specifically:</p>
<ul>
<li>Words that may be spoken,</li>
<li>Patterns in which those words may occur,</li>
<li>Spoken language of each word.</li>
</ul>
<p>Speech recognizers may also support the Stochastic Language
Models (N-Gram) Specification <a href="#ref-ngram" shape=
"rect">[NGRAM]</a>. Both specifications define ways to set up a
speech recognizer to detect spoken input but define the word and
patterns of words by different and complementary means. Some
recognizers permit cross-references between grammars in the two
formats. The <a href="#S2.2" shape="rect">rule reference</a>
element of this specification describes how to reference an N-gram
document.</p>
<p>The grammar specification <em>does not address</em> a number of
other issues that affect speech recognition performance. Most of
the following capabilities are addressed by the context in which a
grammar is referenced or invoked: for example, through VoiceXML 2.0
<a href="#ref-vxml2" shape="rect">[VXML2]</a> or through a speech
recognizer API.</p>
<ul>
<li><em>Speaker adaptation data:</em> Some speech recognizers
support the ability to dynamically adjust to the voice of a speaker
and often the ability to store adaptation data for that voice for
future use. The speaker data may also include lists of words more
often spoken by the user. The grammar format does not explicitly
address these capabilities.</li>
<li><em>Speech recognizer configuration:</em> The grammar format
does not incorporate features for setting recognizer features such
as timeouts, recognition thresholds, search sizes or N-best result
counts.</li>
<li><em>Lexicon:</em> The grammar format does not address the
loading of lexicons or the pronunciation of words referenced by the
grammar. The W3C Voice Browser Working Group is considering the
development of a standard lexicon format. If and when a format is
developed appropriate updates will be made to this grammar
specification.</li>
<li><em>Other speech processing capabilities:</em> Speech
processing technology exists for language identification, speaker
verification (also known as voice printing), speaker recognition
(also known as speaker identification) amongst many other
capabilities. Although these technologies may be associated with a
speech recognizer they are outside the scope of this
specification.</li>
</ul>
<h3 id="id-S1.3"><a id="S1.3" name="S1.3" shape="rect">1.3 Grammar
Conversions</a></h3>
<p>The ABNF Form and XML Form <span>are</span> specified to ensure
that the two representations are semantically mappable. It should
be possible to automatically convert an ABNF Form grammar to an XML
Form grammar (or the reverse) so that the semantic performance of
the grammars are identical. Equivalence of semantic performance
implies that:</p>
<ol>
<li>Both grammars accept the same language as input and reject the
same language as input</li>
<li>Both grammars parse any input string identically</li>
</ol>
<p>The XSL Transformation document in <a href="#AppF" shape=
"rect">Appendix F</a> demonstrates automatic conversion from XML to
ABNF. The reverse conversion requires an ABNF parser and a
transformational program.</p>
<p>There are inherent limits to the automatic conversion to and
From ABNF Form and XML Form.</p>
<ul>
<li>Formatting <a href="#term-whitespace" shape="rect">white
space</a> cannot be preserved so a pretty-printable grammar in one
Form cannot guarantee automatic conversion to a pretty-printable
grammar in the other Form. Note: syntactically significant white
space is preserved.</li>
<li>Some XML constructs have no equivalent in ABNF: XML Schema, DTD,
character and entity declarations and references, processing
instructions, namespaces. The XML parser in a <a href="#S5.4"
shape="rect">conforming grammar processor</a> should expand all
character and entity references as defined in XML 1.0 <a href=
"#ref-xml" shape="rect">[XML]</a> prior to conversion to ABNF;
other constructs are lost. RDF <a href="#ref-rdf-syntax" shape=
"rect">[RDF-SYNTAX]</a> represents metadata as XML within XML Form
grammar but could not be effectively utilized in ABNF Form grammars
and so is not supported.</li>
<li>Comment ordering with respect to grammar constructs may be
modified.</li>
</ul>
<h3 id="id-S1.4"><a id="S1.4" name="S1.4" shape="rect">1.4 Semantic
Interpretation</a></h3>
<p>A speech recognizer is capable of matching audio input against a
grammar to produce a <em>raw text</em> transcription (also known as
<em>literal text</em>) of the detected input. A recognizer may be
capable of, but is not required to, perform subsequent processing
of the raw text to produce a <em>semantic interpretation</em> of
the input.</p>
<p>For example, the natural language utterance <em>"I want to book
a flight from Prague to Paris"</em> could result in the following
XML data structure. To perform this additional interpretation step
requires semantic processing instructions that may be contained
within a grammar that defines the legal spoken input or in an
associated document.</p>
<pre class="xml" xml:space="preserve">
  &lt;book-flight&gt;
    &lt;depart&gt;Prague&lt;/depart&gt;
    &lt;arrive&gt;Paris&lt;/arrive&gt;
  &lt;/book-flight&gt;
</pre>
<p>The Speech Recognition Grammar Specification provides syntactic
support for limited semantic interpretation. The <a href="#S2.6"
shape="rect"><code>tag</code></a> construct and the <a href="#S4.8"
shape="rect"><code>tag-format</code></a> <span>and <a href="#S4.12"
shape="rect"><code>tag</code></a></span> declarations provide a
placeholder for instructions to a semantic processor.</p>
<p>The <a href="http://www.w3.org/Voice/" shape="rect">W3C Voice
Browser Working Group</a> is presently developing the <em>Semantic
Interpretation for Speech Recognition</em> specification <a href=
"#ref-sem" shape="rect">[SEM]</a>. That specification defines a
language that can be embedded in tags within SRGS grammars to
perform the interpretation process. The semantic processing is
defined with respect to the <a href="#AppH" shape=
"rect"><em>logical parse structure</em></a> for grammar processing
(see <a href="#AppH" shape="rect">Appendix H</a>). Other tag
formats could be used but are outside the scope of the W3C
activities.</p>
<p>For examples of semantic interpretation in the latest working
draft see <a href="#ref-sem" shape="rect">[SEM]</a>.</p>
<p>The output of the semantic interpretation processor may be
represented using the <em>Natural Language Semantics Markup
Language</em> <a href="#ref-nlsml" shape="rect">[NLSML]</a>. This
XML representation of interpreted spoken input can be used to
transmit the result, as input to <em>VoiceXML 2.0</em> <a href=
"#ref-vxml2" shape="rect">[VXML2]</a> processing or in other
ways.</p>
<p>The semantic interpretation carried out in the speech
recognition process is typically characterized by:</p>
<ul>
<li><em>Restricted context:</em> the interpretation does not
resolve deictic or anaphoric references or other language forms
that span more than a single utterance. Example: if the utterance
<em>"I want to book a flight from Prague to Paris"</em> were
followed later by <em>"I want to continue from there to
London"</em> the reference to <em>"there"</em> could be resolved to
<em>"Paris"</em>. This requires analysis spanning more than one
utterance and is typically outside the scope of the speech
recognizer, but in scope for a dialog manager (e.g. a VoiceXML
application).</li>
<li><em>Domain-specific:</em> a speech recognition grammar is
typically restricted to a narrow domain of input (e.g. collect
flight booking data). Within this domain semantic interpretation is
an achievable task whereas semantic interpretation for an entire
language is an extraordinarily complex task.</li>
<li><em>Language-specific:</em> because each language has unique
linguistic structures the process of converting from a raw text to
a semantic result is necessarily language-specific.</li>
</ul>
<p>It is this restricted form of semantic interpretation that this
approach is intended to support. A VoiceXML application that
receives a speech result with semantic interpretation will
typically process the user input to carry out a dialog. The
application may also perform deeper semantic analysis, for example
resolving deictic or anaphoric references.</p>
<h3 id="id-S1.5"><a id="S1.5" name="S1.5" shape="rect">1.5 Embedded
Grammars</a></h3>
<p>The Speech Recognition Grammar Specification is designed to
permit ABNF Form and XML Form grammars to be embedded into other
documents. For example, VoiceXML 1.0 <a href="#ref-vxml1" shape=
"rect">[VXML1]</a> and VoiceXML 2.0 <a href="#ref-vxml2" shape=
"rect">[VXML2]</a> permit <a href=
"http://www.w3.org/TR/voicexml20/#dml3.1.1.1" shape="rect">inline
grammars</a> <a href="#ref-vxml2" shape="rect">[VXML2
&sect;3.1.1.1]</a> in which an ABNF Form grammar or XML Form
grammar is contained within a VoiceXML document.</p>
<p>Embedding an XML Form grammar within an XML document can be
achieved with XML namespaces <a href="#ref-xmlns" shape=
"rect">[XMLNS]</a> or by incorporating the grammar <a href="#AppC"
shape="rect">XML Schema definition</a> or <a href="#AppB" shape="rect">DTD</a>
into to enclosing document's schema or DTD.</p>
<p>An ABNF Form grammar may be embedded into any XML document as
character data. ABNF grammars will often contain angle brackets
which require special handling within XML. A <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-cdata-sect" shape=
"rect">CDATA</a> section <a href="#ref-xml" shape="rect">[XML
&sect;2.7]</a> or the escape sequences of "<code>&amp;lt;</code>"
and "<code>&amp;gt;</code>" may be required to create well-formed
XML. Note: angle brackets ('&lt;' and '&gt;') are used in ABNF to
delimit any <a href="#term-uri" shape="rect">URI</a>, <a href=
"#term-media-type" shape="rect">media type</a> or <a href="#S2.5"
shape="rect">repeat operator</a>.</p>
<h3 id="id-S1.6"><a id="S1.6" name="S1.6" shape="rect">1.6
Terminology</a></h3>
<dl>
<dt><b><em><a id="term-requirements" name="term-requirements"
shape="rect">Requirements terms</a></em></b></dt>
<dd>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL"
in this document are to be interpreted as described in <a href=
"#ref-rfc2119" shape="rect">[RFC2119]</a>. However, for
readability, these words do not appear in all uppercase letters in
this specification.</dd>
<dt><br clear="none" />
<b><em><a id="term-uri" name="term-uri" shape="rect">URI: Uniform
Resource Identifier</a></em></b></dt>
<dd>A URI is a unifying syntax for the expression of names and
addresses of objects on the network as used in the World Wide Web.
A URI is defined as any legal '<code><a href=
"http://www.w3.org/TR/xmlschema-2/#anyURI" shape=
"rect">anyURI</a></code> ' primitive as defined in XML Schema Part
2: Datatypes <a href="#ref-schema2" shape="rect">[SCHEMA2
&sect;3.2.17]</a>. The XML Schema definition follows <a href=
"#ref-rfc2396" shape="rect">[RFC2396]</a> and <a href=
"#ref-rfc2732" shape="rect">[RFC2732]</a>. The syntax
representation of a URI differs between the ABNF Form and the XML
Form. Any relative URI reference must be resolved according to the
rules given in <a href="#S4.9.1" shape="rect">Section 4.9.1</a>.
<ul>
<li><b>ABNF URI</b>: in the ABNF Form of this specification a URI
is delimited by angle brackets ('&lt;' '&gt;'). For example,
<code>&lt;http://www.example.com/file-path&gt;</code></li>
<li><b>XML URI</b>: in the XML Form of this specification any URI
is provided as an attribute to an element; for example the <a href=
"#S2.2" shape="rect"><code>ruleref</code></a> and <a href="#S4.10"
shape="rect"><code>lexicon</code></a> elements.</li>
</ul>
</dd>
<dt><br clear="none" />
<b><em><a id="term-media-type" name="term-media-type" shape=
"rect">Media Type</a></em></b></dt>
<dd>A <em>media type</em> (defined in <a href="#ref-rfc2045" shape=
"rect">[RFC2045]</a> and <a href="#ref-rfc2046" shape=
"rect">[RFC2046]</a>) specifies the nature of a linked resource.
Media types are case insensitive. A list of registered media types
is available for download <a href="#ref-mimetypes" shape=
"rect">[TYPES]</a>. In places where a URI can be specified a media
type may be provided to indicate the content type of <a href=
"#term-uri" shape="rect">URI</a>.
<p>[See <a href="#AppG" shape="rect">Appendix G</a> for information
on media types for the ABNF and XML Forms of the Speech Recognition
Grammar Specification.]</p>
<ul>
<li><b>ABNF URI with Media Type</b>: in the ABNF Form a media type
may be attached as a postfix to any URI. The media type is
delimited by angle brackets ('&lt;' '&gt;') and the URI and media
type are separated by a tilde character ('~') without intervening
<a href="#term-whitespace" shape="rect">white space</a>. For
example,<br clear="none" />
<code>&lt;http://example.com/file-path&gt;~&lt;media-type&gt;</code></li>
<li><b>XML URI with Media Type</b>: in the XML Form any element
that carries a URI attribute may carry a <code>type</code>
attribute.</li>
</ul>
</dd>
<dt><br clear="none" />
<b><em><a id="term-language" name="term-language" shape=
"rect">Language identifier</a></em></b></dt>
<dd>A <em>language identifier</em> labels information content as
being of a particular human language variant. Following the
<a href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-lang-tag"
shape="rect">XML specification for language identification</a>
<a href="#ref-xml" shape="rect">[XML &sect;2.12]</a> a legal
language identifier in ABNF Form grammars and XML Form grammars is
identified by an RFC 3066 <a href="#ref-rfc3066" shape=
"rect">[RFC3066]</a> code. A language code is required by RFC 3066.
A country code or other subtag identifier is optional by RFC 3066.
A grammar's <a href="#S4.5" shape="rect">language declaration</a>
declares the language of a grammar. Additionally a legal rule
expansion may be labeled by its <a href="#S2.7" shape=
"rect">language content</a>.</dd>
<dt><br clear="none" />
<b><em><a id="term-whitespace" name="term-whitespace" shape=
"rect">White space</a></em></b></dt>
<dd>White space consists of one or more space (#x20) characters,
carriage returns, line feeds, or tabs. The normative definition for
both ABNF and XML follows the <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-common-syn" shape=
"rect">XML <em>white space</em> definition</a> <a href="#ref-xml"
shape="rect">[XML &sect;2.3]</a>. ABNF processors must also follow
the <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-line-ends" shape=
"rect">end-of-line handling</a> of XML 1.0 <a href="#ref-xml"
shape="rect">[XML &sect;2.11]</a>.</dd>
<dt><br clear="none" />
<b><em><a id="term-dtmf" name="term-dtmf" shape=
"rect">DTMF</a></em></b></dt>
<dd>DTMF (Dual Tone Multiple Frequency) is an <a href=
"http://www.itu.int/" shape="rect">ITU</a> standard for telephony
signaling. ITU Recommendation Q.23 defines DTMF generation. ITU
Recommendation Q.24 <a href="#ref-q24" shape="rect">[Q24]</a>
defines DTMF reception. A grammar processor that accepts DTMF input
should implement Q.24.</dd>
</dl>
<h2 id="id-S2"><a id="S2" name="S2" shape="rect">2. Rule
Expansions</a></h2>
<ul>
<li class="tocline">2.1 <a href="#S2.1" shape=
"rect">Tokens</a></li>
<li class="tocline">2.2 <a href="#S2.2" shape="rect">Rule
References</a>
<ul>
<li class="tocline">2.2.1 <a href="#S2.2.1" shape="rect">Local
References</a></li>
<li class="tocline">2.2.2 <a href="#S2.2.2" shape="rect">External
Reference by URI</a></li>
<li class="tocline">2.2.3 <a href="#S2.2.3" shape="rect">Special
Rules</a></li>
<li class="tocline">2.2.4 <a href="#S2.2.4" shape=
"rect">Referencing N-gram Documents</a></li>
</ul>
</li>
<li class="tocline">2.3 <a href="#S2.3" shape="rect">Sequences and
Encapsulation</a></li>
<li class="tocline">2.4 <a href="#S2.4" shape=
"rect">Alternatives</a>
<ul>
<li class="tocline">2.4.1 <a href="#S2.4.1" shape=
"rect">Weights</a></li>
</ul>
</li>
<li class="tocline">2.5 <a href="#S2.5" shape="rect">Repeats</a>
<ul>
<li class="tocline">2.5.1 <a href="#S2.5.1" shape="rect">Repeat
Probabilities</a></li>
</ul>
</li>
<li class="tocline">2.6 <a href="#S2.6" shape="rect">Tags</a></li>
<li class="tocline">2.7 <a href="#S2.7" shape=
"rect">Language</a></li>
<li class="tocline">2.8 <a href="#S2.8" shape=
"rect">Precedence</a></li>
</ul>
<p>A <em>legal rule expansion</em> is any legal <a href="#S2.1"
shape="rect">token</a>, <a href="#S2.2" shape="rect">rule
reference</a>, <a href="#S2.6" shape="rect">tag</a>, or any logical
combination of legal rule expansions as <a href="#S2.3" shape=
"rect">sequence</a>, <a href="#S2.4" shape="rect">alternatives</a>,
<a href="#S2.5" shape="rect">repeated expansion</a> or <a href=
"#S2.7" shape="rect">language-attributed expansion</a>.</p>
<p>A rule expansion is formally a <em>regular expression</em> (see,
for example, <a href="#ref-hu79" shape="rect">[HU79]</a>).</p>
<p>A <a href="#S3" shape="rect"><em>rule definition</em></a>
associates a legal rule expansion with a rulename.</p>
<h3 id="id-S2.1"><a id="S2.1" name="S2.1" shape="rect">2.1
Tokens</a></h3>
<p>A <em>token</em> (a.k.a. a terminal symbol) is the part of a
grammar that defines words or other entities that may be spoken.
Any legal token is a <a href="#S2" shape="rect">legal
expansion</a>.</p>
<p>For speech recognition, a token is typically an orthographic
entity of the <a href="#S2.7" shape="rect">language</a> being
recognized. However, a token may be any string that the speech
recognizer can convert to a phonetic representation.</p>
<p><a id="token-content" name="token-content" shape="rect"></a>
<em>Token Content:</em> In both the <a href="#S2.1-xml" shape=
"rect">XML Form</a> and <a href="#S2.1-abnf" shape="rect">ABNF
Form</a> any unmarked text within a rule definition, except
<a href="#S3.3" shape="rect">example phrases</a> (XML only) or
<a href="#S2.6" shape="rect">tag content</a>, is <em>token
content</em>. The unmarked text is delimited by any syntactic
construct of the grammar form (see below for details on the ABNF
Form and XML Form). For each token content span in a grammar the
grammar processor applies the following <a href="#tokenization"
shape="rect">tokenization</a>, <a href="#ws-normalization" shape=
"rect">white space normalization</a>, <a href=
"#token-normalization" shape="rect">token normalization</a> and
<a href="#pron-lookup" shape="rect">pronunciation lookup</a>
processes. All token content in both the XML Form and ABNF Form is
treated as <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#charsets" shape=
"rect">Characters</a> in <a href="#ref-xml" shape="rect">[XML]</a>.
(informative: XML specifies Characters by reference to ISO/IEC
10646 <a href="#ref-iso10646" shape="rect">[ISO/IEC 10646]</a> and
Unicode <a href="#ref-unicode" shape="rect">[Unicode]</a>.)</p>
<a id="tokenization" name="tokenization" shape="rect"></a>
<p><em>Tokenization behavior</em>: Text spans containing token
sequences are delimited as follows:</p>
<ul>
<li>XML Form only: a &lt;token&gt; element may contain character
data only. The character data is treated as a single unnormalized
token. The character data must not contain any double quote
characters.</li>
<li>Any token in ABNF Form or XML Form (except within &lt;token&gt;
element in XML Form) may be delimited by double quotes. The text
contained within the double quotes is an unnormalized token. The
text must not contain any double quote characters. A token
delimited by double quotes may contain white space.</li>
<li>Any token content not delimited by a &lt;token&gt; element or
double quotes is treated as a sequence of white-space-delimited
tokens. Each token contained in the token content is delimited at
the start and at the end by any white space character or any
syntactic construct that delimits a token content span. The
syntactic constructs that delimit token content are different for
the ABNF Form and XML Form. These tokens cannot contain white space
characters.</li>
</ul>
<table border="1" cellpadding="3" summary="Token Syntax Examples">
<tr>
<td colspan="1" rowspan="1"><b>Token type</b></td>
<td colspan="1" rowspan="1"><b>Form</b></td>
<td colspan="1" rowspan="1"><b>Example</b></td>
</tr>
<tr>
<td colspan="1" rowspan="1">Single unquoted token</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">hello</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Single unquoted token:
non-alphabetic</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">2</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Single quoted token: including white
space</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">"San Francisco"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Single quoted token: no white
space</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">"hello"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Two tokens delimited by white
space</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">bon voyage</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Four tokens delimited by white
space</td>
<td colspan="1" rowspan="1">ABNF &amp; XML</td>
<td colspan="1" rowspan="1">this is a test</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Single XML token in &lt;token&gt;</td>
<td colspan="1" rowspan="1">XML Only</td>
<td colspan="1" rowspan="1">&lt;token&gt;San
Francisco&lt;/token&gt;</td>
</tr>
</table>
<a id="ws-normalization" name="ws-normalization" shape="rect"></a>
<p><em>White Space Normalization:</em> White space must be
normalized when contained in any token delimited by a &lt;token&gt;
elements or by double quotes. Leading and trailing white space
characters are stripped. Any token-internal white space character
or sequence is collapsed to a single space character (#x20). For
example, the following are all normalized to the same string, "San
Francisco".</p>
<pre class="abnf" xml:space="preserve">
  "San Francisco"
  " San Francisco "
  "San 
  Francisco"
  " San   Francisco "
</pre>
<p>Because the presence of white space within a token is
significant the following are distinct tokens.</p>
<pre class="abnf" xml:space="preserve">
  "San Francisco"
  "SanFrancisco"
  "San_Francisco"
</pre>
<a id="token-normalization" name="token-normalization" shape=
"rect"></a>
<p><em>Token Normalization:</em> Other normalization processes are
applied to the white space normalized token according to the
language and the capabilities of the speech recognizer.</p>
<p>Grammar processors may assume <a href=
"http://www.w3.org/TR/2003/WD-charmod-20030822/#sec-Normalization" shape=
"rect">Early Uniform Normalization</a> as defined in the Character
Model for the World Wide Web 1.0 <a href="#ref-charmod" shape=
"rect">[CHARMOD &sect;4]</a>.</p>
<a id="pron-lookup" name="pron-lookup" shape="rect"></a>
<p><em>Pronunciation Lookup:</em> To match spoken (audio) input to
a grammar a speech recognition must be capable of modelling the
audio patterns of any token in a grammar. Speech recognizers employ
a diverse set of techniques for performing this key recognition
process. The following is an informative description of techniques
that a speech recognizer may apply based on conventional large
vocabulary speech recognition technology.</p>
<p>A large vocabulary speech recognizer converts each normalized
token to a phoneme sequence or a set of possible phoneme sequences.
Conversion of an orthographic form (token) to the spoken form
(phonemes) is a highly language-specific process. In many cases the
conversion is even specific to a national variant, regional dialect
or other variant of the language. For example, for some tokens
Parisian French, Quebec French and Swiss French will each convert
to different pronunciations.</p>
<p>The text-to-phoneme conversion in a large vocabulary speech
recognizer may involve some or all of the following
sub-processes.</p>
<ul>
<li><em>Pronunciation lexicon lookup:</em> One of possibly many
lexicons available to a recognizer can provide the phoneme sequence
for a token. Both the ABNF Form and XML Form permit a grammar to
specify one or more <a href="#S4.10" shape="rect">lexicon</a>
documents. Recognizers typically provide a built-in lexicon for
each supported language though the coverage will vary between
recognizers. The algorithm by which the lookup resolves a token to
a pronunciation is defined by the lexicon format and/or the speech
recognizer and may be language-specific. Case-insensitive string
matching is recommended.</li>
<li><em>Morphological analysis:</em> a recognizer may be capable of
determining the transformation from a base token and phoneme string
to a morphological variant and its pronunciation. For example given
the pronunciation for "Hyundai" a rule could infer the
pronunciation for the pluralized form "Hyundai's".</li>
<li><em>Automatic text-to-phoneme conversion:</em> for many, but
not all, languages and scripts there are rules that automatically
convert a token into a phoneme sequence. For example, in English
most but not all words ending with the letter sequence "ise" end
with the phoneme sequence "ai z". A speech recognizer may use
automated conversion to infer pronunciations for tokens that cannot
be looked up in a lexicon.</li>
</ul>
<p>Any language is likely to have other specialized processes for
determining a pronunciation for a token. For example, for Japanese
special techniques are required for Kanji and each Kana form.</p>
<p>For any language and recognizer there may be variation in
coverage and completeness of the language's tokens.</p>
<p>When a grammar processor handles a grammar containing a token
that it cannot convert to phonemic form or otherwise use in the
speech recognition processing of audio it should inform the hosting
environment.</p>
<a id="token-limitations" name="token-limitations" shape=
"rect"></a>
<p><em>Limitations of token handling:</em> the following is
informative guidance to grammar developers.</p>
<p>The Pronunciation Lexicon activity <a href="#ref-lex" shape=
"rect">[LEX]</a> of the W3C Voice Browser Working Group will
provide guidance on the token-handling processes outlined
above.</p>
<p>Token handling will vary between recognizers and will vary
between languages.</p>
<p>Grammar authors can improve document portability by avoiding
characters and forms in tokens that do not have obvious
pronunciations in the language. For English, the following are ways
to handle some orthographic forms:</p>
<ul>
<li>Acronyms should be avoided. Alphabetic characters should be
widely available. For example, replace "USA" by "u s a"; replace
"W3C" by "w three c"; replace "IEEE" by "i triple e".</li>
<li>Abbreviations should be replaced by the unabbreviated form. For
example, replace "Dr." by "drive" or "doctor".</li>
<li>Most punctuation should be expanded to a spelled form. For
example replace "&amp;" by "ampersand" or "and"; replace "+" by
"plus"; replace "&lt;" by "less than" or "open angle bracket".</li>
<li>A grammar processor should support digits (e.g. "0" though "9"
for European scripts). Other natural numbers should be replaced by
spelled forms. For example, for US English replace "10" by "ten"
and "1000" by "thousand".</li>
<li>Grammar authors should consider the possibility that a grammar
will be used to interpret input in a non-speech recognition device.
For example, grammars can be used to process text strings from
keyboard input, text telephone services, pen input and other text
modalities. To facilitate text input a grammar should contain
standard orthographic tokens of the language. That is, to
facilitate non-speech recognition input the grammar should contain
standard spellings of natural language words to the greatest extent
possible.</li>
</ul>

<h4 id="id-S2.1-abnf"><a id="S2.1-abnf" name="S2.1-abnf" shape=
"rect">ABNF Form</a></h4>
<p>Any plain text within a rule definition is <a href=
"#token-content" shape="rect">token content</a>. The <a href=
"#AppD" shape="rect">ABNF Syntax (Appendix D)</a> normatively
defines the token parsing behavior.</p>
<p>A <a href="#S2.7-abnf" shape="rect">language attachment</a> may
be provided for any token. When attached to a token the language
modifies the handling of that token only.</p>
<p><em>Informative</em></p>
<p>The rule expansion of a <a href="#S3.1" shape="rect">rule
definition</a> is delimited at the start and end by equals sign
('=') and semicolon (';') respectively. Any leading plain text of
the rule expansion is delimited by ('=') and similarly any final
plain text is closed by semicolon.</p>
<p>Within a rule expansion the following symbols have syntactic
function and delimit plain text.</p>
<ul>
<li>Dollar sign ('$') and angle brackets ('&lt;' and '&gt;') when
needed mark <a href="#S2.2" shape="rect">rule references</a></li>
<li>Parentheses ('(' and ')') may enclose any <a href="#S2.3"
shape="rect">rule expansion</a></li>
<li>Vertical bar ('|') delimits <a href="#S2.4" shape=
"rect">alternatives</a></li>
<li>Forward slashes ('/' and '/') delimit any <a href="#S2.4.1"
shape="rect">weights</a> on alternatives</li>
<li>Angle brackets ('&lt;' and '&gt;') delimit any <a href="#S2.5"
shape="rect">repeat operator</a></li>
<li>Square brackets ('[' and ']') delimit any <a href="#S2.5"
shape="rect">optional expansion</a></li>
<li>Curly brackets ('{' and '}') delimit any <a href="#S2.6" shape=
"rect">tag</a></li>
<li>Exclamation point ('!') prefixes any <a href="#S2.7" shape=
"rect">language identifier</a></li>
</ul>
<p>Within plain text regions delimited by these characters the
<a href="#tokenization" shape="rect">tokenization</a>, <a href=
"#ws-normalization" shape="rect">white space normalization</a>,
<a href="#token-normalization" shape="rect">token normalization</a>
and <a href="#pron-lookup" shape="rect">pronunciation lookup</a>
processes described above apply.</p>
<h4 id="id-S2.1-xml"><a id="S2.1-xml" name="S2.1-xml" shape=
"rect">XML Form</a></h4>
<p>Any <code>token</code> element explicitly delimits a <a href=
"#S2.1" shape="rect">single token</a> as described above. The
<code>token</code> element may include an optional <a href=
"#S2.7-xml" shape="rect"><code>xml:lang</code></a> attribute to
indicate the <a href="#S2.7" shape="rect">language</a> of the
contained token.</p>
<p>Any other character data within a <a href="#S3.1" shape=
"rect">rule</a> element (rule definition) or <a href="#S2.3" shape=
"rect">item</a> element is <a href="#token-content" shape=
"rect">token content</a>. Note that character data within <a href=
"#S2.6" shape="rect">tag</a> or <a href="#S3.3" shape=
"rect">example</a> is not token text.</p>

<h3 id="id-S2.2"><a id="S2.2" name="S2.2" shape="rect">2.2 Rule
Reference</a></h3>
<p>Any legal rule reference is a <a href="#S2" shape=
"rect"><em>legal rule expansion</em></a> .</p>
<p><em>Rulenames</em>: Every <a href="#S3.1" shape="rect">rule
definition</a> has a local name that must be unique within the
scope of the grammar in which it is defined. A rulename must match
the <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-common-syn" shape=
"rect">"Name" Production</a> of XML 1.0 <a href="#ref-xml" shape=
"rect">[XML &sect;2.3]</a> and be a legal XML ID. <a href="#S3.1"
shape="rect">Section 3.1</a> documents the rule definition
mechanism and the legal naming of rules.</p>
<p>This table summarizes the various forms of rule reference that
are possible within and across grammar documents.</p>
<p>Note: an XML Form grammar document must provide one and only one
of the <code>uri</code> or <code>special</code> attributes on a
<code>ruleref</code> element. There is no equivalent constraint in
ABNF since the syntactic forms are distinct.</p>
<table cellpadding="3" border="1" summary="Rule Reference Syntax">
<tbody>
<tr>
<td rowspan="1" colspan="1"><b>Reference type</b></td>
<td rowspan="1" colspan="1"><b>ABNF Form</b></td>
<td rowspan="1" colspan="1"><b>XML Form</b></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.1">2.2.1</a>:
<span>Explicit</span> local rule reference</td>
<td rowspan="1" colspan="1"><code>$rulename</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref
uri="#rulename"/&gt;</code></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.2">2.2.2</a>:
<span>Explicit</span> reference to a named rule of a
grammar identified by a <a href="#term-uri">URI</a></td>
<td rowspan="1" colspan="1">
<code>$&lt;grammarURI#rulename&gt;</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref
uri="grammarURI#rulename"/&gt;</code></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.2"
shape="rect">2.2.2</a>: <span>Implicit</span> reference to the
root rule of a grammar identified by a
<a href="#term-uri">URI</a></td>
<td rowspan="1" colspan="1"><code>$&lt;grammarURI&gt;</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref
uri="grammarURI"/&gt;</code></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.2">2.2.2</a>:
<span>Explicit</span> reference to a named rule of a grammar
identified by a <a href="#term-uri">URI</a> with a <a href=
"#term-media-type">media type</a></td>
<td rowspan="1" colspan="1">
<code>$&lt;grammarURI#rulename&gt;~&lt;media-type&gt;</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref
uri="grammarURI#rulename" type="media-type"/&gt;</code></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.2">2.2.2</a>:
<span>Implicit</span> reference to the root rule of a grammar
identified by a <a href="#term-uri">URI</a> with a <a href=
"#term-media-type">media type</a></td>
<td rowspan="1" colspan="1">
<code>$&lt;grammarURI&gt;~&lt;media-type&gt;</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref uri="grammarURI"
type="media-type"/&gt;</code></td>
</tr>
<tr>
<td rowspan="1" colspan="1"><a href="#S2.2.3">2.2.3</a>:
Special rule definitions</td>
<td rowspan="1" colspan="1"><code>$NULL<br clear="none" />
$VOID<br clear="none" />
$GARBAGE</code></td>
<td rowspan="1" colspan="1"><code>&lt;ruleref
special="NULL"/&gt;<br clear="none" />
&lt;ruleref special="VOID"/&gt;<br clear="none" />
&lt;ruleref special="GARBAGE"/&gt;</code></td>
</tr>
</tbody>
</table>
<h4 id="id-S2.1.1"><a id="S2.2.1" name="S2.2.1" shape="rect">2.2.1
Local References</a></h4>
<p>When referencing rules defined locally (defined in the same
grammar as contains the reference), always use a simple rulename
reference which consists of the local rulename only. The ABNF Form
and XML Form have a different syntax for representing a simple
rulename reference.</p>
<blockquote>
<h4 id="id-S2.1.1-abnf">ABNF Form</h4>
<p>The simple rulename reference is prefixed by a "$"
character.</p>
<pre class="abnf" xml:space="preserve">
$city
$digit
</pre>
<h4 id="id-S2.1.1-xml">XML Form</h4>
<p>The <code>ruleref</code> element is an empty element with a
<code>uri</code> attribute that specifies the rule reference as a
<em>same-document reference <a href="#term-uri" shape=
"rect">URI</a></em> <a href="#ref-rfc2396" shape=
"rect">[RFC2396]</a>: that is, the attribute consists only of the
number sign ('#') and the fragment identifier that indicates the
locally referenced rulename.</p>
<pre class="xml" xml:space="preserve">
&lt;ruleref uri="#city"/&gt;
&lt;ruleref uri="#digit"/&gt;
</pre></blockquote>
<h4 id="id-S2.2.2"><a id="S2.2.2" name="S2.2.2" shape="rect">2.2.2
External Reference by URI</a></h4>
<p>References to rules defined in other grammars are legal under
the conditions defined in <a href="#S3" shape="rect">Section 3</a>.
The external reference must identify the external grammar by
<a href="#term-uri" shape="rect">URI</a> and may identify a
specific rule within that grammar. If the fragment identifier that
would indicate a rulename is omitted, then the reference
<span>implicitly</span> targets the <a href="#S4.7" shape=
"rect"><code>root</code></a> rule of the external grammar.</p>
<p>Any externally-referenced rule may be <em>activated</em> for
recognition. That is it may define the top-level syntax of spoken
input. For instance, VoiceXML <a href="#ref-vxml2" shape=
"rect">[VXML2]</a> grammar activation may explicitly reference one
or more public rules (see <a href="#S3.2" shape="rect">Section
3.2</a>) and/or implicitly reference the root rule (see <a href=
"#S4.7" shape="rect">Section 4.7</a>).</p>
<p>A URI reference is illegal if the referring document and
referenced document have different modes. For instance, it is
illegal to reference a "dtmf" grammar from a "voice" grammar. (See
<a href="#S4.6" shape="rect">Section 4.6</a> for additional detail
on modes).</p>
<p><span>A resource indicated by an <a href="#term-uri" shape=
"rect">URI</a> reference may be available in one or more <a href=
"#term-media-type" shape="rect">media types</a>. The grammar author
may specify the preferred media-type via the <code>type</code>
attribute (XML form) or in angle braces following the URI (ABNF
form).</span>When the content represented by a URI is available in
many data formats, a grammar processor may use the <span>preferred
media-</span>type to influence which of the multiple formats is
used. For instance, on a server implementing HTTP content
negotiation, the processor may use the <span>preferred
media-</span>type to order the preferences in the negotiation.</p>
<p>The resource representation delivered by dereferencing the URI
reference may be considered in terms of two types. The
<i>declared media-type</i> is the asserted value for the resource
and the <i>actual media-type</i> is the true format of its content.
The actual media-type should be the same as the declared
media-type, but this is not always the case (e.g. a misconfigured
HTTP server might return <code>text/plain</code> for an
<code>application/srgs+xml</code> document). A specific URI scheme
may require that the resource owner always, sometimes, or never
return a media-type. The declared media-type is the value returned
by the resource owner or, if none is returned, the preferred media
type given in the grammar. There may be no declared media-type if
the resource owner does not return a value and no preferred type is
specified. Whenever specified, the declared media-type is
authoritative.</p>
<p>Three special cases may arise. The declared media-type may not
be supported by the processor; this is an error. The declared
media-type may be supported but the actual media-type may not
match; this is also an error. Finally, there may be no declared
media-type; the behavior depends on the specific URI scheme and the
capabilities of the grammar processor. For instance, HTTP 1.1
allows document introspection (see <a href="#ref-rfc2616" shape=
"rect">RFC 2616</a>, section 7.2.1), the data scheme falls back to
a default media type, and local file access defines no guidelines.
The following table provides some informative examples:</p>
<table width="100%" border="1" cellpadding="3" summary=
"Media type examples">
<tr>
<td width="20%" rowspan="1" colspan="1"></td>
<td colspan="2" rowspan="1">
<div align="center"><b>HTTP 1.1 request</b></div>
</td>
<td colspan="2" rowspan="1">
<div align="center"><b>Local file access</b></div>
</td>
</tr>
<tr>
<td width="20%" rowspan="1" colspan="1">Media-type returned by the
resource owner</td>
<td width="20%" rowspan="1" colspan="1">text/plain</td>
<td width="20%" rowspan="1" colspan="1">application/srgs+xml</td>
<td width="20%" rowspan="1" colspan="1">&lt;none&gt;</td>
<td rowspan="1" colspan="1">&lt;none&gt;</td>
</tr>
<tr>
<td width="20%" rowspan="1" colspan="1">Preferred media-type
appearing in the grammar</td>
<td colspan="2" rowspan="1">Not applicable; the returned type takes
precedence</td>
<td width="20%" rowspan="1" colspan="1">application/srgs+xml</td>
<td rowspan="1" colspan="1">&lt;none&gt;</td>
</tr>
<tr>
<td width="20%" rowspan="1" colspan="1">Declared media-type</td>
<td width="20%" rowspan="1" colspan="1">text/plain</td>
<td width="20%" rowspan="1" colspan="1">application/srgs+xml</td>
<td width="20%" rowspan="1" colspan="1">application/srgs+xml</td>
<td rowspan="1" colspan="1">&lt;none&gt;</td>
</tr>
<tr>
<td width="20%" rowspan="1" colspan="1">Behavior if the actual
media-type is application/srgs+xml</td>
<td width="20%" rowspan="1" colspan="1">Error; the declared and
actual types do not match</td>
<td colspan="2" rowspan="1">The declared and actual types match;
success if application/srgs+xml is supported by the grammar
processor; otherwise an error</td>
<td rowspan="1" colspan="1">Scheme specific; the grammar processor
might introspect the document to determine the type.</td>
</tr>
</table>
<p>See <a href="#AppG" shape="rect">Appendix G</a> for a summary of
the status for media types for ABNF Form and XML Form grammars.</p>
<blockquote>
<h4 id="id-S2.2.2-abnf">ABNF Form</h4>
<p>In ABNF an external reference by URI is represented by a dollar
sign ('$') followed immediately by either an <a href="#term-uri"
shape="rect">ABNF URI</a> or <a href="#term-media-type" shape=
"rect">ABNF URI with media type</a>. There must be no <a href=
"#term-whitespace" shape="rect">white space</a> between the dollar
sign and the URI.</p>
<pre class="abnf" xml:space="preserve">
// References to specific rules of an external grammar
$&lt;http://grammar.example.com/world-cities.gram#canada&gt;
$&lt;http://grammar.example.com/numbers.gram#digit&gt;

// <span>Implicit</span> reference to the root rule of an external grammar
$&lt;../date.gram&gt;

// References with associated media types
$&lt;http://grammar.example.com/world-cities.gram#canada&gt;~&lt;application/srgs&gt;
$&lt;../date.gram&gt;~&lt;application/srgs&gt;
</pre>
<p>Note: the media type of <code>"application/srgs"</code> has been
requested for ABNF Form grammars. See <a href="#AppG" shape=
"rect">Appendix G</a> for details.</p>
<h4 id="id-S2.2.2-xml">XML Form</h4>
<p>An XML rule reference is represented by a <code>ruleref</code>
element with a <code>uri</code> attribute that defines the <a href=
"#term-uri" shape="rect">URI</a> of the referenced grammar and rule
within it. If a fragment identifier is appended then the identifier
indicates a specific rulename being referenced. If the fragment
identifier is omitted then the reference is
<span>(implicitly)</span> to the root rule of the referenced
grammar.</p>
<p>The optional <code>type</code> attribute specifies the <a href=
"#term-media-type" shape="rect">media type</a> of the grammar
containing the reference.</p>
<pre class="xml" xml:space="preserve">
&lt;!-- References to specific rules of an external grammar --&gt;
&lt;ruleref uri="http://grammar.example.com/world-cities.<span>grxml</span>#canada"/&gt;
&lt;ruleref uri="http://grammar.example.com/numbers.<span>grxml</span>#digit"/&gt;

&lt;!-- <span>Implicit</span> reference to the root rule of an external grammar --&gt;
&lt;ruleref uri="../date.<span>grxml</span>"/&gt;

&lt;!-- References with associated media types --&gt;
&lt;ruleref uri="http://grammar.example.com/world-cities.<span>grxml</span>#canada"
         type="application/srgs+xml"/&gt;
&lt;ruleref uri="../date.<span>grxml</span>" type="application/srgs+xml"/&gt;
</pre>
<p>Note: the media type <code>"application/srgs+xml"</code> has
been requested for XML Form grammars. See <a href="#AppG" shape=
"rect">Appendix G</a> for details on media types for grammars.</p>
</blockquote>
<h4 id="id-S2.2.3"><a id="S2.2.3" name="S2.2.3" shape="rect">2.2.3
Special Rules</a></h4>
<p>Several rulenames are defined to have specific interpretation
and processing by a speech recognizer. A grammar must not redefine
these rulenames.</p>
<p>In the ABNF Form a special rule reference is syntactically
identical to a <a href="#S2.2.1" shape="rect">local rule
reference</a>. However, the names of the special rules are
<em>reserved</em> to prevent a <a href="#S3.1" shape="rect">rule
definition</a> with the same name.</p>
<p>In the XML Form a special rulename is represented with the
<code>special</code> attribute on a <code>ruleref</code> element.
It is illegal to provide both the <code>special</code> and the
<code>uri</code> attributes.</p>
<dl>
<dt><b>NULL</b></dt>
<dd>Defines a rule that is automatically matched: that is, matched
without the user speaking any word.
<p>ABNF Form: <code>$NULL</code><br clear="none" />
XML Form: <code>&lt;ruleref special="NULL"/&gt;</code></p>
</dd>
<dt><b>VOID</b></dt>
<dd>Defines a rule that can never be spoken. Inserting VOID into a
sequence automatically makes that sequence unspeakable.
<p>ABNF Form: <code>$VOID</code><br clear="none" />
XML Form: <code>&lt;ruleref special="VOID"/&gt;</code></p>
</dd>
<dt><b>GARBAGE</b></dt>
<dd>Defines a rule that may match any speech up until the next rule
match, the next token or until the end of spoken input. A grammar
processor must accept grammars that contain special references to
GARBAGE. The behavior GARBAGE rule is implementation-specific. A
user agent should be capable of matching arbitrary spoken input up
to the next token but may treat GARBAGE as equivalent to NULL
(match no spoken input).
<p>ABNF Form: <code>$GARBAGE</code><br clear="none" />
XML Form: <code>&lt;ruleref special="GARBAGE"/&gt;</code></p>
<b>Informative example:</b> given suitable definitions of US cities
and states, a speech recognizer may implement the following ABNF
and XML rule definitions to match <em>"Philadelphia in the great
state of Pennsylvania"</em> as well as simply <em>"Philadelphia
Pennsylvania"</em>.
<pre class="abnf" xml:space="preserve">
$location = $city $GARBAGE $state;
</pre>
<pre class="xml" xml:space="preserve">
&lt;rule id="location"&gt;
  &lt;ruleref uri="#city"/&gt;
  &lt;ruleref special="GARBAGE"/&gt;
  &lt;ruleref uri="#state"/&gt;
&lt;/rule&gt;
</pre></dd>
</dl>
<h4 id="id-S2.2.4"><a id="S2.2.4" name="S2.2.4" shape="rect">2.2.4
Referencing N-gram Documents (Informative)</a></h4>
<p>The W3C Voice Browser Working Group has released a Working Draft
for the Stochastic Language Models (N-Gram) Specification <a href=
"#ref-ngram" shape="rect">[NGRAM]</a>. These two specifications
represent different and complementary ways of informing a speech
recognizer of which words and patterns of words to listen for.</p>
<p>A speech recognizer may choose to support the Speech Recognition
N-Gram Grammar Specification in addition to the speech recognition
grammar defined in this document.</p>
<p>If a speech recognizer supports both grammar representations it
may optionally support references between the two formats. Grammars
defined in the ABNF Form or XML Form may reference start symbols of
N-Gram documents and vice versa.</p>
<p>The syntax for referencing an N-Gram is the same as referencing
externally defined ABNF Form or XML Form grammar documents. A media
type is recommended on a reference to an N-gram document. The
Working Group has not yet applied for a type on N-gram documents so
no example is given. The fragment identifier (a rulename when
referencing ABNF Form and XML Form grammars) identifies a <em>start
symbol</em> as defined by the N-Gram specification. If the start
symbol is absent the N-Gram, as a whole, is referenced as defined
in the N-Gram specification.</p>
<blockquote>
<h4 id="id-S2.2.4-abnf">ABNF Form</h4>
<p><a href="#S2.2.2" shape="rect">URI references</a> to N-Gram
documents follow the same syntax as references to other ABNF or XML
Form grammar documents. The following are examples of references to
an N-Gram document via an <a href="#S2.2.2" shape="rect">explicit
rule reference</a> and a<span>n implicit</span> reference to the
<a href="#S2.2.2" shape="rect">root rule</a>.</p>
<pre class="abnf" xml:space="preserve">
$&lt;http://grammar.example.com/ngram.xml#StartSymbol&gt;
$&lt;http://grammar.example.com/ngram.xml&gt;
</pre>
<h4 id="id-S2.2.4-xml">XML Form</h4>
<p><a href="#S2.2.2" shape="rect">URI references</a> to N-Gram
documents follow the same syntax as reference to other ABNF Form
and XML Form grammar documents. The following are examples of
references to an N-Gram document via an <a href="#S2.2.2" shape=
"rect">explicit rule reference</a> and a<span>n implicit</span>
reference to the <a href="#S2.2.2" shape="rect">root rule</a>.</p>
<pre class="xml" xml:space="preserve">
&lt;ruleref uri="http://grammar.example.com/ngram.xml#StartSymbol"/&gt;
&lt;ruleref uri="http://grammar.example.com/ngram.xml"/&gt;
</pre></blockquote>
<h3 id="id-S2.3"><a id="S2.3" name="S2.3" shape="rect">2.3
Sequences and Encapsulation</a></h3>
<p>A <em>sequence</em> of legal rule expansions is itself a
<a href="#S2" shape="rect">legal rule expansion</a>.</p>
<p>The sequence of rule expansions implies the temporal order in
which the expansions must be detected by the <a href="#S1.1" shape=
"rect">user agent</a>. This constraint applies to sequences of
tokens, sequences of rule references, sequences of tags,
parentheticals and all combinations of these rule expansions.</p>
<p>Both the ABNF Form and XML Form provide syntax for encapsulating
any expansion. This is used, for example, to attach a <a href=
"#S2.5" shape="rect">repeat operator</a>, a <a href="#S2.7" shape=
"rect">language identifier</a> or to ensure correct <a href="#S2.8"
shape="rect">precedence</a> in parsing (ABNF only).</p>
<blockquote>
<h4 id="id-S2.3-abnf">ABNF Form</h4>
<p>A sequence of legal expansions separated by <a href=
"#term-whitespace" shape="rect">white space</a> is a legal
expansion.</p>
<p>A legal expansion surrounded by parentheses ('(' and ')') is a
legal expansion.</p>
<pre class="abnf" xml:space="preserve">
this is a test           // sequence of tokens
$action $object          // sequence of rule references
the $object is $color    // sequence of tokens and rule references
(fly to $city)           // parentheses for encapsulation
</pre>
<h5>Special cases</h5>
<p>An empty parenthetical is legal as is a parenthetical containing
only <a href="#term-whitespace" shape="rect">white space</a>; e.g.
'()' or '( )'. Both forms are equivalent to <a href="#S2.2.3"
shape="rect">$NULL</a> and a grammar processor will behave as if
the parenthetical were not present.</p>
<pre class="abnf" xml:space="preserve">
// equivalent sequences
phone home
phone ( ) home
</pre>
<h4 id="id-S2.3-xml">XML Form</h4>
<p>A sequence of XML rule expansion elements (
<code>&lt;ruleref&gt;</code>, <code>&lt;item&gt;</code>,
<code>&lt;one-of&gt;</code>, <code>&lt;token&gt;</code>
<code>&lt;tag&gt;</code>) and CDATA sections containing space
separated tokens must be recognized in temporal sequence. (The only
exception is where one or more "item" elements appear within a
<a href="#S2.4" shape="rect"><code>one-of</code></a> element.)</p>
<p>An <code>item</code> element can surround any expansion to
permit a <a href="#S2.5" shape="rect">repeat</a> attribute or
<a href="#S2.7" shape="rect">language identifier</a> to be
attached. The <code>weight</code> attribute of <code>item</code> is
ignored unless the element appears within a <code>one-of</code>
element.</p>
<pre class="xml" xml:space="preserve">
&lt;!-- sequence of tokens --&gt;
this is a test

&lt;!--sequence of rule references--&gt;
&lt;ruleref uri="#action"/&gt; &lt;ruleref uri="#object"/&gt;

&lt;!--sequence of tokens and rule references--&gt;
the &lt;ruleref uri="#object"/&gt; is &lt;ruleref uri="#color"/&gt;

&lt;!-- sequence container --&gt;
&lt;item&gt;fly to &lt;ruleref uri="#city"/&gt; &lt;/item&gt;
</pre>
<h5>Special cases</h5>
<p>An empty item element is legal as is an item element containing
only <a href="#term-whitespace" shape="rect">white space</a>. Both
forms are equivalent to a <a href="#S2.2.3" shape="rect">NULL</a>
reference and a grammar processor will behave as if the item were
not present.</p>
<pre class="xml" xml:space="preserve">
&lt;!-- equivalent sequences --&gt;
phone home
phone &lt;item/&gt; home
phone &lt;item&gt;&lt;/item&gt; home
phone &lt;item&gt;    &lt;/item&gt; home
</pre></blockquote>
<h3 id="id-S2.4"><a id="S2.4" name="S2.4" shape="rect">2.4
Alternatives</a></h3>
<p>Any set of <em>alternative legal rule expansions</em> is itself
a <a href="#S2" shape="rect">legal rule expansion</a>. For input to
match a set of alternative rule expansions it must match one of the
set of alternative expansions. A set of alternatives must contain
one or more alternatives.</p>
<p>Any set of alternatives may be labeled with a <a href="#S2.7"
shape="rect">language attachment</a>. In the XML Form an <a href=
"#S2.7-xml" shape="rect"><code>xml:lang</code></a> attribute is
present on the <code>one-of</code> element. In the ABNF Form to
ensure correct precedence the set of alternatives must be <a href=
"#S2.3" shape="rect">delimited</a> by parentheses with the <a href=
"#S2.7-abnf" shape="rect">ABNF language attachment</a> immediately
following.</p>
<h4 id="id-S2.4.1"><a id="S2.4.1" name="S2.4.1" shape="rect">2.4.1
Weights</a></h4>
<p>A weight may be optionally provided for any number of
alternatives in an alternative expansion. Weights are simple
positive floating point values without exponentials. Legal formats
are <code>"n"</code>, <code>"n."</code>, <code>".n"</code> and
<code>"n.n"</code> where <code>"n"</code> is a sequence of one or
many digits.</p>
<p>A weight is nominally a multiplying factor in the likelihood
domain of a speech recognition search. 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.</p>
<p><a href="#ref-jel98" shape="rect">[JEL98]</a> and <a href=
"#ref-rab93" shape="rect">[RAB93]</a> are informative references on
the topic of speech recognition technology and the underlying
statistical framework within which weights are applied.</p>
<p>Grammar authors and speech recognizer developers should be aware
of the following limitations upon the definition and application of
weights as outlined above.</p>
<ul>
<li>The application of weights to a speech recognition search is
under the internal control of the recognizer. There is no normative
or informative algorithm for applying weights. Furthermore, speech
recognition is a statistical process so consistent behavior cannot
be guaranteed.</li>
<li>Appropriate weights are difficult to determine for any specific
grammar and recognizer. Guessing weights does not always improve
speech recognition performance.</li>
<li>Effective weights are best obtained by study of real speech
input to a grammar. For example, a reasonable technique for
developing portable weights is to use weights that are correlated
with the occurrence counts of a set of alternatives.</li>
<li>Tuning weights for a particular recognizer does not guarantee
improved recognition performance on other speech recognizers.</li>
</ul>
<blockquote>
<h4 id="id-S2.4-abnf">ABNF Form</h4>
<p>A set of alternative choices is identified as a list of legal
expansions separated by the vertical bar symbol. If necessary, the
set of alternative choices may be delimited by parentheses.</p>
<pre class="abnf" xml:space="preserve">
Michael | Yuriko | Mary | Duke | $otherNames
(1 | 2 | 3)
</pre>
<p>A <a href="#S2.4.1" shape="rect"><code>weight</code></a> is
surrounded by forward slashes and placed before each item in the
alternatives list.</p>
<pre class="abnf" xml:space="preserve">
/10/ small | /2/ medium |  large
/3.1415/ pie | /1.414/ root beer | /.25/ cola
</pre>
<h5>Special Cases</h5>
<p>It is legal for an alternative to be a reference to <a href=
"#S2.2.3" shape="rect">$NULL</a>, an empty parenthetical or a
single tag. In each case the input is equivalent to matching $NULL
and as a result the other alternatives are optional.</p>
<pre class="abnf" xml:space="preserve">
// Legal
$rule1 = word | $NULL;
$rule2 = () | word;
$rule3 = word | {<a href="#S1.4" shape="rect">TAG-CONTENT</a>};
</pre>
<p>An empty alternative (<a href="#term-whitespace" shape=
"rect">white space</a> only) is not legal.</p>
<pre class="abnf" xml:space="preserve">
// ILLEGAL
$rule1 = a | | b;
$rule2 = | b;
$rule3 = a |;
</pre>
<p>The following construct is interpreted as a single weighted
alternative.</p>
<pre class="abnf" xml:space="preserve">
// Legal
$rule1 = /2/ word;
$rule2 = /2/ {<a href="#S1.4" shape="rect">TAG-CONTENT</a>};
$rule3 = /2/ $NULL;
</pre>
<h4 id="id-S2.4-xml">XML Form</h4>
<p>The <code>one-of</code> element identifies a set of alternative
elements. Each alternative expansion is contained in a
<code>item</code> element. There must be at least one
<code>item</code> element contained within a <code>one-of</code>
element. <a href="#S2.4.1" shape="rect">Weights</a> are optionally
indicated by the <code>weight</code> attribute on the
<code>item</code> element.</p>
<pre class="xml" xml:space="preserve">
&lt;one-of&gt;
  &lt;item&gt;Michael&lt;/item&gt;
  &lt;item&gt;Yuriko&lt;/item&gt;
  &lt;item&gt;Mary&lt;/item&gt;
  &lt;item&gt;Duke&lt;/item&gt;
  &lt;item&gt;&lt;ruleref uri="#otherNames"/&gt;&lt;/item&gt;
&lt;/one-of&gt;

&lt;one-of&gt;&lt;item&gt;1&lt;/item&gt; &lt;item&gt;2&lt;/item&gt; &lt;item&gt;3&lt;/item&gt;&lt;/one-of&gt;

&lt;one-of&gt;
  &lt;item weight="10"&gt;small&lt;/item&gt;
  &lt;item weight="2"&gt;medium&lt;/item&gt;
  &lt;item&gt;large&lt;/item&gt;
&lt;/one-of&gt;

&lt;one-of&gt;
  &lt;item weight="3.1415"&gt;pie&lt;/item&gt;
  &lt;item weight="1.414"&gt;root beer&lt;/item&gt;
  &lt;item weight=".25"&gt;cola&lt;/item&gt;
&lt;/one-of&gt;
</pre>
<h5>Special cases</h5>
<p>A <code>one-of</code> element containing a single item is legal
and requires that input match the single item. The single item may
be optionally weighted.</p>
<pre class="xml" xml:space="preserve">
&lt;one-of&gt;
  &lt;item&gt;word&lt;/item&gt;
&lt;/one-of&gt;

&lt;one-of&gt;
  &lt;item weight="2.0"&gt;word&lt;/item&gt;
&lt;/one-of&gt;
</pre>
<p>Is it legal for an alternative to be a reference to <a href=
"#S2.2.3" shape="rect">NULL</a>, an empty item or a single tag. In
each case the input is equivalent to matching NULL and as a result
the other alternatives are optional.</p>
<pre class="xml" xml:space="preserve">
&lt;one-of&gt;
  &lt;item&gt;word&lt;/item&gt;
  &lt;item/&gt;
&lt;/one-of&gt;
&lt;one-of&gt;
  &lt;item&gt;word&lt;/item&gt;
  
  <span>&lt;item&gt; &lt;ruleref special="NULL"/&gt; &lt;/item&gt;</span>
&lt;/one-of&gt;
&lt;one-of&gt;
  &lt;item&gt;word&lt;/item&gt;
  &lt;item&gt; &lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT</a>&lt;/tag&gt; &lt;/item&gt;
&lt;/one-of&gt;
</pre></blockquote>
<h3 id="id-S2.5"><a id="S2.5" name="S2.5" shape="rect">2.5
Repeats</a></h3>
<p>Any <em>repeated legal rule expansion</em> is itself a <a href=
"#S2" shape="rect">legal rule expansion</a>.</p>
<p>Operators are provided that define a legal rule expansion as
being another sub-expansion that is optional, that is repeated zero
or more times, that is repeated one or more times, or that is
repeated some range of times.</p>
<table border="1" cellpadding="3" summary=
"Legal Values for Repeat Attribute">
<tr>
<td align="center" colspan="1" rowspan="1"><b><em>ABNF
Form</em><br clear="none" />
Example</b></td>
<td align="center" colspan="1" rowspan="1"><b><em>XML
Form</em><br clear="none" />
Example</b></td>
<td colspan="1" rowspan="1"><b>Behavior</b></td>
</tr>
<tr>
<td align="center" colspan="1" rowspan="1">
<em>&lt;n&gt;</em><br clear="none" />
&lt;6&gt;</td>
<td align="center" colspan="1" rowspan="1">
<em>repeat="n"</em><br clear="none" />
repeat="6"</td>
<td colspan="1" rowspan="1">The contained expansion is repeated
exactly "n" times. "n" must be "0" or a positive integer.</td>
</tr>
<tr>
<td align="center" colspan="1" rowspan="1">
<em>&lt;m-n&gt;</em><br clear="none" />
&lt;4-6&gt;</td>
<td align="center" colspan="1" rowspan="1">
<em>repeat="m-n"</em><br clear="none" />
repeat="4-6"</td>
<td colspan="1" rowspan="1">The contained expansion is repeated
between "m" and "n" times (inclusive). "m" and "n" must both be "0"
or a positive integer and "m" must be less than or equal to
"n".</td>
</tr>
<tr>
<td align="center" colspan="1" rowspan="1">
<em>&lt;m-&gt;</em><br clear="none" />
&lt;3-&gt;</td>
<td align="center" colspan="1" rowspan="1">
<em>repeat="m-"</em><br clear="none" />
repeat="3-"</td>
<td colspan="1" rowspan="1">The contained expansion is repeated "m"
times or more (inclusive). "m" must be "0" or a positive integer.
For example, "3-" declares that the contained expansion can occur
three, four, five or more times.</td>
</tr>
<tr>
<td align="center" colspan="1" rowspan="1">&lt;0-1&gt;<br clear=
"none" />
[...]</td>
<td align="center" colspan="1" rowspan="1">repeat="0-1"</td>
<td colspan="1" rowspan="1">The contained expansion is
optional.</td>
</tr>
</table>
<h5>Common Repeats</h5>
<p>As indicated in the table above, an expansion that can occur 0-1
times is optional. Because optionality is such a common form the
ABNF syntax provides square brackets as a special operator for
representing optionality.</p>
<p>A repeat of "0-" indicates that an expansion can occur zero
times, once or any number of multiple times. In regular expression
languages this is often represented by the <em>Kleene star</em>
('*') which is reserved but not used in ABNF.</p>
<p>A repeat of "1-" indicates that an expansion can occur once or
any number of multiple times. In regular expression languages this
is often represented by the <em>positive closure</em> ('+') which
is reserved but not used in ABNF.</p>
<p>Although both ABNF and XML support a grammar that permits an
unbounded number of input tokens it is not the case that users will
speak indefinitely. Speech recognition can perform more effectively
if the author indicates a more limited range of repeat
occurrences.</p>
<h5>Special Cases</h5>
<p>Where a number of possible repetitions (e.g. &lt;m-&gt; or
&lt;m-n&gt; (n &gt; 0) but not &lt;0&gt;) is expressed on a
construct whose only content is one or more <a href="#S2.6" shape=
"rect">tag</a> elements, the behavior of the grammar processor is
not defined and will be specific to individual implementations.</p>
<p>Any number of non-optional repetitions (e.g., &lt;m-n&gt;;
m&gt;0) of <a href="#S2.2.3" shape="rect">VOID</a> is equivalent to
a single <a href="#S2.2.3" shape="rect">VOID</a>.</p>
<p>The behavior of a grammar processor in handling any number of
repetitions of <a href="#S2.2.3" shape="rect">NULL</a> is not
defined and will be specific to individual implementations.</p>
<p>If the number of repetitions for any expansion can be only zero
(i.e. &lt;0&gt; or &lt;0-0&gt;) then the expansion is equivalent to
<a href="#S2.2.3" shape="rect">NULL</a>.</p>
<h4 id="id-S2.5.1"><a id="S2.5.1" name="S2.5.1" shape="rect">2.5.1
Repeat Probabilities</a></h4>
<p>Any repeat operator may specify an optional repeat probability.
The value indicates the probability of successive repetition of the
repeated expansion.</p>
<p>A repeat probability value must be in the floating pointing
range of "0.0" to "1.0" (inclusive). Values outside this range are
illegal. The floating point format is one of "n", "n.", "n.nnnn",
".nnnn" (with any number of digits after the dot).</p>
<p>Note: repeat probabilities and <a href="#S2.4.1" shape=
"rect">weights</a> are different logical entities and have a
different impact upon a speech recognition search.</p>
<p>Informative example: A simple example is an optional expansion
(zero or one occurrences) with a probability &mdash; say "0.6". The
grammar indicates that the chance that the expansion will be
matched is 60% and that the chance that the expansion will not be
present is 40%.</p>
<p>When no maximum is specified in a range (m-) the probabilities
decay exponentially.</p>
<p>Grammar authors and speech recognizer developers should be aware
of the following limitations upon the definition and application of
repeat probabilities as outlined above.</p>
<ul>
<li>The application of repeat probabilities to a speech recognition
search is under the internal control of the recognizer. There is no
specified algorithm for applying repeat probabilities in a speech
recognition processor so consistent behavior cannot be
guaranteed.</li>
<li>Appropriate repeat probabilities are often difficult to
determine for any specific grammar and recognizer. Guessing repeat
probabilities does not always improve speech recognition
performance.</li>
<li>Appropriate repeat probabilities are best obtained by study of
statistical patterns of real speech input. Tuning repeat
probabilities for a particular recognizer does not guarantee
improved recognition performance on other speech recognizers.</li>
</ul>
<p>Useful references on statistical models of speech recognition
include <a href="#ref-jel98" shape="rect">[JEL98]</a> and <a href=
"#ref-rab93" shape="rect">[RAB93]</a>.</p>
<blockquote>
<h4 id="id-S2.5-abnf">ABNF Form</h4>
<p>The following are postfix operators: <code>&lt;m-n&gt;
&lt;m-&gt; &lt;m&gt;</code>. A postfix operator is logically
attached to the preceding expansion. Postfix operators have high
precedence and so are tightly bound to the immediately preceding
expansion (see <a href="#S2.8" shape="rect">Section 2.8</a>).</p>
<p>Optional expansions may be delimited by square brackets:
<code>[expansion]</code>. Alternatively, an optional expansion is
indicated by the postfix operator "<code>&lt;0-1&gt;</code>".</p>
<p>The following symbols are <em>reserved</em> for future use in
ABNF: '*', '+', '?'. These symbols must not be used at any place in
a grammar where the syntax currently permits a repeat operator.</p>
<pre class="abnf" xml:space="preserve">
// the token "very" is optional
[very]
very &lt;0-1&gt;

// the rule reference $digit can occur zero, one or many times

$digit &lt;0-&gt;

// the rule reference $digit can occur one or more times

$digit &lt;1-&gt;

// the rule reference $digit can occur four, five or six times
$digit &lt;4-6&gt;

// the rule reference $digit can occur ten or more times
$digit &lt;10-&gt;

// Examples of the following expansion
//   "pizza"
//   "big pizza with pepperoni"
//   "very big pizza with cheese and pepperoni"
[[very] big] pizza ([with | and] $topping) &lt;0-&gt;
</pre>
<p>Repeat probabilities are only supported in the range form. The
probability is delimited by slash characters and contained within
the angle brackets: <code>&lt;m-n /prob/&gt;</code> and
<code>&lt;m- /prob/&gt;</code>.</p>
<pre class="abnf" xml:space="preserve">
// the token "very" is optional and is 60% likely to occur
// and 40% likely to be absent in input
very &lt;0-1 /0.6/&gt;

// the rule reference $digit must occur two to four times 
// with 80% probability of recurrence
$digit &lt;2-4 /.8/&gt;
</pre>
<h4 id="id-S2.5-xml">XML Form</h4>
<p>The <code>item</code> element has a <code>repeat</code>
attribute that indicates the number of times the contained
expansion may be repeated. The following example illustrates the
accepted values of the attribute.</p>
<pre class="xml" xml:space="preserve">
&lt;!-- the token "very" is optional --&gt;

&lt;item repeat="0-1"&gt;very&lt;/item&gt;

&lt;!-- the rule reference to digit can occur zero, one or many times --&gt;

&lt;item repeat="0-"&gt; &lt;ruleref uri="#digit"/&gt; &lt;/item&gt;

&lt;!-- the rule reference to digit can occur one or more times --&gt;

&lt;item repeat="1-"&gt; &lt;ruleref uri="#digit"/&gt; &lt;/item&gt;

&lt;!-- the rule reference to digit can occur four, five or six times --&gt;
&lt;item repeat="4-6"&gt; &lt;ruleref uri="#digit"/&gt; &lt;/item&gt;

&lt;!-- the rule reference to digit can occur ten or more times --&gt;
&lt;item repeat="10-"&gt; &lt;ruleref uri="#digit"/&gt; &lt;/item&gt;

&lt;!-- Examples of the following expansion --&gt;
&lt;!--   "pizza" --&gt;
&lt;!--   "big pizza with pepperoni" --&gt;
&lt;!--   "very big pizza with cheese and pepperoni" --&gt;

&lt;item repeat="0-1"&gt; 
   &lt;item repeat="0-1"&gt; very &lt;/item&gt;
   big 
&lt;/item&gt; 
pizza
&lt;item repeat="0-"&gt;
   &lt;item repeat="0-1"&gt;
      &lt;one-of&gt;
         &lt;item&gt;with&lt;/item&gt;
         &lt;item&gt;and&lt;/item&gt;
      &lt;/one-of&gt;
   &lt;/item&gt;
   &lt;ruleref uri="#topping"/&gt;
&lt;/item&gt;
</pre>
<p>The <code>repeat-prob</code> on the item element carries the
repeat probability. Repeat probabilities are supported on any item
element but are ignored if the repeat attribute is not also
specified.</p>
<pre class="xml" xml:space="preserve">
&lt;-- The token "very" is optional and is 60% likely to occur. --&gt;
&lt;-- Means 40% chance that "very" is absent in input --&gt;
&lt;item repeat="0-1" repeat-prob="0.6"&gt;very&lt;/item&gt;

&lt;-- The rule reference to digit must occur two to four times --&gt;
&lt;-- with 80% probability of recurrence. --&gt;
&lt;item repeat="2-4" repeat-prob=".8"&gt;
   &lt;ruleref uri="#digit"/&gt; 
&lt;/item&gt;
</pre></blockquote>
<h3 id="id-S2.6"><a id="S2.6" name="S2.6" shape="rect">2.6
Tags</a></h3>
<p>A <em>tag</em> is a <a href="#S2" shape="rect">legal rule
expansion</a> <span>(a tag can also be declared in the grammar
header - see <a href="#S4.1" shape="rect">S4.1</a>)</span>.</p>
<p>A <code>tag</code> is an <em>arbitrary string</em> that may be
included inline within any legal rule expansion. Any number of tags
may be included inline within a rule expansion.</p>
<p>Tags do not affect the legal word patterns defined by the
grammars or the process of recognizing speech or other input given
a grammar.</p>
<p>Tags may contain content for <a href="#S1.4" shape=
"rect">semantic interpretation</a>. The semantic interpretation
processes may affect the recognition result.</p>
<p><a href="#S2.7" shape="rect">Language attachments</a> have no
effect upon tags.</p>
<p>The <a href="#S4.8" shape="rect">tag format declaration</a>
indicates the content type of all tags in a grammar.</p>
<h5>Special Cases</h5>
<p>It is legal to use a <code>tag</code> as a stand-alone
expansion. For example, a rule may expand to a single tag and no
tokens.</p>
<pre class="abnf" xml:space="preserve">
  $rule = {<a href="#S1.4" shape="rect">TAG-CONTENT</a>};
</pre>
<pre class="xml" xml:space="preserve">
  &lt;rule id="rule"&gt;&lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT</a>&lt;/tag&gt;&lt;/rule&gt;
</pre>
<blockquote>
<h4 id="id-S2.6-abnf">ABNF Form</h4>
<p>A <code>tag</code> is delimited by either a pair of opening and
closing curly brackets &mdash; '{' and '}' &mdash; or by the following
3-character sequences which are considered very unlikely to occur
within a tag &mdash; '{!{' and '}!}'. A tag delimited by single curly
brackets cannot contain the single closing curly bracket character
('}'). A tag delimited by the 3-character sequence cannot contain
the closing 3-character sequence ('}!}').</p>
<p>The tag content is all text between the opening and closing
character sequences including leading and trailing <a href=
"#term-whitespace" shape="rect">white space</a>. The contents of the
tag are not parsed by the grammar processor.</p>
<p>Tag precedence is the same as for rule references and tokens. In
the first example below there is a sequence of six space-separated
expansions (3 tokens, a tag, a token and a tag). In the second
example, the alternative is a choice between a sequence containing
a token and a tag or a sequence containing a rule reference and a
tag.</p>
<pre class="abnf" xml:space="preserve">
$rule1 = this is a {<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>} test {<a href="#S1.4" shape=
"rect">TAG-CONTENT-2</a>};

$rule2 = open {<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>} | $close {<a href="#S1.4" shape=
"rect">TAG-CONTENT-2</a>};

$rule3 = {!{ a simple tag containing { and } needs no escaping }!};
</pre>
<h4 id="id-S2.6-xml">XML Form</h4>
<p>A <code>tag</code> element can be a direct child of the
<code>item</code> and <code>rule</code> elements. The content of
<code>tag</code> is CDATA.</p>
<pre class="xml" xml:space="preserve">
&lt;rule id="rule1"&gt;this is a &lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>&lt;/tag&gt; test &lt;tag&gt;<a href=
"#S1.4" shape="rect">TAG-CONTENT-2</a>&lt;/tag&gt; &lt;/rule&gt;

&lt;rule id="rule2"&gt;
   &lt;one-of&gt;
      &lt;item&gt; open &lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>&lt;/tag&gt; &lt;/item&gt;
      &lt;item&gt; &lt;ruleref uri="#close"/&gt; &lt;tag&gt;<a href="#S1.4"
   shape="rect">TAG-CONTENT-2</a>&lt;/tag&gt; &lt;/item&gt;
   &lt;/one-of&gt;
&lt;/rule&gt;
</pre></blockquote>
<h3 id="id-S2.7"><a id="S2.7" name="S2.7" shape="rect">2.7
Language</a></h3>
<p>Any <a href="#S2" shape="rect">legal rule expansion</a> that has
an attached <a href="#term-language" shape="rect">language
identifier</a> is itself a legal rule expansion. Both the ABNF Form
and the XML Form permit a legal language identifier to be attached
to any <a href="#S2.1" shape="rect">token</a>, <a href="#S2.3"
shape="rect">sequence</a> or <a href="#S2.4" shape="rect">set of
alternatives</a> <span>(Note that <a href="#S2.2" shape="rect">rule
reference</a> does not permit a language identifier to be
attached)</span>. The syntax for the <a href="#S2.7-abnf" shape=
"rect">ABNF Form</a> and for the <a href="#S2.7-xml" shape=
"rect">XML Form</a> are provided below.</p>
<p>The language declaration for a rule expansion affects only the
contained content. Moreover, the language declaration affects only
the handling of <a href="#S2.1" shape="rect">tokens</a> in the
contained content and does not affect <a href="#S2.6" shape=
"rect">tags</a> or <a href="#S2.2" shape="rect">rule
references</a>. The application of language to token handling and
particularly to pronunciation lookup is described in <a href=
"#S2.1" shape="rect">Section 2.1</a>.</p>
<p>By default a grammar is a single language document with a
<a href="#term-language" shape="rect">language identifier</a>
provided in the <a href="#S4.5" shape="rect">language
declaration</a> in the <a href="#S4.1" shape="rect">grammar
header</a> (see <a href="#S4.5" shape="rect">Section 4.5</a>). All
tokens within that grammar, unless otherwise declared, will be
handled according to the grammar's language.</p>
<p>In situations where applications target a multilingual user
community, grammars that contain words in more than one language
may be needed. For example, in response to a prompt such as:
<em>"Do you want to talk to Andr&eacute; Pr&eacute;vost?"</em> (a
combination of an English sentence with a French name), the
response may be either <em>"yes"</em> or <em>"oui"</em>.</p>
<p>The Speech Recognition Grammar Specification permits one grammar
to collect input from more than one language. The specification
also permits multiple grammars each with a separate single language
to be used in parallel. The specification also permits a single
input utterance to contain more than one language. Finally, the
specification permits any combination of the above: for example,
parallel grammars each with multi-lingual capability.</p>
<p>Not all user agents are required to support all languages, or
indeed any or all of the multi-lingual capabilities. The
conformance requirements regarding multi-lingual support for XML
Form grammar processors and ABNF Form grammar processors are the
same and are laid out in <a href="#S5.4" shape="rect">Section
5.4</a> and <a href="#S5.6" shape="rect">Section 5.6</a>
respectively.</p>
<p>There is a related challenge for multilingual applications that
deal with proper names (people, streets, companies, etc.) that may
be spoken with different pronunciations or accents depending upon
the language of origin and the speaking language. It is often
impossible to predict the language that users will use to pronounce
certain tokens. In fact, users may actually use different languages
for different words in the same sentence, and in unpredictable
ways. For instance, the name "Robert Jones" might be pronounced by
a French-speaking user using the French pronunciation for "Robert"
but an English pronunciation for "Jones", whereas a mono-lingual
English speaker would use the English pronunciation for both
words.</p>
<p><em>Language scoping:</em> language declarations are scoped
locally to a document and to a rule definition. In XML terminology,
the language attribute is inherited down the document tree. Where a
language change encompasses a reference to another grammar, the
referenced rule and its containing grammar define the language of
the reference expansion. The language in effect at the point of the
rule reference does not have any effect upon the referenced
rule.</p>
<p><em>Language and results:</em> The language used in the
recognition of a token is not considered a part of the speech
result even in the case that a language declaration is associated
with a token.</p>
<blockquote>
<h4 id="id-S2.7-abnf"><a id="S2.7-abnf" name="S2.7-abnf" shape=
"rect">ABNF Form</a></h4>
<p>In the ABNF Form a <a href="#term-language" shape=
"rect">language identifier</a> may be right-attached to any
<a href="#S2" shape="rect">legal rule expansion</a> <span>except
<a href="#S2.2" shape="rect">rule reference</a></span>. The
attachment is an exclamation point character ('!') followed by a
legal language identifier without intervening <a href=
"#term-whitespace" shape="rect">white space</a>.</p>
<p>The language attachment has higher <a href="#S2.8" shape=
"rect">precedence</a> than <a href="#S2.3" shape=
"rect">sequences</a> or <a href="#S2.4" shape=
"rect">alternatives</a>. To attach a language to these rule
expansion types the expansion should be delimited by parentheses
(see <a href="#S2.3" shape="rect">Section 2.3</a>).</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

// Default grammar language is US English
language en-US;

// Single language attachment to tokens
// Note that "fr-CA" (Canadian French) is applied to only
//  the word "oui" because of precedence rules
$yes = yes | oui!fr-CA;

// Single language attachment to an expansion
$people1 = (Michel Tremblay | Andr&eacute; Roy)!fr-CA;

// Handling language-specific pronunciations of the same word
// A capable speech recognizer will listen for Mexican Spanish and
//   US English pronunciations.
$people2 = Jose!en-US; | Jose!es-MX;

/**
 * Multi-lingual input possible
 * @example may I speak to Andr&eacute; Roy
 * @example may I speak to Jose
 */
public $request = may I speak to ($people1 | $people2);
</pre>
<h4 id="id-S2.7-xml"><a id="S2.7-xml" name="S2.7-xml" shape=
"rect">XML Form</a></h4>
<p>XML 1.0 <a href="#ref-xml" shape="rect">[XML &sect;2.12]</a>
defines the <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-lang-tag" shape=
"rect"><code>xml:lang</code></a> attribute for language
identification. The attribute provides a single <a href=
"#term-language" shape="rect">language identifier</a> for the
content of the element on which it appears. The
<code>xml:lang</code> attribute may be attached to <a href="#S2.4"
shape="rect"><code>one-of</code></a> , <a href="#S2.1" shape=
"rect"><code>token</code></a> and <a href="#S2.3" shape=
"rect"><code>item</code></a>. It applies the token handling of
scoped tokens.</p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;
 
&lt;!-- the default grammar language is US English --&gt;
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en-US" version="1.0"&gt;
 
  &lt;!-- 
     single language attachment to tokens
     "yes" inherits US English language
     "oui" is Canadian French language
  --&gt;
  &lt;rule id="yes"&gt;
    &lt;one-of&gt;
      &lt;item&gt;yes&lt;/item&gt;
      &lt;item xml:lang="fr-CA"&gt;oui&lt;/item&gt;
    &lt;/one-of&gt; 
  &lt;/rule&gt; 
  
  &lt;!-- Single language attachment to an expansion --&gt;
  &lt;rule id="people1"&gt;
    &lt;one-of xml:lang="fr-CA"&gt;
      &lt;item&gt;Michel Tremblay&lt;/item&gt;
      &lt;item&gt;Andr&eacute; Roy&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
  
  &lt;!--
     Handling language-specific pronunciations of the same word
     A capable speech recognizer will listen for Mexican Spanish 
     and US English pronunciations.
  --&gt;
  &lt;rule id="people2"&gt;
    &lt;one-of&gt;
      &lt;item xml:lang="en-US"&gt;Jose&lt;/item&gt;
      &lt;item xml:lang="es-MX"&gt;Jose&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
  
  &lt;!-- Multi-lingual input is possible --&gt;
  &lt;rule id="request" scope="public"&gt;
    &lt;example&gt; may I speak with Andr&eacute; Roy &lt;/example&gt;
    &lt;example&gt; may I speak with Jose &lt;/example&gt;
  
    may I speak with
    &lt;one-of&gt;
      &lt;item&gt; &lt;ruleref uri="#people1"/&gt; &lt;/item&gt;
      &lt;item&gt; &lt;ruleref uri="#people2"/&gt; &lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt;
</pre></blockquote>
<h3 id="id-S2.8"><a id="S2.8" name="S2.8" shape="rect">2.8
Precedence</a></h3>
<p>This section defines the precedence of the ABNF rule expansion
syntax. Because XML documents explicitly indicate structure there
is no ambiguity and thus a precedence definition is not required.
The precedence definitions for the ABNF Form are intended to
minimize the need for parentheses.</p>
<blockquote>
<h4 id="id-S2.8-abnf">ABNF Form</h4>
<p>The following is the ordering of precedence of rule expansions.
Parentheses may be used to explicitly control rule structure.</p>
<ol>
<li><a href="#S2.2" shape="rect">A rule reference</a>, a <a href=
"#S2.1" shape="rect">quoted token</a>, an <a href="#S2.1" shape=
"rect">unquoted token</a> or a <a href="#S2.6" shape=
"rect">tag</a>.</li>
<li><a href="#S2.3" shape="rect">Parentheses</a> ('(' and ')') for
grouping and square brackets ('[' and ']') for <a href="#S2.5"
shape="rect">optional grouping</a>.</li>
<li><a href="#S2.5" shape="rect">Repeat operator</a> (e.g.
"<code>&lt;0-1&gt;</code>") and <a href="#S2.7" shape=
"rect">language attachment</a> (e.g. "!en-AU") apply to the
tightest immediate preceding rule expansion. (To apply them to a
sequence or to alternatives, use `()' or `[]' for grouping.)</li>
<li><a href="#S2.3" shape="rect">Sequence</a> of rule
expansions.</li>
<li>Set of <a href="#S2.4" shape="rect">alternative rule
expansions</a> separated by vertical bars ('|') with optional
<a href="#S2.4.1" shape="rect">weights</a>.</li>
</ol>
<h4 id="id-S2.8-xml">XML Form</h4>
<p>None required. XML structure is explicit.</p>
</blockquote>
<h2 id="id-S3"><a id="S3" name="S3" shape="rect">3. Rule
Definitions</a></h2>
<ul>
<li class="tocline">3.1 <a href="#S3.1" shape="rect">Basic Rule
Definition</a></li>
<li class="tocline">3.2 <a href="#S3.2" shape="rect">Scoping of
Rule Definitions</a></li>
<li class="tocline">3.3 <a href="#S3.3" shape="rect">Example
Phrases</a></li>
</ul>
<p>A <em>rule definition</em> associates a legal <a href="#S2"
shape="rect">rule expansion</a> with a <em>rulename</em>. The rule
definition is also responsible for defining the <a href="#S3.2"
shape="rect"><em>scope</em></a> of the rule definition: whether it
is local to the grammar in which it is defined or whether it may be
referenced within other grammars. Finally, the rule definition may
additionally include documentation comments and other
pragmatics.</p>
<p>The rulename for each rule definition must be unique within a
grammar. The same rulename may be used in multiple grammars.</p>
<p>A rule definition is referenced by a URI in a <a href="#S2.2"
shape="rect">rule reference</a> with the rulename being represented
as the fragment identifier.</p>
<h3 id="id-S3.1"><a id="S3.1" name="S3.1" shape="rect">3.1 Basic
Rule Definition</a></h3>
<p>The core purpose of a rule definition is to associate a legal
rule expansion with a rulename.</p>
<p>A legal rulename in either the XML Form or ABNF Form is a
character sequence that:</p>
<ul>
<li>is an <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name" shape=
"rect">XML Name</a> <a href="#ref-xml" shape="rect">[XML
&sect;2.3]</a>,</li>
<li>and does not contain the following character '.', ':',
'-',</li>
<li>and is not the name of a <a href="#S2.2.3" shape="rect">special
rule</a> ("NULL", "VOID", "GARBAGE").</li>
</ul>
<p>Defined rulenames must be unique within a grammar. The <a href=
"#AppC" shape="rect">schema</a> enforces this by declaring the
rulename as an XML ID.</p>
<p>Rulenames are case-sensitive in both XML and ABNF grammars.
Exact string comparison is used to resolve rulename references.</p>
<p>A legal rulename cannot be one of the <a href="#S2.2.3" shape=
"rect">special rules</a>: specifically "NULL", "VOID" or
"GARBAGE".</p>
<blockquote>
<h4 id="id-S3.1-abnf">ABNF Form</h4>
<p>The rule definition consists of an optional scoping declaration
(explained in the next section) followed by a legal rule name, an
equals sign, a legal rule expansion and a closing semicolon. The
rule definition has one of the following legal forms:</p>
<pre class="abnf" xml:space="preserve">
<em>$ruleName = ruleExpansion;</em>
public <em>$ruleName = ruleExpansion;</em>
private <em>$ruleName = ruleExpansion;</em>
</pre>
<p>For example:</p>
<pre class="abnf" xml:space="preserve">
$city = Boston | "New York" | Madrid;
$command = $action $object;
</pre>
<h5>Special Cases</h5>
<p>An empty rule definition is illegal.</p>
<p>It is legal to define a rule that expands to empty parentheses
or <a href="#S2.2.3" shape="rect">$NULL</a> (equivalent forms). It
is legal to define a rule that expands to a single
<code>tag</code>.</p>
<pre class="abnf" xml:space="preserve">
// Legal
$rule = ();
$rule = $NULL;
$rule = {<a href="#S1.4" shape="rect">TAG-CONTENT</a>};

// ILLEGAL
$rule = ;
</pre>
<h4 id="id-S3.1-xml">XML Form</h4>
<p>A rule definition is represented by the <code>rule</code>
element. The <code>id</code> attribute of the element indicates the
name of the rule and must be unique within the grammar (this is
enforced by XML). The contents of the <code>rule</code> element may
be any legal rule expansion defined in <a href="#S2" shape=
"rect">Section 2</a>. The <code>scope</code> attribute is explained
in the next section.</p>
<pre class="xml" xml:space="preserve">
&lt;rule id="city"&gt;
   &lt;one-of&gt;
      &lt;item&gt;Boston&lt;/item&gt;
      &lt;item&gt;"San Francisco"&lt;/item&gt;
      &lt;item&gt;Madrid&lt;/item&gt; 
   &lt;/one-of&gt;
&lt;/rule&gt;
&lt;rule id="command"&gt;
   &lt;ruleref uri="#action"/&gt;
   &lt;ruleref uri="#object"/&gt;
&lt;/rule&gt;
</pre>
<h5>Special Cases</h5>
<p>It is not legal to define an empty rule element or a rule
element that contains only <a href="#term-whitespace" shape=
"rect">white space</a> CDATA.</p>
<p>It is legal to define a rule that expands to an empty item or to
a single rule reference to <a href="#S2.2.3" shape=
"rect">NULL</a>.</p>
<p>It is legal to define a rule that expands to a single
<code>tag</code> element.</p>
<pre class="abnf" xml:space="preserve">
&lt;!-- Legal --&gt;
&lt;rule id="rule"&gt;&lt;item/&gt;&lt;/rule&gt;
&lt;rule id="rule"&gt;&lt;ruleref special="NULL"/&gt;&lt;/rule&gt;
&lt;rule id="rule"&gt;&lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT</a>&lt;/tag&gt;&lt;/rule&gt;

&lt;!-- ILLEGAL --&gt;
&lt;rule id="rule"/&gt;
&lt;rule id="rule"&gt;&lt;/rule&gt;
&lt;rule id="rule"&gt;   &lt;/rule&gt;
</pre></blockquote>
<h3 id="id-S3.2"><a id="S3.2" name="S3.2" shape="rect">3.2 Scoping
of Rule Definitions</a></h3>
<p>Each defined rule has a scope. The scope is either "private" or
"public". If not explicitly declared in a rule definition then the
scope defaults to "private".</p>
<p><span>A</span> public-scoped rule may be <span>explicitly</span>
<a href="#S2.2" shape="rect">referenced</a> <span>(using the
fragment identifier syntax of a URI)</span> in the rule definitions
of other grammars and in other non-grammar documents<span>.
A</span> private-scoped <span>rule</span> cannot be so referenced
<span>and is directly accessible only within its containing
grammar. A private rule may be explicitly referenced only by other
rules within the same grammar</span>.</p>
<p>Informative: grammar authors may consider the following guidance
when scoping the rules of a grammar.</p>
<ul>
<li>Grammar authoring shares many properties of programming.
Establishing contracts of an API is analogous to defining a set of
grammars and defining the public rules of a grammar each with
defined language behavior.</li>
<li>Consistent design and implementation of public rules promotes
grammar re-use and facilitates creation of grammar libraries.</li>
<li>Natural language grammars often require creation of many
internal "working" rules to create a smaller number of useful
external rules. Hiding working rules with private scope allows
revision of those rules without affecting other grammars that
reference the grammar. Hiding working rules also prevents
accidental mis-use of a working rule.</li>
<li>Grammar compilation resembles programming language compilation.
Making rules private allows advanced grammar compilers to perform
optimizations that cannot be applied when a rule is declared
public.</li>
</ul>
<blockquote>
<h4 id="id-S3.2-abnf">ABNF Form</h4>
<p>A rule definition may be annotated with the keywords "public" or
"private". If no scope is provided, the default is "private".</p>
<pre class="abnf" xml:space="preserve">
$town = Townsville | Beantown;
private $city = Boston | "New York" | Madrid;
public $command = $action $object;
</pre>
<h4 id="id-S3.2-xml">XML Form</h4>
<p>The <code>scope</code> attribute of the <code>rule</code>
element defines the scope of the rule definition. Defined values
are <code>public</code> and <code>private</code>. If omitted, the
default scope is <code>private</code>.</p>
<pre class="xml" xml:space="preserve">
&lt;rule id="town"&gt;
   &lt;one-of&gt;
      &lt;item&gt;Townsville&lt;/item&gt;
      &lt;item&gt;Beantown&lt;/item&gt; 
   &lt;/one-of&gt;
&lt;/rule&gt;
&lt;rule id="city" scope="private"&gt;
   &lt;one-of&gt;
      &lt;item&gt;Boston&lt;/item&gt;
      &lt;item&gt;"San Francisco"&lt;/item&gt;
      &lt;item&gt;Madrid&lt;/item&gt; 
   &lt;/one-of&gt;
&lt;/rule&gt;
&lt;rule id="command" scope="public"&gt;
   &lt;ruleref uri="#action"/&gt;
   &lt;ruleref uri="#object"/&gt;
&lt;/rule&gt;
</pre></blockquote>
<h3 id="id-S3.3"><a id="S3.3" name="S3.3" shape="rect">3.3 Example
Phrases</a></h3>
<p>It is often desirable to include examples of phrases that match
rule definitions along with the definition. Zero, one or many
example phrases may be provided for any rule definition. Because
the examples are explicitly marked, automated tools can be used for
regression testing and for generation of grammar documentation.</p>
<blockquote>
<h4 id="id-S3.3-abnf">ABNF Form</h4>
<p>A <a href="#S4.13" shape="rect">documentation comment</a> is a
C/C++/Java comment that starts with the sequence of characters
<code>/**</code> and which immediately precedes the relevant rule
definition. Zero or more <code>@example</code> tags may be
contained at the end of the documentation comment. The syntax
follows the <a href=
"http://java.sun.com/docs/books/jls/first_edition/html/18.doc.html#25995"
   shape="rect">Tagged Paragraph</a> of a documentation comment of
   the Java Programming Language <a href="#ref-java" shape=
   "rect">[JAVA &sect;18.4]</a>. The tokenization of the example
   follows the tokenization and sequence rules defined in <a href=
   "#S2.1" shape="rect">Section 2.1</a> and <a href="#S2.3" shape=
   "rect">Section 2.3</a> respectively.</p>
<pre class="abnf" xml:space="preserve">
/**
 * A simple directive to execute an action.
 *
 * @example open the window
 * @example close the door
 */
public $command = $action $object;
</pre>
<h4 id="id-S3.3-xml">XML Form</h4>
<p>Any number of "example" elements may be provided as the initial
content within a "rule" element. The tokenization of the example
follows the tokenization and sequence rules defined in <a href=
"#S2.1" shape="rect">Section 2.1</a> and <a href="#S2.3" shape=
"rect">Section 2.3</a> respectively.</p>
<pre class="xml" xml:space="preserve">
&lt;rule id="command" scope="public"&gt;
    &lt;!-- A simple directive to execute an action. --&gt;
    &lt;example&gt; open the window &lt;/example&gt;
    &lt;example&gt; close the door &lt;/example&gt;
    &lt;ruleref uri="#action"/&gt; &lt;ruleref uri="#object"/&gt;
&lt;/rule&gt;
</pre></blockquote>
<h2 id="id-S4"><a id="S4" name="S4" shape="rect">4. Grammar
Documents</a></h2>
<p>A conforming stand-alone grammar document consists of a <a href=
"#S4.1" shape="rect">legal header</a> followed by a body consisting
of a set of legal <a href="#S3" shape="rect">rule definitions</a>.
All rules defined within that grammar are scoped within the
grammar's rulename namespace and each rulename must be <a href=
"#S3" shape="rect">legal and unique</a>.</p>
<p>It is legal for a grammar to define no rules. The grammar cannot
be used for processing input since it defines no patterns for
matching user input.</p>
<ul>
<li class="tocline">4.1 <a href="#S4.1" shape="rect">Grammar Header
Declarations</a></li>
<li class="tocline">4.2 <a href="#S4.2" shape="rect">ABNF
Self-Identifying Header</a></li>
<li class="tocline">4.3 <a href="#S4.3" shape="rect">XML Form
Prolog and Root Element</a></li>
<li class="tocline">4.4 <a href="#S4.4" shape="rect">Character
Encoding</a></li>
<li class="tocline">4.5 <a href="#S4.5" shape=
"rect">Language</a></li>
<li class="tocline">4.6 <a href="#S4.6" shape="rect">Mode</a></li>
<li class="tocline">4.7 <a href="#S4.7" shape="rect">Root
Rule</a></li>
<li class="tocline">4.8 <a href="#S4.8" shape="rect">Tag
Format</a></li>
<li class="tocline">4.9 <a href="#S4.9" shape="rect">Base URI</a>
<ul class="toc">
<li class="tocline">4.9.1 <a href="#S4.9.1" shape="rect">Resolving
Relative URIs</a></li>
</ul>
</li>
<li class="tocline">4.10 <a href="#S4.10" shape=
"rect">Pronunciation Lexicon</a></li>
<li class="tocline">4.11 <a href="#S4.11" shape="rect">Meta
Data</a>
<ul class="toc">
<li class="tocline">4.11.1 <a href="#S4.11.1" shape="rect">Meta and
HTTP-Equiv</a></li>
<li class="tocline">4.11.2 <a href="#S4.11.2" shape="rect">Metadata
(XML Only)</a></li>
</ul>
</li>
<li class="tocline"><span>4.12</span> <a href="#S4.12" shape=
"rect"><span>Tag</span></a></li>
<li class="tocline"><span>4.13</span> <a href="#S4.12" shape=
"rect">Comments</a></li>
<li class="tocline"><span>4.14</span> <a href="#S4.14" shape=
"rect">Grammar Fetching</a></li>
<li class="tocline"><span>4.15</span> <a href="#S4.15" shape=
"rect">ABNF Keywords</a></li>
</ul>
<h3 id="id-S4.1"><a id="S4.1" name="S4.1" shape="rect">4.1 Grammar
Header Declarations</a></h3>
<p>A legal stand-alone grammar header consists of a number of
required declarations and other optional declarations. In addition,
the ABNF Form and XML Form each have additional requirements and
capabilities of the header that are specific to each syntactic
form. The ordering of header declarations is also specific to the
two forms.</p>
<p>The table summarizes the information declared in a grammar
header and the appropriate representation in the ABNF Form and XML
Form.</p>
<table border="1" cellpadding="3" summary=
"Grammar Header Declarations" width="100%">
<tr>
<td colspan="1" rowspan="1"><b>Declaration</b></td>
<td colspan="1" rowspan="1"><b>Status</b></td>
<td colspan="1" rowspan="1"><b>ABNF Form</b></td>
<td colspan="1" rowspan="1"><b>XML Form</b></td>
</tr>
<tr>
<td colspan="1" rowspan="1">Grammar version</td>
<td colspan="1" rowspan="1">Required</td>
<td colspan="1" rowspan="1"><a href="#S4.2" shape=
"rect">&sect;4.2</a>: ABNF self-identifying header</td>
<td colspan="1" rowspan="1"><a href="#S4.3" shape=
"rect">&sect;4.3</a>: <code>version</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">XML Namespace</td>
<td colspan="1" rowspan="1">Required (XML only)</td>
<td colspan="1" rowspan="1">Not applicable</td>
<td colspan="1" rowspan="1"><a href="#S4.3" shape=
"rect">&sect;4.3</a>: <code>xmlns</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Document type</td>
<td colspan="1" rowspan="1">Recommended (XML only)</td>
<td colspan="1" rowspan="1">Not applicable</td>
<td colspan="1" rowspan="1"><a href="#S4.3" shape=
"rect">&sect;4.3</a>: XML DOCTYPE</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Character encoding</td>
<td colspan="1" rowspan="1">Recommended</td>
<td colspan="1" rowspan="1"><a href="#S4.4" shape=
"rect">&sect;4.4</a>: ABNF self-identifying header</td>
<td colspan="1" rowspan="1"><a href="#S4.4" shape=
"rect">&sect;4.4</a>: <code>encoding</code> attribute in XML
declaration</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Language</td>
<td colspan="1" rowspan="1">Required in voice mode<br clear=
"none" />
Ignored in DTMF mode</td>
<td colspan="1" rowspan="1"><a href="#S4.5" shape=
"rect">&sect;4.5</a>: <code>language</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.5" shape=
"rect">&sect;4.5</a>: <code>xml:lang</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Mode</td>
<td colspan="1" rowspan="1">Optional</td>
<td colspan="1" rowspan="1"><a href="#S4.6" shape=
"rect">&sect;4.6</a>: <code>mode</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.6" shape=
"rect">&sect;4.6</a>: <code>mode</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Root rule</td>
<td colspan="1" rowspan="1">Optional</td>
<td colspan="1" rowspan="1"><a href="#S4.7" shape=
"rect">&sect;4.7</a>: <code>root</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.7" shape=
"rect">&sect;4.7</a>: <code>root</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Tag format</td>
<td colspan="1" rowspan="1">Optional</td>
<td colspan="1" rowspan="1"><a href="#S4.8" shape=
"rect">&sect;4.8</a>: <code>tag-format</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.8" shape=
"rect">&sect;4.8</a>: <code>tag-format</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Base URI</td>
<td colspan="1" rowspan="1">Optional</td>
<td colspan="1" rowspan="1"><a href="#S4.9" shape=
"rect">&sect;4.9</a>: <code>base</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.9" shape=
"rect">&sect;4.9</a>: <code>xml:base</code> attribute on
<code>grammar</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Pronunciation lexicon</td>
<td colspan="1" rowspan="1">Optional. Multiple allowed.</td>
<td colspan="1" rowspan="1"><a href="#S4.10" shape=
"rect">&sect;4.10</a>: <code>lexicon</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.10" shape=
"rect">&sect;4.10</a>: <code>lexicon</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Metadata</td>
<td colspan="1" rowspan="1">Optional. Multiple allowed.</td>
<td colspan="1" rowspan="1"><a href="#S4.11.1" shape=
"rect">&sect;4.11.1</a>: <code>meta</code> and
<code>http-equiv</code> declarations</td>
<td colspan="1" rowspan="1"><a href="#S4.11.1" shape=
"rect">&sect;4.11.1</a>: <code>meta</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">XML metadata</td>
<td colspan="1" rowspan="1">Optional. (XML Only)</td>
<td colspan="1" rowspan="1">Not applicable</td>
<td colspan="1" rowspan="1"><a href="#S4.11.2" shape=
"rect">&sect;4.11.2</a>: <code>metadata</code> element</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Tag</td>
<td colspan="1" rowspan="1">Optional. Multiple allowed.</td>
<td colspan="1" rowspan="1"><a href="#S4.12" shape=
"rect">&sect;4.12</a>: <code>tag</code> declaration</td>
<td colspan="1" rowspan="1"><a href="#S4.12" shape=
"rect">&sect;4.12</a>: <code>tag</code> element</td>
</tr>
</table>
<a id="grammar-version" name="grammar-version" shape="rect"></a>
<p>A grammar that complies to this specification must declare the
version to be "1.0".</p>
<p>Note: the grammar version indicates the version of the
specification implemented by the grammar and is not for versioning
of the grammar content. A <a href="#S4.11.1" shape=
"rect"><code>meta</code></a> or <a href="#S4.11.2" shape=
"rect"><code>metadata</code></a> declaration may be used for
content versioning.</p>
<blockquote>
<h4 id="id-S4.1-abnf">ABNF Form: Header Summary</h4>
<p>A legal header for a stand-alone ABNF document consists of a
required <a href="#S4.2" shape="rect">ABNF self-identifying
header</a> including the grammar version and optional <a href=
"#S4.4" shape="rect">character encoding</a> followed by these
declarations in any order:</p>
<ul>
<li><a href="#S4.5" shape="rect">Language</a></li>
<li><a href="#S4.6" shape="rect">Mode</a></li>
<li><a href="#S4.7" shape="rect">Root rule</a></li>
<li><a href="#S4.8" shape="rect">Tag format</a></li>
<li><a href="#S4.9" shape="rect">Base URI</a></li>
<li><a href="#S4.10" shape="rect">Pronunciation lexicon</a> (any
number)</li>
<li><a href="#S4.11" shape="rect">Meta and http-equiv</a> (any
number)</li>
<li><a href="#S4.12" shape="rect">Tag</a> (any number)</li>
</ul>
<p><a href="#S4.13" shape="rect">ABNF comments</a> may appear
between the declarations in the ABNF header after the ABNF
self-identifying header.</p>
<p>The header declarations are followed by the <a href="#S3" shape=
"rect">rule definitions</a> of the grammar.</p>
<p>The following are two examples of ABNF headers. Note that
ordering of the declarations (except the ABNF self-identifying
header) is unimportant.</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

language en;
mode voice;
root $myRule;
tag-format FORMAT-STRING;
base &lt;http://www.example.com/base-file-path&gt;;
lexicon &lt;http://www.example.com/lexicon.file&gt;;
lexicon &lt;http://www.example.com/strange-city-names.file&gt;~&lt;media-type&gt;;
meta "Author" is "Stephanie Williams";
http-equiv "Date" is "Fri, 10 Feb 2002 17:27:21 GMT";
<span>{var x=1};</span>
</pre>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0;

// A French Canadian grammar
language fr-CA;

// It's a speech grammar
mode voice;

// Here's the root rule
root $QuebecCities;
</pre></blockquote>
<blockquote>
<h4 id="id-S4.1-xml">XML Form: Header Summary</h4>
<p>A legal stand-alone XML Form grammar document consists of:</p>
<ol>
<li>Legal <a href="#S4.3" shape="rect">XML Prolog</a></li>
<li>Root grammar element with the following attributes
<ul>
<li><a href="#S4.3" shape="rect">XML namespace</a></li>
<li><a href="#S4.3" shape="rect">XML Schema attributes</a></li>
<li><a href="#S4.3" shape="rect">Version</a></li>
<li><a href="#S4.5" shape="rect">Language</a></li>
<li><a href="#S4.6" shape="rect">Mode</a></li>
<li><a href="#S4.7" shape="rect">Root rule</a></li>
<li><a href="#S4.8" shape="rect">Tag format</a></li>
<li><a href="#S4.9" shape="rect">Base URI</a></li>
</ul>
</li>
<li><code>grammar</code> element containing any number of the
following elements in any order:
<ul>
<li><a href="#S4.10" shape="rect">Pronunciation lexicon</a> (any
number)</li>
<li><a href="#S4.11.1" shape="rect">Meta and HTTP-Equiv</a> (any
number)</li>
<li><a href="#S4.11.2" shape="rect">Metadata</a> (any number)</li>
<li><a href="#S4.12" shape="rect">Tag</a> (any number)</li>
</ul>
</li>
</ol>
<p><a href="#S3" shape="rect">Rule definitions</a> follow the
<code>lexicon</code>, <code>meta</code>, <code>metadata</code> and
<span><code>tag</code></span> declarations.</p>
<p>The following are examples of XML Form grammars headers each
including all declarations permitted on the <code>grammar</code>
element and one with the DOCTYPE declaration.</p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;grammar version="1.0" 
         xml:lang="en"
         mode="voice"
         root="myRule"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:base="http://www.example.com/base-file-path"&gt;
</pre>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar version="1.0"
         xml:lang="fr-CA"
         mode="voice"
         root="QuebecCities"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:base="http://www.example.com/another-base-file-path"&gt;
</pre></blockquote>
<h3 id="id-S4.2"><a id="S4.2" name="S4.2" shape="rect">4.2 ABNF
Self-Identifying Header</a></h3>
<p>The <em>ABNF self-identifying header</em> must be present in any
legal stand-alone ABNF Form grammar document.</p>
<p>The first character of an ABNF document must be the "#" symbol
(x23) unless preceded by an optional XML 1.0 <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#charencoding" shape=
"rect"><em>byte order mark</em></a> <a href="#ref-xml" shape=
"rect">[XML &sect;4.3.3]</a>. The ABNF byte order mark follows the
XML definition and requirements. For example, documents encoded in
UTF-16 must begin with the byte order mark.</p>
<p>The optional byte order mark and required "#" symbol must be
followed immediately by the exact string "ABNF" (x41 x42 x4d x46)
or the appropriate equivalent for the document's encoding (e.g. for
UTF-16 little-endian: x23 x00 x41 x00 x42 x00 x4d x00 x46 x00). If
the byte order mark is absent on a grammar encoded in UTF-16 then
the grammar processor should perform <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-guessing" shape=
"rect">auto-detection of character encoding</a> in a manner
analogous to auto-detection of character encoding in XML <a href=
"#ref-xml" shape="rect">[XML &sect;F]</a>.</p>
<p>Next follows a single space character (x20) and the required
version number which is "<code>1.0</code>" for this specification
(x31 x2e x30).</p>
<p>Next follows an optional <a href="#S4.4" shape="rect">character
encoding</a>. Section 4.4 defines character encodings in more
detail. If present, there must be a single space character (x20)
between the version number and the character encoding.</p>
<p>The self-identifying header is finalized with a semicolon (x3b)
followed immediately by a newline. The semicolon must be the first
character following the version number or the character encoding if
is present.</p>
<p>For the remaining declarations of the ABNF header <a href=
"#term-whitespace" shape="rect">white space</a> is not
significant.</p>
<h3 id="id-S4.3"><a id="S4.3" name="S4.3" shape="rect">4.3 XML Form
Prolog and Root Element</a></h3>
<p>A legal stand-alone XML Form grammar document must have a legal
<a href="http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd"
shape="rect">XML Prolog</a> <a href="#ref-xml" shape="rect">[XML
&sect;2.8]</a>.</p>
<p>The XML prolog in an XML Form grammar comprises the XML
declaration and an optional DOCTYPE declaration referencing the
grammar DTD. It is followed by the root <code>grammar</code>
element. The XML prolog may also contain XML comments, processor
instructions and other content permitted by XML in a prolog.</p>
<p>The version number of the XML declaration indicates which
version of XML is being used. The version number of the
<code>grammar</code> element indicates which version of the grammar
specification is being used &mdash; "<code>1.0</code>" for this
specification. The grammar version is a required attribute.</p>
<p>The grammar element must designate the grammar namespace. This
can be achieved by declaring an <code>xmlns</code> attribute or an
attribute with an "xmlns" prefix. See <a href="#ref-xmlns" shape=
"rect">[XMLNS]</a> for details. Note that when the xmlns attribute
is used alone, it sets the default namespace for the element on
which it appears and for any child elements. The namespace for XML
Form grammars is defined as <a href=
"http://www.w3.org/2001/06/grammar" shape=
"rect">http://www.w3.org/2001/06/grammar</a>.</p>
<p>It is recommended that the grammar element also indicate the
location of the grammar schema (see <a href="#AppC" shape=
"rect">Appendix C</a>) via the <code>xsi:schemaLocation</code>
attribute from <a href="#ref-schema1" shape="rect">[SCHEMA1]</a>.
Although such indication is not required, to encourage it this
document provides such indication on all of the examples:</p>
<pre class="xml" xml:space="preserve">
&lt;grammar version="1.0"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"&gt;
  ...
&lt;/grammar&gt;
</pre>
<p>If present, the optional DOCTYPE must reference the standard
DOCTYPE and identifier.</p>
<pre class="xml" xml:space="preserve">
&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;
</pre>
<p>The character encoding is defined on the XML declaration as
defined by the XML specification. See <a href="#S4.4" shape=
"rect">Section 4.4</a> for detail.</p>
<p>The language is defined by the <code>xml:lang</code> attribute
on the <code>grammar</code> element. See <a href="#S4.5" shape=
"rect">Section 4.5</a> for details.</p>
<p>The grammar <code>mode</code> is defined on the
<code>grammar</code> element. See <a href="#S4.6" shape=
"rect">Section 4.6</a> for details.</p>
<p>The <code>root</code> rule is defined on the
<code>grammar</code> element. See <a href="#S4.7" shape=
"rect">Section 4.7</a> for details.</p>
<p>The <code>tag-format</code> is defined on the
<code>grammar</code> element. See <a href="#S4.8" shape=
"rect">Section 4.8</a> for details.</p>
<p>The base URI for the document is defined by the
<code>xml:base</code> attribute on the <code>grammar</code>
element. See <a href="#S4.9" shape="rect">Section 4.9</a> for
details.</p>
<h3 id="id-S4.4"><a id="S4.4" name="S4.4" shape="rect">4.4
Character Encoding</a></h3>
<p>The character encoding declaration indicates the scheme used for
encoding character data in the document. For example, for US
applications it would be common to use US-ASCII, UTF-8 (8-bit
Unicode) or ISO-8859-1. For Japanese grammars, character encodings
such as EUC-JP and UTF-16 (16-bit Unicode) could be used.</p>
<p>Except for the different syntactic representation, the ABNF Form
follows the character encoding handling defined for XML. XML
grammar processors must accept both the UTF-8 and UTF-16 encodings
of ISO/IEC 10646 and may support other character encodings. This
follows from an XML grammar processor being a compliant XML
processor and thus required to support those character encodings.
For consistency, ABNF grammar processor must also accept both the
UTF-8 and UTF-16 encodings of ISO/IEC 10646 and may support other
character encodings.</p>
<p>For both XML Form and ABNF Form grammars the declaration of the
character encoding is optional but strongly recommended. XML
defines behavior for XML processors that receive an XML document
without a character encoding declaration. For consistency an ABNF
grammar processor must follow the same behavior (with adjustments
for the different syntax). (Note the character encoding declaration
is optional only in cases where it is optional for a legal XML
document.)</p>
<blockquote>
<h4 id="id-S4.4-abnf">ABNF Form</h4>
<p>The character encoding declaration is part of the
self-identifying grammar header defined in <a href="#S4.1" shape=
"rect">Section 4.1</a> and is processed in combination with the
byte order mark, if present, using the same procedure as XML 1.0
<a href="#ref-xml" shape="rect">[XML &sect;4.3.3]</a>.</p>
<p>The following are examples of ABNF self-identifying grammar
headers with and without the character encoding declaration.</p>
<p>Note: the ABNF Form syntax does not provide a character
reference syntax for entry of a specific character, for example,
one not directly accessible from available input devices. This
contrasts with <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-references" shape=
"rect">XML 1.0 syntax for character references</a> <a href=
"#ref-xml" shape="rect">[XML &sect;4.1]</a>. For development
requiring character references the XML Form of the specification is
recommended.</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;
</pre>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 EUC-JP;
</pre>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0;
</pre>
<h4 id="id-S4.4-xml">XML Form</h4>
<p>XML declares character encodings as part of the document's XML
declaration on the first line of the document.</p>
<p>The following are examples of XML headers with and without the
character encoding declaration.</p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
</pre>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="EUC-JP"?&gt;
</pre>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0"?&gt;
</pre></blockquote>
<h3 id="id-S4.5"><a id="S4.5" name="S4.5" shape="rect">4.5
Language</a></h3>
<p>The language declaration of a grammar provides the <a href=
"#term-language" shape="rect">language identifier</a> that
indicates the primary language contained by the document and
optionally indicates a country or other variation. Additionally,
any legal rule expansion may be <a href="#S2.7" shape=
"rect">labeled with a language identifier</a>.</p>
<p>The language declaration is required for all speech recognition
grammars: i.e. all grammars for which the <a href="#S4.6" shape=
"rect"><code>mode</code></a> is "voice". (Note that mode defaults
to voice if there is no explicit mode declaration in ABNF or
<code>mode</code> attribute in XML.)</p>
<p>If an XML Form grammar is incorporated within another XML
document &mdash; for example, as supported by VoiceXML 2.0 &mdash; then the
<code>xml:lang</code> attribute is optional on the
<code>grammar</code> element and the <code>xml:lang</code>
attribute must be inherited from the enclosing document.</p>
<p>In <a href="#AppE" shape="rect">DTMF grammars</a> a language
declaration must be ignored if present.</p>
<p>The conformance definition in <a href="#S5" shape="rect">Section
5</a> defines the behavior of a grammar processor when it
encounters a language variant that it does not support.</p>
<blockquote>
<h4 id="id-S4.5-abnf">ABNF Form</h4>
<p><span>The ABNF header must contain zero or one language
declaration.</span> It consists of the keyword
"<code>language</code>", <a href="#term-whitespace" shape=
"rect">white space</a>, a legal <a href="#term-language" shape=
"rect">language identifier</a>, optional <a href="#term-whitespace"
shape="rect">white space</a> and a terminating semicolon character
(';').</p>
<pre class="abnf" xml:space="preserve">
language en-US;
</pre>
<pre class="abnf" xml:space="preserve">
language fr;
</pre>
<h4 id="id-S4.5-xml">XML Form</h4>
<p>Following the XML 1.0 specification <a href="#ref-xml" shape=
"rect">[XML &sect;2.12]</a> the <a href="#term-language" shape=
"rect">language identifier</a> is indicated by an
<code>xml:lang</code> attribute on the root <code>grammar</code>
element.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en-US" 
         version="1.0"&gt;
</pre>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="fr"
         version="1.0"&gt;
</pre></blockquote>
<h3 id="id-S4.6"><a id="S4.6" name="S4.6" shape="rect">4.6 Grammar
Mode</a></h3>
<p>The mode of a grammar indicates the type of input that the user
agent should be detecting. The default mode is "<code>voice</code>"
for speech recognition grammars. An alternative input mode defined
in <a href="#AppE" shape="rect">Appendix E</a> is
"<code>dtmf</code>" input.</p>
<p>The <code>mode</code> attribute indicates how to interpret the
<a href="#S2.1" shape="rect">tokens</a> contained by the grammar.
Speech tokens are expected to be detected as speech audio that
sounds like the token. Behavior with DTMF input, if supported, is
defined in <a href="#AppE" shape="rect">Appendix E</a>.</p>
<p>It is often the case that a different user agent is used for
detecting DTMF tones than for speech recognition. The same may be
true for other modes defined in future revisions of the
specification.</p>
<p>The specification does not define a mechanism by which a single
grammar can mix modes: that is, a representation for a mixed
"<code>voice</code>" and "<code>dtmf</code>" grammar is not
defined. Moreover, it is illegal for a rule reference in one
grammar to reference any grammar with a different mode.</p>
<p>A user agent may, however, support the simultaneous activation
of more than one grammar including both "<code>voice</code>" and
"<code>dtmf</code>" grammars. This is necessary, for example, for
DTMF-enabled VoiceXML browsers <a href="#ref-vxml2" shape=
"rect">[VXML2]</a>. (Note: parallel activation implies disjunction
at the root level of the grammars rather than mixing of modes
within the structure of the grammars.)</p>
<blockquote>
<h4 id="id-S4.6-abnf">ABNF Form</h4>
<p><span>The ABNF header must contain zero or one mode
declaration.</span> It consists of the keyword "<code>mode</code>",
<a href="#term-whitespace" shape="rect">white space</a>, either
"<code>voice</code>" or "<code>dtmf</code>" optional <a href=
"#term-whitespace" shape="rect">white space</a> and a terminating
semicolon character (';'). If the ABNF header does not declare the
mode then it defaults to <code>voice</code>.</p>
<pre class="abnf" xml:space="preserve">
  mode voice;
</pre>
<pre class="abnf" xml:space="preserve">
  mode dtmf;
</pre>
<h4 id="id-S4.6-xml">XML Form</h4>
<p>The <code>mode</code> declaration is provided as an optional
<code>mode</code> attribute on the root <code>grammar</code>
element. Legal values are <code>"voice"</code> and
<code>"dtmf"</code>. If the mode attribute is omitted then the
value defaults to <code>voice</code>.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar mode="voice"
         version="1.0"
         xml:lang="en-US"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"&gt; 
</pre>
<pre class="xml" xml:space="preserve">
&lt;grammar mode="dtmf" 
         version="1.0"
                  xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"&gt;
</pre></blockquote>
<h3 id="id-S4.7"><a id="S4.7" name="S4.7" shape="rect">4.7 Root
Rule</a></h3>
<p>Both the XML Form and ABNF Form permit the grammar header to
optionally declare a single rule to be the root rule of the
grammar. The rule declared as the root rule must be defined within
the scope of the grammar. The rule declared as the root rule may be
<a href="#S3.2" shape="rect">scoped</a> as either
<code>public</code> or <code>private</code>.</p>
<p>A<span>n</span> <a href="#S2.2" shape=
"rect"><span>implicit</span> rule reference</a> to the root rule of
a grammar is legal. The syntax for <span>implicitly</span>
referencing root rules is defined in <a href="#S2.2" shape=
"rect">Section 2.2</a>. It is an error to reference a grammar
<span>implicitly</span> by its root if that grammar does not
declare a legal root rule.</p>
<p>Although a grammar is not required to declare a root rule it is
good practice to declare the root rule of any grammar.</p>
<blockquote>
<h4 id="id-S4.7-abnf">ABNF Form</h4>
<p><span>The ABNF header must contain zero or one root rule
declaration.</span> It consists of the keyword "<code>root</code>",
<a href="#term-whitespace" shape="rect">white space</a>, the
<a href="#S3.1" shape="rect">legal rulename</a> of a rule defined
within the grammar prefixed by the dollar sign ('$'), optional
<a href="#term-whitespace" shape="rect">white space</a> and a
terminating semicolon character (';'). If the ABNF header does not
declare the root rule then it is not legal to
<span>implicitly</span> reference the grammar by its root.</p>
<pre class="abnf" xml:space="preserve">
root $rulename;
</pre>
<h4 id="id-S4.7-xml">XML Form</h4>
<p>The <code>root</code> rulename declaration is provided as an
optional <code>root</code> attribute on the <code>grammar</code>
element. The <code>root</code> declaration must identify one rule
defined elsewhere within the same grammar. The value of the root
attribute is an XML IDREF (not a URI) and must not include the
number sign ('#').</p>
<pre class="xml" xml:space="preserve">
&lt;grammar root="rulename" ...&gt; 
</pre></blockquote>
<h3 id="id-S4.8"><a id="S4.8" name="S4.8" shape="rect">4.8 Tag
Format</a></h3>
<p>The <code>tag-format</code> declaration is an optional
declaration of a <em>tag-format identifier</em> that indicates the
content type of all <span><a href="#S2.6" shape="rect">rule
tags</a> and <a href="#S4.12" shape="rect">header tags</a></span>
contained within a grammar.</p>
<p>The tag-format identifier is a <a href="#term-uri" shape=
"rect">URI</a>. It is recommended that the tag format identifier
indicate both the content type and a version. Tags typically
contain content for a <a href="#S1.4" shape="rect">semantic
interpretation</a> processor and in such cases the identifier, if
present, should indicate the semantic processor to use.</p>
<p>Tag-format identifier values beginning with the string
"semantics/x.y" (where x and y are digits) are reserved for use by
the <i>W3C Semantic Interpretation for Speech Recognition</i>
specification <a href="#ref-sem" shape="rect">[SEM]</a> or future
versions of the specification.</p>
<p>Grammar processor handling of tags is undefined if the tag
format declaration is omitted.</p>
<blockquote>
<h4 id="id-S4.8-abnf">ABNF Form</h4>
<p><span>The ABNF header must contain zero or one tag format
declaration.</span> It consists of the keyword
"<code>tag-format</code>", <a href="#term-whitespace" shape=
"rect">white space</a>, a tag format identifier (an ABNF <a href=
"#term-uri" shape="rect">URI</a>), optional <a href=
"#term-whitespace" shape="rect">white space</a> and a terminating
semicolon character (';').</p>
<p>Informative example ("semantics/1.0" is <span>a reserved
identifier)</span> :</p>
<pre class="abnf" xml:space="preserve">
tag-format &lt;semantics/1.0&gt;;
</pre>
<h4 id="id-S4.8-xml">XML Form</h4>
<p>The <code>tag-format</code> is an optional attribute of the
<code>grammar</code> element and contains a tag format
identifier.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar tag-format="semantics/1.0" ...&gt; 
</pre></blockquote>
<h3 id="id-S4.9"><a id="S4.9" name="S4.9" shape="rect">4.9 Base
URI</a></h3>
<p>Relative URIs are resolved according to a <em>base URI</em>,
which may come from a variety of sources. The base URI declaration
allows authors to specify a document's base URI explicitly. See
<a href="#S4.9.1" shape="rect">Section 4.9.1</a> for details on the
resolution of relative URIs.</p>
<p>The path information specified by the base URI declaration only
affects URIs in the document where the element appears.</p>
<p>The base URI declaration is permitted but optional in both the
XML Form and the ABNF Form.</p>
<p>Note: the base URI may be declared in a <a href="#S4.11.1"
shape="rect">meta declaration</a> but the explicit base declaration
is recommended for both the ABNF Form and XML Form.</p>
<blockquote>
<h4 id="id-S4.9-abnf">ABNF Form</h4>
<p><span>The ABNF header must contain zero or one base URI
declaration.</span> It consists of the keyword "<code>base</code>",
<a href="#term-whitespace" shape="rect">white space</a>, a legal
<a href="#term-uri" shape="rect">ABNF URI</a>, optional <a href=
"#term-whitespace" shape="rect">white space</a> and a terminating
semicolon character (';').</p>
<pre class="abnf" xml:space="preserve">
base &lt;http://www.example.com/base-file-path&gt;;
</pre>
<pre class="abnf" xml:space="preserve">
base &lt;http://www.example.com/another-base-file-path&gt;;
</pre>
<h4 id="id-S4.9-xml">XML Form</h4>
<p>The base URI declaration follows <a href="#ref-xml-base" shape=
"rect">[XML-BASE]</a> and is indicated by a <code>xml:base</code>
attribute on the root <code>grammar</code> element.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xml:base="http://www.example.com/base-file-path" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         version="1.0"&gt;
</pre>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xml:base="http://www.example.com/another-base-file-path"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         version="1.0"&gt;
</pre></blockquote>
<h4 id="id-S4.9.1-abnf"><a id="S4.9.1" name="S4.9.1" shape=
"rect">4.9.1 Resolving Relative URIs</a></h4>
<p>User agents must calculate the base URI for resolving relative
URIs according to <a href="#ref-rfc2396" shape=
"rect">[RFC2396]</a>. The following describes how RFC 2396 applies
to grammar documents.</p>
<p>User agents must calculate the base URI according to the
following precedences (highest priority to lowest):</p>
<ol>
<li>The base URI is set by the <code>xml:base</code> attribute on
the <code>grammar</code> element or the <code>base</code>
declaration in the ABNF header (see Section 4.9).</li>
<li>The base URI is provided in a <a href="#S4.11.1" shape=
"rect">meta declaration</a>.</li>
<li>The base URI is given by metadata discovered during a protocol
interaction, such as an HTTP header (see <a href="#ref-rfc2616"
shape="rect">[RFC2616]</a>).</li>
<li>By default, the base URI is that of the current document. Not
all grammar documents have a base URI (e.g., a valid grammar
document may appear in an email and may not be designated by a
URI). Such grammar documents are not valid if they contain relative
URIs and rely on a default base URI.</li>
</ol>
<h3 id="id-S4.10"><a id="S4.10" name="S4.10" shape="rect"></a>4.10
Pronunciation Lexicon</h3>
<p>A grammar may optionally reference one or more external
pronunciation lexicon documents. A lexicon document is identified
by a <a href="#term-uri" shape="rect">URI</a> with an optional
<a href="#term-media-type" shape="rect">media type</a>.</p>
<p>The pronunciation information contained within a lexicon
document is used only for tokens defined within the enclosing
grammar.</p>
<p>The W3C Voice Browser Working Group is developing the
Pronunciation Lexicon Markup Language <a href="#ref-lex" shape=
"rect">[LEX]</a>. The specification will address the matching
process between tokens and lexicon entries and the mechanism by
which a speech recognizer handles multiple pronunciations from
internal and grammar-specified lexicons. Pronunciation handling
with proprietary lexicon formats will necessarily be specific to
the speech recognizer.</p>
<p>Pronunciation lexicons are necessarily language-specific.
Pronunciation lookup in a lexicon and pronunciation inference for
any token may use an algorithm that is language-specific. (See
<a href="#S2.1" shape="rect">Section 2.1</a> for additional
information on token handling and pronunciations.)</p>
<blockquote>
<h4 id="id-S4.10-abnf">ABNF Form</h4>
<p>The ABNF header may contain any number of pronunciation lexicon
declarations (zero, one or many). The lexicon declaration consists
of the "<code>lexicon</code>" keyword followed by <a href=
"#term-whitespace" shape="rect">white space</a>, an <a href=
"#term-uri" shape="rect">ABNF URI</a> or <a href="#term-media-type"
shape="rect">ABNF URI with media type</a>, optional white space and
a closing semicolon (';'). (Note that a lexicon URI is not preceded
by a dollar sign as is the case for ABNF rule references.)
Example:</p>
<pre class="abnf" xml:space="preserve">
   #ABNF V1.0 ISO-8859-1;
   language en-US;
   
   lexicon &lt;http://www.example.com/lexicon.file&gt;;
   lexicon &lt;http://www.example.com/strange-city-names.file&gt;~&lt;media-type&gt;;
   ...
</pre>
<h4 id="id-S4.10-xml">XML Form</h4>
<p>Any number of <code>lexicon</code> elements may occur as
immediate children of the <code>grammar</code> element. The
<code>lexicon</code> element must have a <code>uri</code> attribute
specifying a <a href="#term-uri" shape="rect">URI</a> that
identifies the location of the pronunciation lexicon document.</p>
<p>The <code>lexicon</code> element may have a <code>type</code>
attribute that specifies the <a href="#term-media-type" shape=
"rect">media type</a> of the pronunciation lexicon document.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en" version="1.0"&gt;
   
   &lt;lexicon uri="http://www.example.com/lexicon.file"/&gt;
   &lt;lexicon uri="http://www.example.com/strange-city-names.file" type="media-type"/&gt;
   ...
</pre></blockquote>
<h3 id="id-S4.11"><a id="S4.11" name="S4.11" shape="rect">4.11 Meta
Data</a></h3>
<p>Grammar documents let authors specify metadata &mdash; information
about a document rather than document content &mdash; in a number of
ways.</p>
<p>A <a href="#S4.11.1" shape="rect"><code>meta</code>
declaration</a> in either the ABNF Form or XML Form may be used to
express metadata information in both XML Form and ABNF Form
grammars or to reference metadata available in an external
resource. The XML Form also supports a <a href="#S4.11.2" shape=
"rect"><code>metadata</code> element</a> that provides a more
general and powerful treatment of metadata information than
<code>meta</code>. Since <code>metadata</code> requires an XML
metadata schema which cannot be expressed in ABNF, there is no
equivalent of <code>metadata</code> in the ABNF Form of
grammars.</p>
<h4 id="id-S4.11.1"><a id="S4.11.1" name="S4.11.1" shape=
"rect">4.11.1 Meta and HTTP-Equiv</a></h4>
<p>A <code>meta</code> declaration in either ABNF Form or the XML
Form associates a string to declared meta property or declares
"http-equiv" content.</p>
<p>The <code>seeAlso</code> property is the only defined meta
property name. It is used to specify a resource that might provide
additional metadata information about the containing grammar. This
property is modelled on the <a href=
"http://www.w3.org/TR/2000/CR-rdf-schema-20000327/#s2.3.4" shape=
"rect"><code>rdfs:seeAlso</code> property</a> of Resource
Description Framework (RDF) Schema Specification 1.0 <a href=
"#ref-rdf-schema" shape="rect">[RDF-SCHEMA &sect;2.3.4]</a>.</p>
<p>It is recommended that for general metadata properties that
grammar authors follow the metadata properties defined in the
Dublin Core Metadata Initiative <a href="#ref-dc" shape=
"rect">[DC]</a>. For example, "Creator" to identify the entity
primarily responsible for making the content of the grammar, "Date"
to indicate creation date, or "Source" to indicate the resource
From which a grammar is derived (e.g. when converting an XML Form
grammar to the ABNF Form, use "Source" to provide the URI for the
original document.)</p>
<blockquote>
<h4 id="id-S4.11.1-abnf">ABNF Form</h4>
<p>The ABNF header may contain any number of meta declarations and
http-equiv declarations (zero, one or many). Each declaration
consists of the "<code>meta</code>" or "<code>http-equiv</code>"
keyword followed by <a href="#term-whitespace" shape="rect">white
space</a>, the name string delimited by quotes, the keyword
"<code>is</code>", <a href="#term-whitespace" shape="rect">white
space</a>, the content string delimited by quotes, optional white
space and a closing semicolon (';').</p>
<p>The name string and the content string must be delimited by
either a matching pair of double quotes ('"') or a matching pair of
single quotes ("'").</p>
<p>Informative example:</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0;

meta "Creator" is "Stephanie Williams";
meta "seeAlso" is "http://example.com/my-grammar-metadata.xml";

http-equiv "Expires" is '0';
http-equiv "Date" is "Thu, 12 Dec 2000 23:27:21 GMT"; 
</pre>
<h4 id="id-S4.11.1-xml">XML Form</h4>
<p>A metadata property is declared with a <code>meta</code>
element. Either a <code>name</code> or <code>http-equiv</code>
attribute is required. It is illegal to provide both
<code>name</code> and <code>http-equiv</code> attributes. A
<code>content</code> attribute is required. The <code>meta</code>,
<code>metadata</code> and <code>lexicon</code> elements must occur
before all rule elements contained with the root
<code>grammar</code> element. There are no constraints on the
ordering of the <code>meta</code>, <code>metadata</code> and
<code>lexicon</code> elements.</p>
<p>Informative example:</p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0"?&gt; 
&lt;grammar version="1.0" xml:lang="en-US"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xmlns="http://www.w3.org/2001/06/grammar"&gt; 

  &lt;meta name="Creator" content="Stephanie Williams"/&gt; 
  &lt;meta name="seeAlso" content="http://example.com/my-grammar-metadata.xml"/&gt; 

  &lt;meta http-equiv="Expires" content="0"/&gt; 
  &lt;meta http-equiv="Date" content="Thu, 12 Dec 2000 23:27:21 GMT"/&gt; 
  ... 
&lt;/grammar&gt;
</pre></blockquote>
<h4 id="id-S4.11.2"><a id="S4.11.2" name="S4.11.2" shape=
"rect">4.11.2 XML Metadata (XML Only)</a></h4>
<p>The <code>metadata</code> element is container in which
information about the document can be placed using a metadata
schema. Although any metadata schema can be used with
<code>metadata</code>, it is recommended that the Resource
Description Format (RDF) schema <a href="#ref-rdf-schema" shape=
"rect">[RDF-SCHEMA]</a> is used in conjunction with the general
metadata properties defined in the Dublin Core Metadata Initiative
<a href="#ref-dc" shape="rect">[DC]</a>.</p>
<p>RDF is a declarative language and provides a standard way for
using XML to represent metadata in the form of statements about
properties and relationships of items on the Web. Content creators
should refer to W3C metadata Recommendations <a href=
"#ref-rdf-syntax" shape="rect">[RDF-SYNTAX]</a> and <a href=
"#ref-rdf-schema" shape="rect">[RDF-SCHEMA]</a> when deciding which
metadata RDF schema to use in their documents. Content creators
should also refer to the Dublin Core Metadata Initiative <a href=
"#ref-dc" shape="rect">[DC]</a>, which is a set of generally
applicable core metadata properties (e.g., Title, Creator, Subject,
Description, Copyrights, etc.).</p>
<p>This specification only defines an XML representation for this
form of metadata declaration. There is no ABNF equivalent for
<code>metadata</code>. A conversion of an XML Form grammar to the
ABNF Form may extract the XML metadata into a separate document
that is referenced with a "seeAlso" meta declaration in the ABNF
document. Note: an agent that searches XML documents for metadata
represented with RDF would be unable to locate RDF even if it were
represented in ABNF. Thus, support for RDF in ABNF was considered
low utility.</p>
<blockquote>
<h4 id="id-S4.11.2-xml">XML Form</h4>
<p>Document properties declared with <code>metadata</code> element
can use any metadata schema. The <code>metadata</code>,
<code>meta</code>, and <code>lexicon</code> elements must occur
before all rule elements contained with the root
<code>grammar</code> element. There are no constraints on the
ordering of the <code>metadata</code>, <code>meta</code> and
<code>lexicon</code> elements.</p>
<p>Informative: This is an example of how <code>metadata</code> can
be included in an XML grammar document using the Dublin Core
version 1.0 RDF schema <a href="#ref-dc" shape="rect">[DC]</a>
describing general document information such as title, description,
date, and so on:</p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0"?&gt; 
&lt;grammar
    xmlns="http://www.w3.org/2001/06/grammar" version="1.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
    xml:lang="en-US"&gt;
    
  &lt;metadata&gt;
   &lt;rdf:RDF
       xmlns:rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:rdfs = "http://www.w3.org/TR/1999/PR-rdf-schema-19990303#"
       xmlns:dc = "http://purl.org/metadata/dublin_core#"&gt;

   &lt;!-- Metadata about the grammar document --&gt;
   &lt;rdf:Description about="http://www.example.com/meta.grxml"
       dc:Title="Digit Grammar"
       dc:Description="Digit Grammar in W3C XML Form"
       dc:Publisher="W3C"
       dc:Language="en"
       dc:Date="2002-02-14"
       dc:Rights="Copyright 2002 Jan Smith"
       dc:Format="application/srgs+xml" &gt;                
       &lt;dc:Creator&gt;
          &lt;rdf:Seq ID="CreatorsAlphabeticalBySurname"&gt;
             &lt;rdf:li&gt;Jackie Crystal&lt;/rdf:li&gt;
             &lt;rdf:li&gt;Jan Smith&lt;/rdf:li&gt;
          &lt;/rdf:Seq&gt;
       &lt;/dc:Creator&gt;
   &lt;/rdf:Description&gt;
  &lt;/rdf:RDF&gt;
 &lt;/metadata&gt;

&lt;/grammar&gt;
</pre></blockquote>
<h3 id="id-S4.12"><a id="S4.12" name="S4.12" shape=
"rect"><span>4.12 Tag</span></a></h3>
<p>A grammar may optionally specify one or more <code>tag</code>
declarations in the header. The content of a <code>tag</code> in
the header, just like a <a href="#S2.6" shape="rect">tag in rule
expansions</a>, is an arbitrary string which may be used for
<a href="#S1.4" shape="rect">semantic interpretation</a>.</p>
<blockquote>
<h4 id="id-S4.12-abnf"><span>ABNF Form</span></h4>
<p>The ABNF header may contain any number of tag declarations
(zero, one or many).</p>
<p>The tag declaration consists a string delimited as described in
<a href="#id-S2.6-abnf" shape="rect">S2.6 ABNF Form</a>, followed
by a closing semicolon (';').</p>
<p>The tag content is all text between the opening and closing
delimiters including leading and trailing <a href=
"#term-whitespace" shape="rect">whitespace</a>. The contents of the
tag are not parsed by the grammar processor.</p>
<pre class="abnf" xml:space="preserve">
   #ABNF V1.0 ISO-8859-1;
   language en-US;
   {<a href="#S1.4" shape="rect">TAG-CONTENT-1</a>};
   {!{<a href="#S1.4" shape="rect">TAG-CONTENT-2</a>}!};
   
   $rule = . . .;
   ...
</pre>
<h4 id="id-S4.12-xml"><span>XML Form</span></h4>
<p>Any number of <code>tag</code> elements may occur as immediate
children of the <code>grammar</code> element. The content of
<code>tag</code> is CDATA.</p>
<pre class="xml" xml:space="preserve">
&lt;grammar xmlns="http://www.w3.org/2001/06/grammar" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en" version="1.0"&gt;
   
   &lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>&lt;tag&gt;
   &lt;tag&gt;<a href="#S1.4" shape=
"rect">TAG-CONTENT-2</a>&lt;tag&gt;

   ...
</pre></blockquote>
<h3 id="id-S4.13"><a id="S4.13" name="S4.13" shape=
"rect"><span>4.13</span> Comments</a></h3>
<p>Comments may be placed in most places in a grammar document. For
XML, use XML comments. For ABNF there are documentation comments
and C/C++/Java-style comments.</p>
<blockquote>
<h4 id="id-S4.13-abnf">ABNF Form</h4>
<p>C/C++/Java comments are permitted. Documentation comments are
permitted before <code>grammar</code> and <code>language</code>
declarations and before any <code>rule</code> definition.</p>
<p><a href="#S3.3" shape="rect">Section 3.3</a> defines the format
for representing examples in documentation comments before a rule
definition.</p>
<pre class="abnf" xml:space="preserve">
// C++/Java-style single-line comment
/* C/C++/Java-style comment */
/** Java-style documentation comment */
</pre>
<h4 id="id-S4.13-xml">XML Form</h4>
<p>An XML comment has the following syntax.</p>
<pre class="xml" xml:space="preserve">
&lt;!-- comment --&gt;
</pre></blockquote>
<h3 id="id-S4.14"><a id="S4.14" name="S4.14" shape=
"rect"><span>4.14</span> Grammar Fetching</a></h3>
<p>The fetching and caching behavior of both ABNF Form and XML Form
grammar documents is defined primarily by the environment in which
the grammar processor operates. For instance, VoiceXML 1.0 and
VoiceXML 2.0 define certain fetching and caching behaviors that
apply to grammars activated by a VoiceXML browser. Similarly, any
API for a recognizer that supports ABNF Form or XML Form grammars
may apply fetching and caching behaviors.</p>
<p>Grammar processors are recommended to support the following
interpretation of "rendering" a grammar for the purpose of
determining document freshness.</p>
<p><em>Activation</em> of a grammar is the point at which the
recognizer begins detection of user input matching the grammar and
is therefore analogous to the action of visual or audio rendering
of system output. As with output rendering, grammar freshness
should be checked close to the moment of grammar activation.</p>
<h3 id="id-S4.15"><a id="S4.15" name="S4.15" shape=
"rect"><span>4.15</span> ABNF Keywords</a></h3>
<p>ABNF keywords are case sensitive. The keywords of the ABNF
language are not reserved. The keywords with specified meaning in
ABNF are:</p>
<table border="1" cellpadding="3" summary="ABNF Keywords">
<tr>
<th colspan="1" rowspan="1">Context</th>
<th colspan="1" rowspan="1">Keywords</th>
</tr>
<tr>
<td colspan="1" rowspan="1">Language declaration</td>
<td colspan="1" rowspan="1">"language"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Mode declaration</td>
<td colspan="1" rowspan="1">"mode"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Root declaration</td>
<td colspan="1" rowspan="1">"root"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Tag format declaration</td>
<td colspan="1" rowspan="1">"tag-format"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Base URI declaration</td>
<td colspan="1" rowspan="1">"base"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Pronunciation lexicon</td>
<td colspan="1" rowspan="1">"lexicon"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Meta or HTTP-equiv declaration</td>
<td colspan="1" rowspan="1">"meta", "http-equiv", "is"</td>
</tr>
<tr>
<td colspan="1" rowspan="1">Rule definition</td>
<td colspan="1" rowspan="1">"public", "private"</td>
</tr>
</table>
<p>Since keywords are not reserved they may be used as rulenames
and as tokens. The following is a legal grammar that accepts as
input a sequence of one or more "public" tokens.</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

language en-AU;
root $public;
mode voice;

public $public = public $public | public;
</pre>
<h2 id="id-S5"><a id="S5" name="S5" shape="rect">5.
Conformance</a></h2>
<p><strong>This section is normative.</strong></p>
<p>Different sets of grammar conformance criteria exist for:</p>
<ul>
<li class="tocline">5.1 <a href="#S5.1" shape="rect">Conforming XML
Form Grammar Fragments</a></li>
<li class="tocline">5.2 <a href="#S5.2" shape="rect">Conforming
Stand-Alone XML Form Grammar Document</a></li>
<li class="tocline">5.3 <a href="#S5.3" shape="rect">Using XML Form
Grammars with other Namespaces</a></li>
<li class="tocline">5.4 <a href="#S5.4" shape="rect">Conforming XML
Form Grammar Processors</a></li>
<li class="tocline">5.5 <a href="#S5.5" shape="rect">Conforming
Stand-Alone ABNF Form Grammar Documents</a></li>
<li class="tocline">5.6 <a href="#S5.6" shape="rect">Conforming
ABNF Form Grammar Processors</a></li>
<li class="tocline">5.7 <a href="#S5.7" shape="rect">Conforming
ABNF/XML Form Grammar Processors</a></li>
<li class="tocline">5.8 <a href="#S5.8" shape="rect">Conforming
User Agents</a></li>
</ul>
<h3 id="id-S5.1"><a id="S5.1" name="S5.1" shape="rect">5.1:
Conforming XML Form Grammar Fragments</a></h3>
<p>An XML Form grammar document fragment is a <em>Conforming XML
Form Grammar Fragment</em> if:</p>
<ul>
<li>it is a <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-well-formed" shape=
"rect">well-formed</a> XML document <a href="#ref-xml" shape=
"rect">[XML]</a> conforming to namespaces in XML <a href=
"#ref-xmlns" shape="rect">[XMLNS]</a></li>
<li>and it conforms to the criteria for <a href="#S5.2" shape=
"rect">Conforming Stand-Alone XML Form Grammar Document</a> after:
<ul>
<li>all non-grammar namespace elements and attributes and all
<code>xmlns</code> attributes which refer to non-grammar namespace
elements are removed from the document,</li>
<li>and, an appropriate XML declaration (i.e.,
<code>&lt;?xml...?&gt;</code>) is included at the top of the
document,</li>
<li>and, if the <code>grammar</code> element does not already
designate the grammar namespace using the "xmlns" attribute, then
<code>xmlns="http://www.w3.org/2001/06/grammar"</code> is added to
the element.</li>
</ul>
</li>
</ul>
<h3 id="id-S5.2"><a id="S5.2" name="S5.2" shape="rect">5.2:
Conforming Stand-Alone XML Form Grammar Document</a></h3>
<p>A document is a <em>Conforming Stand-Alone XML Form Grammar
Document</em> if it meets both the following conditions.</p>
<ul>
<li>It is a <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-well-formed" shape=
"rect">well-formed</a> XML document <a href="#ref-xml" shape=
"rect">[XML]</a> conforming to namespaces in XML <a href=
"#ref-xmlns" shape="rect">[XMLNS]</a>.</li>
<li>It is <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-prolog-dtd" shape=
"rect">valid XML document</a> which adheres to the specification
described in this document (<a href="#S1" shape="rect">Speech
Recognition Grammar Specification</a>) including the constraints
expressed in the schema (see <a href="#AppC" shape="rect">Appendix
C</a>) and having an XML Form prolog and &lt;grammar&gt; root
element as specified in <a href="#S4.3" shape="rect">Section
4.3</a> and</li>
</ul>
<p>The XML Form grammar specification and these conformance
criteria provide no designated size limits on any aspect of grammar
documents. There are no maximum values on the number of elements,
the amount of character data, or the number of characters in
attribute values.</p>
<h3 id="id-S5.3"><a id="S5.3" name="S5.3" shape="rect">5.3 Using
XML Form Grammars with other Namespaces</a></h3>
<p>The grammar namespace may be used with other XML namespaces as
per the Namespaces in XML Recommendation <a href="#ref-xmlns"
shape="rect">[XMLNS]</a>. Future work by W3C will address ways to
specify conformance for documents involving multiple
namespaces.</p>
<h3 id="id-S5.4"><a id="S5.4" name="S5.4" shape="rect">5.4
Conforming XML Form Grammar Processors</a></h3>
<p>An XML Form grammar processor is a program that can parse and
process XML Form grammar documents. Examples include speech
recognizers and DTMF detectors that accept the XML Form.</p>
<p>In a <em>Conforming XML Form Grammar Processor</em>, the XML
parser must be able to parse and process all XML constructs defined
by XML 1.0 <a href="#ref-xml" shape="rect">[XML]</a> and Namespaces
in XML <a href="#ref-xmlns" shape="rect">[XMLNS]</a>. This XML
parser is not required to perform validation of a grammar document
as per its schema or DTD; this implies that during processing of an
XML Form grammar document it is optional to apply or expand
external entity references defined in an external DTD.</p>
<p>A Conforming XML Form Grammar Processor must correctly
understand and apply the semantics of each possible grammar feature
defined by this document.</p>
<p>A Conforming XML Form Grammar Processor must meet the following
requirements for handling of languages:</p>
<ul>
<li>A Conforming Grammar Processor is required to parse all legal
language declarations successfully.</li>
<li>A Conforming Grammar Processor should inform its hosting
environment if it encounters a language that it can not
support.</li>
<li>A Conforming Grammar Processor that can support a given
language, must be able to activate the root, any single public
rule, or any set of public rules or roots of one or many grammars
where each rule or root and all directly or indirectly referenced
sub-rules are for this same given language.</li>
<li>A Conforming Grammar Processor may activate a part (i.e., the
root, any single public rule, or any set of public rules) of one or
many grammars where the parts contain multiple languages, with one or
more languages in each part. When a processor is able to support each
language in the set but is unable to handle them concurrently it
should inform the hosting environment. When the set includes one or
more languages that are not supported by the processor it should
inform the hosting environment.</li>
<li>A Conforming Grammar Processor may implement languages by
approximate substitutions according to a documented,
platform-specific behavior. For example, using a US English speech
recognizer to process British English input.</li>
</ul>
<p>When a Conforming XML Form Grammar Processor encounters elements
or attributes in a non-grammar namespace it may:</p>
<ul>
<li>ignore the non-standard elements and/or attributes</li>
<li>or, process the non-standard elements and/or attributes</li>
<li>or, reject the document containing those elements and/or
attributes</li>
</ul>
<p>A Conforming XML Form Grammar Processor is not required to
support recursive grammars, that is, grammars in which <a href=
"#S2.2" shape="rect">rule references</a> include direct or indirect
self-reference.</p>
<p>There is, however, no conformance requirement with respect to
performance characteristics of the XML Form Grammar Processor. For
instance, no statement is required regarding the accuracy, speed or
other characteristics of a speech recognizer or DTMF detector. No
statement is made regarding the size of grammar or size of grammar
vocabulary that an XML Form Grammar Processor must support.</p>
<h3 id="id-S5.5"><a id="S5.5" name="S5.5" shape="rect">5.5:
Conforming Stand-Alone ABNF Form Grammar Documents</a></h3>
<p>An ABNF grammar document is a Conforming ABNF Document if it
adheres to the specification described in this document (<a href=
"#S1" shape="rect">Speech Recognition Grammar Specification</a>)
including the <a href="#AppD" shape="rect">Formal ABNF
Specification</a>.</p>
<h3 id="id-S5.6"><a id="S5.6" name="S5.6" shape="rect">5.6:
Conforming ABNF Form Grammar Processor</a></h3>
<p>An ABNF Grammar Processor is a program that can parse and
process ABNF grammar documents. Examples include speech recognizers
and DTMF detectors that accept the ABNF Form.</p>
<p>A Conforming ABNF Grammar Processor must correctly understand
and apply the semantics of each possible grammar feature defined by
this document.</p>
<p>A Conforming ABNF Grammar Processor must follow the same
language handling requirements as outlined in <a href="#S5.4"
shape="rect">Section 5.4</a> for Conforming XML Form Grammar
Processors.</p>
<p>A Conforming ABNF Grammar Processor should inform its hosting
environment if it encounters an illegal grammar document or other
grammar content that it is unable to process.</p>
<p>A Conforming ABNF Grammar Processor is not required to support
recursive grammars, that is, grammars in which <a href="#S2.2"
shape="rect">rule references</a> include direct or indirect
self-reference.</p>
<p>There is, however, no conformance requirement with respect to
performance characteristics of the ABNF Grammar Processor. For
instance, no statement is required regarding the accuracy, speed or
other characteristics of a speech recognizer or DTMF detector. No
statement is made regarding the size of grammar or size of grammar
vocabulary that an ABNF Grammar Processor must support.</p>
<h3 id="id-S5.7"><a id="S5.7" name="S5.7" shape="rect">5.7:
Conforming ABNF/XML Form Grammar Processor</a></h3>
<p>A Conforming ABNF/XML Form Grammar Processor must meet all the
conformance criteria defined in <a href="#S5.4" shape=
"rect">Section 5.4</a> and in <a href="#S5.6" shape="rect">Section
5.6</a>.</p>
<p>Additionally an ABNF/XML Form Grammar Processor must be able to
resolve and apply <a href="#S2.2" shape="rect">references</a> from
XML Form Grammars to ABNF Form Grammars, and <a href="#S2.2" shape=
"rect">references</a> from ABNF Form Grammars to XML Form
Grammars.</p>
<h3 id="id-S5.8"><a id="S5.8" name="S5.8" shape="rect">5.8:
Conforming User Agent</a></h3>
<p>A conforming user agent is a <a href="#S5.4" shape=
"rect">Conforming XML Form Grammar Processor</a>, <a href="#S5.6"
shape="rect">Conforming ABNF Form Grammar Processor</a> or <a href=
"#S5.7" shape="rect">Conforming ABNF/XML Form Grammar Processor</a>
that is capable of accepting user input of the <a href="#S4.6"
shape="rect"><code>mode</code></a> of a grammar (i.e. speech input
in <code>"voice"</code> mode, DTMF input <code>"dtmf"</code> mode)
and:</p>
<ol>
<li>Is capable of determining when a sequence of user input exactly
matches a grammar,</li>
<li>Is capable of producing an output representation that indicates
how the input matches the grammar.</li>
</ol>
<p>Current speech recognition technology is statistically based.
Since the output is not deterministic and cannot be guaranteed to
be a correct representation of the input there is no conformance
requirement regarding accuracy. A conformance test may, however,
require some examples of correct recognition of speech input to
determine conformance.</p>
<h2 id="id-S6"><a id="S6" name="S6" shape="rect">6.
Acknowledgements</a></h2>
<p>This document was written with the participation of the members
of the W3C Voice Browser Working Group <em>(listed in alphabetical
order)</em>:</p>
<dl>
<dd>Mike Brown, Lucent Bell Labs<br clear="none" />
Dan Burnett, Nuance Communications<br clear="none" />
Emily Candell, Comverse<br clear="none" />
<span>Jerry Carter, Invited Expert</span><br clear="none" />
<span>Debbie Dahl, Invited Expert</span><br clear="none" />
Debajit Ghosh, Nuance Communications<br clear="none" />
Andrew Hunt, <span>ScanSoft</span><br clear="none" />
<span>Stefan Krause, ScanSoft</span><br clear="none" />
Sol Lerner, <span>ScanSoft</span><br clear="none" />
Bruce Lucas, IBM<br clear="none" />
<span>Jens Marschner, ScanSoft</span><br clear="none" />
Scott McGlashan, <span>Hewlett-Packard</span><br clear="none" />
Yves Normandin, Locus Dialogue<br clear="none" />
Brad Porter, Tellme<br clear="none" />
<span>Dave Raggett, W3C/Canon</span><br clear="none" />
David Ramsthaler, Cisco<br clear="none" />
Luc Van Tichelen, ScanSoft<br clear="none" />
Kuansan Wang, Microsoft<br clear="none" />
Laura Werner, BeVocal<br clear="none" /></dd>
</dl>
<h2 id="id-AppA"><a id="AppA" name="AppA" shape="rect">Appendix A:
References</a></h2>
<h3 id="id-AppA.1"><a id="AppA.1" name="AppA.1" shape="rect">A.1:
Normative References</a></h3>

<dl>
<dt><a id="ref-rfc2119" name="ref-rfc2119" shape=" rect">[RFC2119]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc2119.txt">Key words for use in RFCs to Indicate
Requirement Levels</a></cite>,
    S. Bradner.
     IETF RFC 2119. See http://www.ietf.org/rfc/rfc2119.txt</dd>
<dt><a id="ref-rfc2045" name="ref-rfc2045" shape=" rect">[RFC2045]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc2045.txt">Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message Bodies</a></cite>,
    N. Freed and N. Borenstein.
    
IETF RFC 2045. November, 1996. See http://www.ietf.org/rfc/rfc2045.txt</dd>

<dt><a id="ref-rfc2046" name="ref-rfc2046" shape=" rect">[RFC2046]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc2046.txt">Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types</a></cite>,
    N. Freed and N. Borenstein.
     IETF RFC 2046.
November 1996. See http://www.ietf.org/rfc/rfc2046.txt</dd>
<dt><a id="ref-rfc2396" name="ref-rfc2396" shape=" rect">[RFC2396]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc2396.txt">Uniform Resource Identifiers (URI): Generic Syntax</a></cite>,
    T. Berners-Lee, R. Fielding, U.C. Irvine, L. Masinter.
     IETF
RFC 2396. 1998. See http://www.ietf.org/rfc/rfc2396.txt</dd>
<dt><a id="ref-schema1" name="ref-schema1" shape=" rect">[SCHEMA1]</a></dt>

<dd><cite><a href="http://www.w3.org/TR/xmlschema-1/">XML Schema Part 1: Structures</a></cite>,
    H. S. Thompson, et al.
    
W3C Recommendation, May 2001. See http://www.w3.org/TR/xmlschema-1/</dd>
<dt><a id="ref-schema2" name="ref-schema2" shape=" rect">[SCHEMA2]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/xmlschema-2/">XML Schema Part 2: Datatypes</a></cite>,
    P.V. Biron, A. Malhotra.
    
W3C Recommendation, May 2001 See http://www.w3.org/TR/xmlschema-2/</dd>
<dt><a id="ref-mimetypes" name="ref-mimetypes" shape=" rect">[TYPES]</a></dt>
<dd><cite><a href="http://www.iana.org/assignments/media-types/index.html">List of media types (MIME types) registered with IANA</a></cite>.
See http://www.iana.org/assignments/media-types/index.html</dd>
<dt><a id="ref-xml" name="ref-xml" shape="rect">[XML]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/2000/REC-xml-20001006">Extensible Markup Language (XML)
1.0 (Second Edition)</a></cite>,
    World Wide Web Consortium.
     W3C Recommendation, 6 October 2000. See
http://www.w3.org/TR/2000/REC-xml-20001006</dd>
<dt><a id="ref-xml-base" name="ref-xml-base" shape=" rect"/>[XML-BASE]</dt>
<dd><cite><a href="http://www.w3.org/TR/2001/REC-xmlbase-20010627/">XML Base</a></cite>,
    J. Marsh, editor.
     W3C Recommendation, June
2001. See http://www.w3.org/TR/2001/REC-xmlbase-20010627/</dd>

<dt><a id="ref-xmlns" name="ref-xmlns" shape=" rect">[XMLNS]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</a></cite>,
    World Wide Web Consortium.
     W3C
Recommendation. See http://www.w3.org/TR/REC-xml-names/</dd>
</dl>
<h3 id="id-AppA.2"><a id="AppA.2" name="AppA.2" shape="rect">A.2:
Informative References</a></h3>
<dl>
<dt><a id="ref-charmod" name="ref-charmod" shape=" rect">[CHARMOD]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/charmod/">Character Model for the World
Wide Web 1.0</a></cite>,
    World Wide Web Consortium. W3C Working Draft, 20 December 2001. See
http://www.w3.org/TR/charmod/</dd>
<dt><a id="ref-dc" class="ref" shape="rect">[DC]</a></dt>
<dd><cite><a href="http://dublincore.org/">Dublin Core Metadata Initiative</a></cite>,
     See http://dublincore.org/.</dd>
<dt><a id="ref-java" name="ref-java" shape="rect">[JAVA]</a></dt>
<dd><cite><a href="http://java.sun.com/docs/books/jls/">The Java Language
Specification (First Edition)</a></cite>,
    James Gosling, Bill Joy, and Guy Steele.
     Addison-Wesley. See http://java.sun.com/docs/books/jls/</dd>

<dt><a id="ref-jsgf" name="ref-jsgf" shape="rect">[JSGF]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/jsgf/">JSpeech Grammar Format</a></cite>,
    Sun Microsystems.
     Sun
Microsystems submission to W3C. See http://www.w3.org/TR/jsgf/</dd>
<dt><a id="ref-html" name="ref-html" shape="rect">[HTML]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/1999/REC-html401-19991224/">HTML 4.01 Specification.</a></cite>,
    World Wide Web Consortium.
    
W3C Recommendation, 24 December 1999. See http://www.w3.org/TR/1999/REC-html401-19991224/</dd>
<dt><a id="ref-hu79" name="ref-hu79" shape="rect">[HU79]</a></dt>

<dd><cite><a href="">Introduction to Automata
Theory, Languages, and Computation</a></cite>,
    J.E. Hopcroft and J.D. Ullman,
    Addison-Wesley, 1979.</dd>
<dt><a id="ref-iso10646" name="ref-iso10646" shape="rect">[ISO/IEC
10646]</a></dt>
<dd><cite><a href="">ISO/IEC 10646-1993 (E). Information technology &mdash; Universal
Multiple-Octet Coded Character Set (UCS) &mdash; Part 1: Architecture
and Basic Multilingual Plane</a></cite>,
    ISO (International Organization for Standardization).
     [Geneva]: International
Organization for Standardization, 1993 (plus amendments AM 1
through AM 7).</dd>
<dt><a id="ref-jel98" name="ref-jel98" shape=" rect">[JEL98]</a></dt>
<dd><cite><a href="">Statistical methods for speech
recognition</a></cite>,
    F. Jelinek.
     MIT Press, 1998. ISBN: 0-262-10066-5.</dd>

<dt><a id="ref-ngram" name="ref-ngram" shape=" rect">[NGRAM]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/ngram-spec/">Stochastic Language Models
(N-Gram) Specification</a></cite>,
    World Wide Web Consortium.
     W3C Working Draft. See http://www.w3.org/TR/ngram-spec/</dd>
<dt><a id="ref-nlsml" name="ref-nlsml" shape=" rect">[NLSML]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/nl-spec/">Natural Language Semantics
Markup Language.</a></cite>,
    World Wide Web Consortium,
     W3C Working Draft, 20 November 2000. See
http://www.w3.org/TR/nl-spec/</dd>
<dt><a id="ref-lex" name="ref-lex" shape="rect">[LEX]</a></dt>

<dd><cite><a href="http://www.w3.org/TR/lexicon-reqs/">Pronunciation Lexicon Markup
Requirements</a></cite>,
    World Wide Web Consortium,
     W3C Working Draft, 12th March 2001. See http://www.w3.org/TR/lexicon-reqs/</dd>
<dt><a id="ref-q24" name="ref-q24" shape="rect">[Q24]</a></dt>
<dd><cite><a href="http://www.itu.int/home/index.html">Multifrequency
push-button signal reception</a></cite>,
    International Telecommunication Union.
     ITU Recommendation approved
1988-11. See http://www.itu.int/home/index.html</dd>
<dt><a id="ref-rab93" name="ref-rab93" shape=" rect">[RAB93]</a></dt>

<dd><cite><a href="">Fundamentals of Speech
Recognition</a></cite>,
    L. Rabiner and B.H. Juang,
     Prentice Hall, 1993. ISBN: 0-13-015157-2.</dd>
<dt><a id="ref-rdf-syntax" class="ref" shape=" rect">[RDF-SYNTAX]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/">Resource Description Framework (RDF) Model and Syntax Specification</a></cite>,
    Ora Lassila and Ralph R. Swick. W3C
Recommendation, 22 February 1999. See http://www.w3.org/TR/1999/REC-rdf-syntax-19990222/</dd>
<dt><a id="ref-rdf-schema" class="ref" shape=" rect">[RDF-SCHEMA]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/2000/CR-rdf-schema-20000327/">Resource Description Framework (RDF) Schema Specification 1.0</a></cite>,
    Dan Brickley and R.V. Guha.
     W3C Candidate
Recommendation, March 2000. See http://www.w3.org/TR/2000/CR-rdf-schema-20000327/</dd>

<dt><a id="ref-rfc1766" name="ref-rfc1766" shape=" rect">[RFC1766]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc1766.txt">Tags for the Identification of Languages</a></cite>,
    H. Alvestrand.
     IETF RFC 1766. See http://www.ietf.org/rfc/rfc1766.txt</dd>
<dt><a id="ref-rfc2616" name="ref-rfc2616" shape=" rect">[RFC2616]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc2616.txt">Hypertext Transfer Protocol &mdash;
HTTP/1.1</a></cite>,
    R. Fielding, et al.
     IETF RFC 2616. 1999. See http://www.ietf.org/rfc/rfc2616.txt</dd>
<dt><a id="ref-rfc2732" name="ref-rfc2732" shape=" rect">[RFC2732]</a></dt>

<dd><cite><a href="http://www.ietf.org/rfc/rfc2732.txt">Format for Literal
IPv6 Addresses in URL's</a></cite>,
    R. Hinden, B. Carpenter, L. Masinter.
     IETF RFC 2732. 1999. See http://www.ietf.org/rfc/rfc2732.txt</dd>
<dt><a id="ref-rfc3066" name="ref-rfc3066" shape=" rect">[RFC3066]</a></dt>
<dd><cite><a href="http://www.ietf.org/rfc/rfc3066.txt">Tags for the Identification of
Languages</a></cite>,
    H. Alvestrand.
     IETF RFC 3066. See http://www.ietf.org/rfc/rfc3066.txt</dd>
<dt><a id="ref-sem" name="ref-sem" shape="rect">[SEM]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/semantic-interpretation/">Semantic Interpretation for
Speech Recognition</a></cite>,
    World Wide Web Consortium,
     W3C Working Draft, 16 November 2001. See

http://www.w3.org/TR/semantic-interpretation/</dd>
<dt><a id="ref-talkml" name="ref-talkml" shape=" rect">[TALKML]</a></dt>
<dd><cite><a href="http://www.w3.org/Voice/TalkML/">Introduction to TalkML</a></cite>,
    Dave Raggett.
     W3C Note. See
http://www.w3.org/Voice/TalkML/</dd>
<dt><a id="ref-unicode" name="ref-unicode" shape=" rect">[Unicode]</a></dt>
<dd><cite>The Unicode Standard, Version 2.0</cite>,
    The Unicode Consortium.
     Reading, Mass.: Addison-Wesley Developers Press,
1996.</dd>

<dt><a id="ref-unicode3" name="ref-unicode3" shape=" rect">[Unicode3]</a></dt>
<dd><cite>The Unicode Standard, Version
3.0</cite>,
    The Unicode Consortium.
     Reading, Mass.: Addison-Wesley Developers Press, 2000.
ISBN 0-201-61633-5.</dd>
<dt><a id="ref-vxml1" name="ref-vxml1" shape=" rect">[VXML1]</a></dt>
<dd><cite><a href="http://www.w3.org/TR/2000/NOTE-voicexml-20000505/">Voice eXtensible Markup Language (VoiceXML)
version 1.0</a></cite>,
    VoiceXML Forum.
     W3C Note, 05 May 2000. See http://www.w3.org/TR/2000/NOTE-voicexml-20000505/</dd>
<dt><a id="ref-vxml2" name="ref-vxml2" shape=" rect">[VXML2]</a></dt>

<dd><cite><a href="http://www.w3.org/TR/2001/WD-voicexml20-20011023/">Voice Extensible Markup Language
(VoiceXML) Version 2.0</a></cite>,
    World Wide Web Consortium.
     W3C Working Draft, 23 October 2001.
See http://www.w3.org/TR/2001/WD-voicexml20-20011023/</dd>
</dl>


<h2 id="id-AppB"><a id="AppB" name="AppB" shape="rect">Appendix B:


DTD for XML Form Grammars</a></h2>
<p><b>This appendix is informative.</b></p>
<p>The grammar DTD is located at <a href="grammar.dtd" shape=
"rect">http://www.w3.org/TR/speech-grammar/grammar.dtd</a></p>
<h2 id="id-AppC"><a id="AppC" name="AppC" shape="rect">Appendix C:
XML Schema Definition For XML Form Grammars</a></h2>
<p><b>This appendix is normative.</b></p>
<p>The grammar schema is located at <a href="grammar.xsd" shape=
"rect">http://www.w3.org/TR/speech-grammar/grammar.xsd</a></p>
<p>Note: the grammar schema includes the <a href=
"#schema-no-namespace" shape="rect">no-namespace core schema</a>
(below).</p>
<p><a id="schema-no-namespace" name="schema-no-namespace" shape=
"rect"></a> The <em>no-namespace core schema</em> for grammars is
located at <a href="grammar-core.xsd" shape=
"rect">http://www.w3.org/TR/speech-grammar/grammar-core.xsd</a>. It
may be used as a basis for specifying XML Form Grammar Fragments
embedded in non-grammar namespace schemas.</p>
<h2 id="id-AppD"><a id="AppD" name="AppD" shape="rect">Appendix D:
Formal Syntax for Augmented BNF Form Grammars</a></h2>
<p><b>This appendix is normative.</b></p>
<p>The notation used here follows the <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#sec-notation" shape=
"rect">EBNF notation</a> (Extended Backus-Naur Form) defined in the
XML 1.0 Recommendation <a href="#ref-xml" shape="rect">[XML
&sect;6]</a>.</p>
<p>The <a href="#term-whitespace" shape="rect">white space handling
of the ABNF Form</a> follows white space and end-of-line handling
of XML (see <a href="#S1.6" shape="rect">Section 1.6</a>).</p>
<p><b>Lexical Grammar for ABNF</b></p>
<p>The lexical grammar defines the lexical tokens of the ABNF
format and has single characters as its terminal symbols. As a
consequence neither <a href="#term-whitespace" shape=
"rect">white space</a> characters nor <a href="#S4.13" shape=
"rect">ABNF comments</a> are allowed in lexical tokens unless
explicitly specified.</p>
<pre class="abnf" xml:space="preserve">
SelfIdentHeader  ::=
    '#ABNF' #x20 VersionNumber (#x20 CharEncoding)? ';'
       <em>[Additional constraints:
          - The semicolon (';') must immediately be followed
            by an <a href="#term-whitespace" shape=
"rect">end-of-line</a>.
       ]</em>

VersionNumber    ::=
    '1.0'
     
CharEncoding     ::=
    Nmtoken

BaseURI          ::=
    ABNF_URI

LanguageCode     ::=
    Nmtoken
        <i>[Additional constraints:
          - The language code must be a valid <a href=
"#term-language" shape="rect">language identifier</a>.
        ]</i>

RuleName         ::=
    '$' ConstrainedName

ConstrainedName  ::=
    Name - (Char* ('.' | ':' | '-') Char*)

TagFormat        ::=
    ABNF_URI

LexiconURI       ::=
    ABNF_URI | ABNF_URI_with_Media_Type

SingleQuotedCharacters ::=
    ''' [^']* '''
     
DoubleQuotedCharacters ::=
    '"' [^"]* '"'
     
QuotedCharacters ::=
    SingleQuotedCharacters | DoubleQuotedCharacters

Weight           ::=
    '/' Number '/'


Repeat           ::=
    [0-9]+ ('-' [0-9]*)?
        <em>[Additional constraints:
          - A number to the right of the hyphen must not be
            greater than the number to the left of the hyphen.
        ]</em>


Probability      ::=
    '/' Number '/'
        <i>[Additional constraints:
          - The float value must be in the range of "0.0"
            to "1.0" (inclusive).
        ]</i>

Number            ::=
    [0-9]+  |  [0-9]+ '.' [0-9]*  |  [0-9]* '.' [0-9]+

ExternalRuleRef  ::=
    '$' ABNF_URI | '$' ABNF_URI_with_Media_Type
        <i>[Additional constraints:
          - The referenced grammar must have the same mode
            ("voice" or "dtmf") as the referencing grammar.
          - If the URI reference contains a fragment
            identifier, the referenced rule must be a
            public rule of another grammar.
          - If the URI reference does not contain a fragment
            identifier, i.e. if it is a<span>n implicit</span> root rule reference,
            then the referenced grammar must declare a root
            rule.
        ]</i>

Token            ::=
    Nmtoken | DoubleQuotedCharacters

LanguageAttachment ::=
    '!' LanguageCode

Tag              ::=
    '{' [^}]* '}'
    | '{!{' (Char* - (Char* '}!}' Char*)) '}!}'

------------------------------------------------------------

<b><a href="#term-uri" shape="rect">ABNF_URI</a>
</b> and <b><a href="#term-media-type" shape=
"rect">ABNF_URI_with_Media_Type</a>
</b> are defined
in <a href="#S1.6" shape="rect">Section 1.6 Terminology</a>.

<b>Name</b> is defined by the XML <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name" shape=
"rect">Name</a> production <a href="#ref-xml" shape=
"rect">[XML &sect;2.3]</a>.

<b>Nmtoken</b> is defined by the XML <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#NT-Nmtoken" shape=
"rect">Nmtoken</a> production <a href="#ref-xml" shape=
"rect">[XML &sect;2.3]</a>.

<b>NameChar</b> is defined by the XML <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#NT-NameChar" shape=
"rect">NameChar</a> production <a href="#ref-xml" shape=
"rect">[XML &sect;2.3]</a>.

<b>Char</b> is defined by the XML <a href=
"http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char" shape=
"rect">Char</a> production <a href="#ref-xml" shape=
"rect">[XML &sect;2.2]</a>.
</pre>
<p>Note: As mentioned in <a href="#S2.5" shape="rect">Section
2.5</a> the symbols "*", "+" and "?", which are often used in
regular expression languages, are reserved for future use in ABNF
and must not be used at any place in a grammar where the syntax
currently permits a repeat operator.</p>
<p><b>Syntactic Grammar for ABNF</b></p>
<p>The syntactic grammar has lexical tokens defined by the lexical
grammar as its terminal symbols. Between two lexical tokens any
number of <a href="#term-whitespace" shape="rect">white spaces</a>
or <a href="#S4.13" shape="rect">ABNF comments</a> may appear.</p>
<pre class="abnf" xml:space="preserve">
grammar         ::=
    SelfIdentHeader declaration* ruleDefinition*

declaration     ::=
    baseDecl | languageDecl | modeDecl | rootRuleDecl
    | tagFormatDecl | lexiconDecl | metaDecl <span>| tagDecl</span>

baseDecl     ::=
    'base' BaseURI ';'
        <i>[Additional constraints:
          - A base declaration must not appear more than
            once in grammar.
        ]</i>

languageDecl    ::=
    'language' LanguageCode ';'
        <i>[Additional constraints:
          - A language declaration must not appear more than
            once in grammar.
          - A language declaration is required if the
            grammar mode is "voice".
        ]</i>

modeDecl        ::=
    'mode' 'voice' ';' | 'mode' 'dtmf' ';'
        <i>[Additional constraints:
          - A mode declaration must not appear more than
            once in grammar.
        ]</i>

rootRuleDecl    ::=
    'root' RuleName ';'
        <i>[Additional constraints:
          - A root rule declaration must not appear more
            than once in grammar.
          - The root rule must be a rule that is defined
            within the grammar.
        ]</i>

tagFormatDecl   ::=
    'tag-format' TagFormat ';'
        <i>[Additional constraints:
          - A tag-format declaration must not appear more
            than once in grammar.
        ]</i>

lexiconDecl     ::=
    'lexicon' LexiconURI ';'

metaDecl        ::=
   'http-equiv' QuotedCharacters 'is' QuotedCharacters ';'
   | 'meta' QuotedCharacters 'is' QuotedCharacters ';'

<span>
tagDecl        ::=
   Tag ';'
</span>

ruleDefinition  ::=
    scope? RuleName '=' ruleExpansion ';'
        <i>[Additional constraints:
          - The rule name must be unique within a grammar,
            i.e. no rule must be defined more than once
            within a grammar.
        ]</i>

scope           ::=
    'private' | 'public'

ruleExpansion   ::=
    ruleAlternative ( '|' ruleAlternative )*

ruleAlternative ::=
    Weight? sequenceElement+

sequenceElement ::=
    subexpansion | subexpansion repeatOperator

subexpansion    ::=
    Token LanguageAttachment?
    | ruleRef 
    | Tag
    | '(' ')'
    | '(' ruleExpansion ')' LanguageAttachment?
    | '[' ruleExpansion ']' LanguageAttachment?

ruleRef         ::=
    localRuleRef | ExternalRuleRef | specialRuleRef

localRuleRef    ::=
    RuleName
        <i>[Additional constraints:
          - The referenced rule must be defined within the
            same grammar.
        ]</i>

specialRuleRef  ::=
    '$NULL' | '$VOID' | '$GARBAGE'


repeatOperator  ::=
    '&lt;' Repeat Probability? '&gt;'
</pre>
<h2 id="id-AppE"><a id="AppE" name="AppE" shape="rect">Appendix E:
DTMF Grammars</a></h2>
<p><b>This appendix is normative.</b></p>
<p>This section defines a normative representation of a grammar
consisting of <a href="#term-dtmf" shape="rect">DTMF</a> tokens. A
DTMF grammar can be used by a DTMF detector to determine sequences
of legal and illegal DTMF events. All grammar processors that
support grammars of mode <code>"dtmf"</code> must implement this
Appendix. However, not all grammar processors are required to
support DTMF input.</p>
<p>If the <a href="#S4.6" shape="rect">grammar mode</a> is declared
as "dtmf" then <a href="#S2.1" shape="rect">tokens</a> contained by
the grammar are treated as DTMF tones (rather than the default of
speech tokens).</p>
<p>There are sixteen (16) DTMF tones. Of these twelve (12) are
commonly found on telephone sets as the digits "0" through "9" plus
"*" (star) and "#" (pound). The four DTMF tones not typically
present on telephones are "A", "B", "C", "D".</p>
<p>Each of the DTMF symbols is a legal DTMF token in a DTMF
grammar. As in speech grammars, tokens must be separated by
<a href="#term-whitespace" shape="rect">white space</a> in a DTMF
grammar. A space-separated sequence of DTMF symbols represents a
temporal sequence of DTMF entries.</p>
<p>In the ABNF Form the "*" symbol is reserved so double quotes
must always be used to delimit "*" when defining an ABNF DTMF
grammar. It is recommended that the "#" symbol also be quoted. As
an alternative the tokens "star" and "pound" are acceptable
synonyms.</p>
<p>In any DTMF grammar any <a href="#S4.5" shape="rect">language
declaration</a> in a grammar header is ignored and any <a href=
"#S2.7" shape="rect">language attachments</a> to rule expansions
are ignored.</p>
<p>In all other respects a DTMF grammar is syntactically the same
as a speech grammar. For example, DTMF grammars may use <a href=
"#S2.2" shape="rect">rule references</a>, <a href="#S2.2.3" shape=
"rect">special rules</a>, <a href="#S2.6" shape="rect">tags</a> and
other specification features.</p>
<p>The following is a simple DTMF grammar that accepts a 4-digit
PIN followed by a pound terminator. It also permits the sequence of
"*" followed by "9" (e.g. to receive a help message).</p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

mode dtmf;

$digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
public $pin = $digit &lt;4&gt; "#" | "*" 9;
</pre>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0"?&gt;

&lt;grammar mode="dtmf" version="1.0" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xmlns="http://www.w3.org/2001/06/grammar"&gt;

&lt;rule id="digit"&gt;
 &lt;one-of&gt;
   &lt;item&gt; 0 &lt;/item&gt;
   &lt;item&gt; 1 &lt;/item&gt;
   &lt;item&gt; 2 &lt;/item&gt;
   &lt;item&gt; 3 &lt;/item&gt;
   &lt;item&gt; 4 &lt;/item&gt;
   &lt;item&gt; 5 &lt;/item&gt;
   &lt;item&gt; 6 &lt;/item&gt;
   &lt;item&gt; 7 &lt;/item&gt;
   &lt;item&gt; 8 &lt;/item&gt;
   &lt;item&gt; 9 &lt;/item&gt;
 &lt;/one-of&gt;
&lt;/rule&gt;

&lt;rule id="pin" scope="public"&gt;
 &lt;one-of&gt;
   &lt;item&gt;
     &lt;item repeat="4"&gt;&lt;ruleref uri="#digit"/&gt;&lt;/item&gt;
     #
   &lt;/item&gt;
   &lt;item&gt;
     * 9
   &lt;/item&gt;
 &lt;/one-of&gt;
&lt;/rule&gt;

&lt;/grammar&gt;
</pre>
<h2 id="id-AppF"><a id="AppF" name="AppF" shape="rect">Appendix F:
XSLT Style Sheet to Convert XML Form Grammars to ABNF Form</a></h2>
<p><b>This appendix is informative.</b></p>
<p>The transformation provided below is illustrative of the
conversion of an XML Form grammar to the Augmented BNF Form. Known
limitations:</p>
<ul>
<li>Comments are not transformed</li>
<li>There is no treatment of empty token elements (which are
illegal in ABNF)</li>
<li>Preserves filenames (e.g. "grammar.grxml") and media types
('application/srgs+xml') in URIs and media type declarations.</li>
<li>Assumes the quoted content within &lt;meta&gt; attributes uses
double quotes. Does not correctly convert &lt;meta&gt; attributes
containing single quotes.</li>
</ul>
<p>The source for this transformation is located at <a href=
"grammar-transformer.xsl" shape=
"rect">http://www.w3.org/TR/speech-grammar/grammar-transformer.xsl</a>.</p>
<h2 id="id-AppG"><a id="AppG" name="AppG" shape="rect">Appendix G.
Media Types and File Suffix</a></h2>
<p><b>This appendix is informative.</b></p>
<p>The W3C Voice Browser Working Group has applied to IANA to
register a <a href="#term-media-type" shape="rect">media type</a>
each for the ABNF Form and XML Form of this Speech Recognition
Grammar Specification.</p>

<ul>
<li>
<p>The ABNF media type identifies ABNF grammars. The media type
applied for is <code>"application/srgs"</code>.</p>
</li>
<li>
<p>Similarly, the XML Form grammar media type identifies XML
Form grammars. The media type applied for is
<code>"application/srgs+xml"</code>.</p>
</li>
</ul>
<p>The W3C Voice Browser Working Group has adopted the convention
of using the ".gram" filename suffix for ABNF grammar documents and
the ".grxml" filename suffix for XML Form grammar documents.</p>
<h2 id="id-AppH"><a id="AppH" name="AppH" shape="rect">Appendix H.
Logical Parse Structure</a></h2>
<p><b>This appendix is informative.</b></p>
<p>This section defines an informative representation of a parsed
result of speech recognition or other user agent processing. This
representation may be used as the basis for subsequent processing
of user input, in particular, <a href="#S1.4" shape="rect">semantic
interpretation</a>. For instance, the W3C Semantic Interpretation
for Speech Recognition specification <a href="#ref-sem" shape=
"rect">[SEM]</a> is defined around the logical parse structure.</p>
<h3 id="id-AppH.1"><a id="AppH.1" name="AppH.1" shape="rect">H.1
Terminology and Notation</a></h3>
<p>This Appendix adopts the terminology and nomenclature of
<em>Introduction to Automata Theory, Languages, and
Computation</em> <a href="#ref-hu79" shape="rect">[HU79]</a>.</p>
<p>Denote the <em>tokens</em> of the alphabet of all tokens
accepted by a grammar as <b>t1, t2...</b>.</p>
<p>An input or output token sequence is a space separated string of
tokens. The logical parse structure contains <a href="#S2.1" shape=
"rect">white-space-normalized tokens</a>. The tokens in the logical
parse structure are optionally delimited by double quotes so that
<a href="#term-whitespace" shape="rect">white space</a> and others
characters can be parsed unambiguously. e.g. <b>t1,t2,"t3 with
space"</b>. (For consistency, all examples in this Appendix include
double quotes.)</p>
<p>Let <b>&epsilon;</b> (epsilon) or "" denote the unique string of
length 0, also known as the empty string.</p>
<p>Denote the <em>tags</em> of the alphabet of all tags accepted by
a grammar as <b>{tag1}, {tag2}, ...</b>.</p>
<p>Denote a legal expansion as <b>E</b>. (A legal expansion is
defined in <a href="#S2" shape="rect">Section 2</a>.)</p>
<p>The expressive power of a rule expansion is a <em>Regular
Expression</em> (see HU79) and has an equivalent <em>Finite
Automaton</em> (see HU79). [The handling of rule references
requires special treatment: see <a href="#AppH.2" shape=
"rect">Section H.2</a>.] The expressive power of the grammar
specification consists of:</p>
<ul>
<li>Tokens: a finite automaton transition with symbol</li>
<li>Tag: a finite automaton transition on &epsilon;</li>
<li>Sequence: concatenation operation on finite automaton</li>
<li>Alternatives: union operation on finite automaton</li>
<li>Repeats: representable by combinations of concatenation,
closure and union.</li>
</ul>
<p>We formalize the logical parse structure by creating a
<em>Finite Automaton with Output</em> (see HU79). This construct is
also referred to as a <em>Finite State Transducer</em>.</p>
<p>We define the transitions for tokens and tags as producing an
output symbol.</p>
<ul>
<li>Token: transition that accepts token <b>t</b> and produces as
output token <b>t</b>.<br clear="none" />
In the notation of HU79: <b>t/t</b></li>
<li>Tag: transition that accepts &epsilon; (no token) and produces
as output <b>{!{tag}!}</b><br clear="none" />
In the notation of HU79: <b>&epsilon;/{!{tag}!}</b></li>
</ul>
<p>We represent parse output as an ordered array of output
entities: <b>[e1,e2,e3,...]</b>.</p>
<p>An entity <b>e</b> may be a token, a tag or a rule expansion
(see <a href="#AppH.2" shape="rect">H.2</a>).</p>
<p>The empty output array is represented as <b>[&epsilon;]</b> or
simply <b>[]</b>.</p>
<h4 id="AppH.1-special">Special Cases</h4>
<p>A $NULL reference is equivalent to a transition that accepts as
input &epsilon; and produces as output &epsilon;. In the notation
of HU79: <b>&epsilon;/&epsilon;</b>.</p>
<p>A $VOID reference is logically equivalent to a missing
transition. It accepts no input and produces no output.</p>
<p>A $GARBAGE reference is equivalent to a transition that accepts
platform specific input and produces as output &epsilon;.</p>
<h4 id="AppH.1-amb">Ambiguity</h4>
<p>An <em>ambiguity</em> occurs when for a specified sequence of
input tokens matched to a specified rule of a grammar there is more
than one distinct logical parse structure that can be produced.</p>
<p>An <em>ambiguity</em> can occur at points of disjunction
(choice) in a grammar. Disjunction exists with the use of <a href=
"#S2.4" shape="rect">alternatives</a> and <a href="#S2.5" shape=
"rect">repeats</a>.</p>
<p>A grammar processor may preserve any number of ambiguous logical
parse structures to create a set of alternative logical parse
structures for the input. It is legal for a grammar processor to
maintain all possible logical parse structures or to dispose of all
but one of the alternatives. There is no specified behavior for
selection of ambiguities amongst possibilities by a grammar
processors. As a result grammars that contain ambiguity do not
guarantee portability of performance. Developers and grammar tools
should be ambiguity-aware.</p>
<p>This Appendix does not illustrate all forms of ambiguous
expansions but provides examples of some of the form common
forms.</p>
<h4 id="AppH.1-examples">Examples</h4>
<p>Matching a token to a token produces an array of 1 token.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">["t1"]</td>
</tr>
</table>
<p>A $NULL reference is matched by an empty input sequence and
output is an empty array.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$NULL</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
</table>
<p>A tag is matched by an empty input sequence and output is an
array of 1 tag.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">{tag} or {!{tag}!}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">[{!{tag}!}]</td>
</tr>
</table>
<p>Concatenation: An expansion consisting of a token and a tag is
matched by input containing the token and produces as output a
token, tag array.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 {tag1}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag1}!}]</td>
</tr>
</table>
<p>Concatenation: an expansion consisting of a sequence of tokens,
tags and $NULLs is matched by input that consists of the contained
tokens. Output consists of the sequence of tokens and tags with
order preserved. e.g.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 $NULL {tag1} t2 {tag2} t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1 t2 t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t2",{!{tag2}!},"t3"]</td>
</tr>
</table>
<p>Parenthetical structure is not preserved in the result. The
following is the same sequence as the previous example but with
parentheticals added to the expansion definition.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">((t1) $NULL) {tag1} (t2 {tag2} t3)</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1 t2 t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t2",{!{tag2}!},"t3"]</td>
</tr>
</table>
<p>Alternatives: a set of many alternative tokens is matched by
input of a single token and produces as output a single token.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 | t2 |t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t2</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">["t2"]</td>
</tr>
</table>
<p>Alternatives: if any single expansion in a set of alternatives
can be matched by null input then the set of alternatives may be
matched by null input and the output is the output of
null-accepting expansion. ($NULL, {tag} and repeat counts of zero
all permit null input.)</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 | t2 | $NULL</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
</table>
<p>With a different null-accepting expansion:</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 | t2 | {tag}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">[{!{tag}!}]</td>
</tr>
</table>
<p>Alternatives and ambiguity: several examples of ambiguous
expansions with the ambiguity arising from alternatives that accept
the same input but produce different output.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 {tag1} | t1 {tag2} | t2</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag1}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag2}!}]</td>
</tr>
</table>
<p>In this example null input is ambiguous.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">{tag1} | {tag2} | $NULL</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">[{!{tag1}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">[{!{tag2}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 3</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
</table>
<p>The following is not ambiguous because the different paths
through the expansion produce the same output.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 | t1 | t2</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">["t1"]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">["t1"]</td>
</tr>
</table>
<p>Repeats: an optional expansion can be either matched by an empty
token sequence or by any token sequence that matches the expansion
contained within the optional.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 &lt;0-1&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input 1</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input 2</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">["t1"]</td>
</tr>
</table>
<p>Repeats: order is preserved upon multiple expansions.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">(t1 {tag1}) &lt;0-3&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input 1</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input 2</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag1}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input 3</em></td>
<td colspan="1" rowspan="1">t1,t1,t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 3</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t1",{!{tag1}!},"t1",{!{tag1}!}]</td>
</tr>
</table>
<p>Repeats and null input: If the contents of an optional expansion
can be matched by an empty input sequence AND the output of
matching the contained expansion is always an empty array then the
output of matching the optional expansion by an empty sequence is
also an empty array.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$NULL &lt;0-1&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
</table>
<p>Ambiguous repeats: If a repeated or optional expansion can be
matched by an empty input sequence BUT the output of matching the
contained expansion may contain tags then the parse is ambiguous.
It is <em>recommended</em> that the parse be minimal: Output 1 is
preferred.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">{tag} &lt;0-&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">""</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">[]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">[{!{tag}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 3</em></td>
<td colspan="1" rowspan="1">[{!{tag}!},{!{tag}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output N</em></td>
<td colspan="1" rowspan="1">
[{!{tag}!},{!{tag}!},{!{tag}!},...]</td>
</tr>
</table>
<p>A similar ambiguity arises if the repeated expansion contains a
alternative expansion that has a null-accepting expansion.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">(t1 | {tag}) &lt;0-3&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">["t1"]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 3</em></td>
<td colspan="1" rowspan="1">[{!{tag}!},"t1"]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 4</em></td>
<td colspan="1" rowspan="1">["t1",{!{tag}!},{!{tag}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 5</em></td>
<td colspan="1" rowspan="1">[{!{tag}!},"t1",{!{tag}!}]</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 6</em></td>
<td colspan="1" rowspan="1">[{!{tag}!},{!{tag}!},"t1"]</td>
</tr>
</table>
<p>A sequence with two repeat expansion can be ambiguous if the two
repeated expansions can accept the same input but produce different
output.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">(t1 {tag1}) &lt;0-2&gt; (t1 {tag2})
&lt;0-2&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t1,t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 1</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t1",{!{tag1}!},"t1",{!{tag1}!}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 2</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t1",{!{tag1}!},"t1",{!{tag2}!}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 3</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag1}!},"t1",{!{tag2}!},"t1",{!{tag2}!}</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output 4</em></td>
<td colspan="1" rowspan="1">
["t1",{!{tag2}!},"t1",{!{tag2}!},"t1",{!{tag2}!}</td>
</tr>
</table>
<h3 id="id-AppH.2"><a id="AppH.2" name="AppH.2" shape="rect">H.2
Parsing Rule References</a></h3>
<p>A rule reference is a legal rule expansion (see <a href="#S2.2"
shape="rect">Section 2.2</a>).</p>
<p>We denote output obtained by matching the token sequence
<b>"t1,t2,..."</b> against the expansion <b>$rulename</b> as
<b>$rulename[e1,e2,...]</b> where <b>"e1,e2,..."</b> is the entity
sequence obtained by matching that token sequence against the rule
expansion defined for $rulename. Where a rule reference to an
external rule is used the ABNF syntax for the rule reference is
used (without any media type). For example,
<code>$&lt;http://www.example.com/grammar.<span>grxml</span>#rulename"&gt;[e1,e2,...]</code>
or a<span>n implicit</span> root rule reference
<code>$&lt;http://www.example.com/grammar.<span>grxml</span>"&gt;[e1,e2,...]</code>.
For brevity, all the examples below use only local rule
references.</p>
<p>The rulename of the top-level rule should enclose the logical
parse structure.</p>
<p>A distinct structure for matching rule references maintains the
parse tree for the result. This structure may be utilized in the
semantic interpretation process or other computational processes
that derive from the parse output structure.</p>
<p>There is no distinction between <a href="#S2.2.1" shape=
"rect">local rule references</a> (within the same grammar) and
<a href="#S2.2.2" shape="rect">external rule references</a>.</p>
<p>There is no distinction between a root reference and a reference
to a named grammar.</p>
<h4 id="AppH.2.example">Examples</h4>
<p>The following is a simple rule reference example.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t1 t2 t3;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$x</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t2,t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">$x["t1","t2","t3"]</td>
</tr>
</table>
<p>The following is a rule reference in sequence.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t2 t3 t4;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 $x t5</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t2,t3,t4,t5</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">["t1",$x["t2","t3","t4"],"t5"]</td>
</tr>
</table>
<p>The following includes a reference to a rule that outputs a
tag.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t2 {tag};</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">t1 $x t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t2,t3</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">["t1",$x["t2",{!{tag}!}],"t3"]</td>
</tr>
</table>
<p>Multiple references to the same rule are permitted.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t1 {tag1};</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$x $x $x</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t1,t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
[$x["t1",{!{tag1}!}],$x["t1",{!{tag1}!}],$x["t1",{!{tag1}!}]]</td>
</tr>
</table>
<p>Rule references may be repeated.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t1 {tag};</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$x &lt;0-&gt;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t1,t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
[$x["t1",{!{tag1}!}],$x["t1",{!{tag1}!}],$x["t1",{!{tag1}!}]]</td>
</tr>
</table>
<h3 id="id-AppH.3"><a id="AppH.3" name="AppH.3" shape="rect">H.3
Recursion</a></h3>
<p>The Speech Recognition Grammar Specification has the expressive
power of a <em>Context Free Grammar</em>. This arises because the
language permits a rule to directly or indirectly reference itself.
[Note: a <a href="#S5.4" shape="rect">Conforming XML Form Grammar
Processor</a> or <a href="#S5.6" shape="rect">Conforming ABNF Form
Grammar Processor</a> is not required to support recursive
grammars.]</p>
<p>There is no distinct representation for a recursive rule
reference.</p>
<h4 id="AppH.3.examples">Examples</h4>
<p>Simple right recursion. Note: this grammar can be written in a
non-recursive (regular expression) form.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = t1 {last} | t1 $x;</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$x</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t1,t1</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
[$x["t1",$x["t1",$x["t1",{!{last}!}]]]]</td>
</tr>
</table>
<p>Embedded recursion. Note that this matches any sequence of
<em>n</em> t1's followed by <em>n</em> t2's.</p>
<table summary="" border="1" cellpadding="3">
<tr>
<td colspan="1" rowspan="1"><em>Rule</em></td>
<td colspan="1" rowspan="1">$x = {bottom} | (t1 $x t2);</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Expansion</em></td>
<td colspan="1" rowspan="1">$x</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Input</em></td>
<td colspan="1" rowspan="1">t1,t1,t2,t2</td>
</tr>
<tr>
<td colspan="1" rowspan="1"><em>Output</em></td>
<td colspan="1" rowspan="1">
[$x["t1",$x["t1",$x[{!{bottom}!}],"t2"],"t2"]]</td>
</tr>
</table>
<h2 id="id-AppI"><a id="AppI" name="AppI" shape="rect">Appendix I.
Features under Consideration for Future Versions</a></h2>
<p><b>This appendix is informative.</b></p>
<p>The following features are under consideration for versions of
the Speech Recognition Grammar Specification after version 1.0:</p>
<ul>
<li>Optimizations for dynamic grammars: e.g. "static" or "volatile"
keywords on rule definitions.</li>
<li>Dynamic variation of weights on alternatives</li>
<li>Definition of grammar fragments</li>
<li>Specified handling of morphological variants of tokens</li>
<li>Inline definition of token pronunciations</li>
<li>Guidance to recognizers on acoustic models</li>
<li>Support for W3C pronunciation lexicon when it is available</li>
<li>Declaration of semantic return types of rules</li>
<li>Possible distinction of "activable" and "exported" rules
(currently merged as "public")</li>
<li>Multi-modal grammars: e.g. speech and DTMF mixed, speech and
keyboard, speech and pointer...</li>
<li>Conformance criteria for grammar generators</li>
<li>Support for timeout parameters within grammars (e.g.
inter-digit timeout for DTMF)</li>
<li>Support for long DTMF tones &mdash; e.g. accept a tone of 1000ms or
longer</li>
<li>XLink for URI references</li>
</ul>
<h2 id="id-AppJ"><a id="AppJ" name="AppJ" shape="rect">Appendix J:
Example Grammars in ABNF Form and XML Form</a></h2>
<p><b>This appendix is informative.</b></p>
<ul>
<li class="tocline">J.1 <a href="#AppJ.1" shape="rect">Simple
Examples (English)</a></li>
<li class="tocline">J.2 <a href="#AppJ.2" shape=
"rect">Cross-Reference Examples (English)</a></li>
<li class="tocline">J.3 <a href="#AppJ.3" shape="rect">Korean
Examples</a></li>
<li class="tocline">J.4 <a href="#AppJ.4" shape="rect">Chinese
Examples</a></li>
<li class="tocline">J.5 <a href="#AppJ.5" shape="rect">Swedish
Examples</a></li>
</ul>
<h3 id="id-AppJ.1"><a id="AppJ.1" name="AppJ.1" shape="rect">J.1:
Simple Examples (English)</a></h3>
<p>The following shows a simple grammar that supports commands such
as "open a file" and "please move the window". It references a
separately-defined grammar for politeness which is not shown
here.</p>
<blockquote>
<h4 id="AppJ.1-abnf">ABNF Form</h4>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 UTF-8;

language en;
mode voice;
root $basicCmd;

meta "author" is "Stephanie Williams";

/**
 * Basic command.
 * @example please move the window
 * @example open a file
 */

public $basicCmd = 
          $&lt;http://grammar.example.com/politeness.gram#startPolite&gt;
          $command
          $&lt;http://grammar.example.com/politeness.gram#endPolite&gt;;

$command = $action $object;
$action = /10/ open {<a href="#S1.4" shape=
"rect">TAG-CONTENT-1</a>} | /2/ close {<a href="#S1.4" shape=
"rect">TAG-CONTENT-2</a>} 
        | /1/ delete {<a href="#S1.4" shape=
"rect">TAG-CONTENT-3</a>} | /1/ move {<a href="#S1.4" shape=
"rect">TAG-CONTENT-4</a>};
$object = [the | a] (window | file | menu);
</pre>
<h4 id="AppJ.1-xml">XML Form</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="en"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         version="1.0" mode="voice" root="basicCmd"&gt;

&lt;meta name="author" content="Stephanie Williams"/&gt;

&lt;rule id="basicCmd" scope="public"&gt;
  &lt;example&gt; please move the window &lt;/example&gt;
  &lt;example&gt; open a file &lt;/example&gt;

  &lt;ruleref uri="http://grammar.example.com/politeness.<span>grxml</span>#startPolite"/&gt;

  &lt;ruleref uri="#command"/&gt;
  &lt;ruleref uri="http://grammar.example.com/politeness.<span>grxml</span>#endPolite"/&gt;

&lt;/rule&gt;

&lt;rule id="command"&gt;
  &lt;ruleref uri="#action"/&gt; &lt;ruleref uri="#object"/&gt;
&lt;/rule&gt;

&lt;rule id="action"&gt;
   &lt;one-of&gt;
      &lt;item weight="10"&gt; open   &lt;tag&gt;<a href="#S1.4"
shape="rect">TAG-CONTENT-1</a>&lt;/tag&gt; &lt;/item&gt;
      &lt;item weight="2"&gt;  close  &lt;tag&gt;<a href="#S1.4"
shape="rect">TAG-CONTENT-2</a>&lt;/tag&gt; &lt;/item&gt;
      &lt;item weight="1"&gt;  delete &lt;tag&gt;<a href="#S1.4"
shape="rect">TAG-CONTENT-3</a>&lt;/tag&gt; &lt;/item&gt;
      &lt;item weight="1"&gt;  move   &lt;tag&gt;<a href="#S1.4"
shape="rect">TAG-CONTENT-4</a>&lt;/tag&gt; &lt;/item&gt;
    &lt;/one-of&gt;
&lt;/rule&gt;

&lt;rule id="object"&gt;
  &lt;item repeat="0-1"&gt;
    &lt;one-of&gt;
      &lt;item&gt; the &lt;/item&gt;
      &lt;item&gt; a &lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/item&gt;

  &lt;one-of&gt;
      &lt;item&gt; window &lt;/item&gt;
      &lt;item&gt; file &lt;/item&gt;
      &lt;item&gt; menu &lt;/item&gt;
  &lt;/one-of&gt;
&lt;/rule&gt;

&lt;/grammar&gt;
</pre></blockquote>
<h3 id="id-AppJ.2"><a id="AppJ.2" name="AppJ.2" shape="rect">J.2:
Cross-Reference Examples (English)</a></h3>
<p>These two grammars illustrate referencing between grammars. The
same grammar is shown in both XML Form and ABNF Form.</p>
<blockquote>
<p><b>ABNF: http://www.example.com/places.gram</b></p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

language en;
mode voice;
root $city_state;

public $city = Boston | Philadelphia | Fargo;

public $state = Florida | North Dakota | New York;

// References to local rules
// Artificial example allows "Boston, Florida!"

public $city_state = $city $state;
</pre>
<p><b>ABNF: http://www.example.com/booking.gram</b></p>
<pre class="abnf" xml:space="preserve">
#ABNF 1.0 ISO-8859-1;

language en;
mode voice;

// Reference by URI syntax
public $flight = I want to fly to
   $&lt;http://www.example.com/places.gram#city&gt;;

// Reference by URI syntax
public $exercise = I want to walk to $&lt;http://www.example.com/places.gram#state&gt;;

// <span>Implicit</span> reference to root rule by URI
public $wet = I want to swim to $&lt;http://www.example.com/places.gram&gt;;
</pre>
<p><b>XML Form Grammar:
http://www.example.com/places.<span>grxml</span></b></p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en" version="1.0" root="city_state" mode="voice"&gt;

   &lt;rule id="city" scope="public"&gt;
     &lt;one-of&gt;
       &lt;item&gt;Boston&lt;/item&gt;
       &lt;item&gt;Philadelphia&lt;/item&gt;
       &lt;item&gt;Fargo&lt;/item&gt;
     &lt;/one-of&gt;
   &lt;/rule&gt;

   &lt;rule id="state" scope="public"&gt;
     &lt;one-of&gt;
       &lt;item&gt;Florida&lt;/item&gt;
       &lt;item&gt;North Dakota&lt;/item&gt;
       &lt;item&gt;New York&lt;/item&gt;
     &lt;/one-of&gt;
   &lt;/rule&gt;

   &lt;!-- Reference by URI to a local rule --&gt;
   &lt;!-- Artificial example allows "Boston, Florida"! --&gt;
   &lt;rule id="city_state" scope="public"&gt;
     &lt;ruleref uri="#city"/&gt; &lt;ruleref uri="#state"/&gt;
   &lt;/rule&gt;
&lt;/grammar&gt;
</pre>
<p><b>XML Form Grammar:
http://www.example.com/booking.<span>grxml</span></b></p>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="en" version="1.0" mode="voice"&gt;

   &lt;!-- Using URI syntax --&gt;
   &lt;rule id="flight" scope="public"&gt;
     I want to fly to 
     &lt;ruleref uri="http://www.example.com/places.<span>grxml</span>#city"/&gt;
   &lt;/rule&gt;

   &lt;!-- Using URI  syntax --&gt;
   &lt;rule id="exercise" scope="public"&gt;
     I want to walk to &lt;ruleref uri="http://www.example.com/places.<span>grxml</span>#state"/&gt;

   &lt;/rule&gt;

   &lt;!-- <span>Implicit</span> reference to root rule of a grammar by URI  --&gt;
   &lt;rule id="wet" scope="public"&gt;
     I want to swim to &lt;ruleref uri="http://www.example.com/places.<span>grxml</span>"/&gt;

   &lt;/rule&gt;
&lt;/grammar&gt;
</pre></blockquote>
<h3 id="id-AppJ.3"><a id="AppJ.3" name="AppJ.3" shape="rect">J.3:
Korean Examples</a></h3>
<p>The following two grammars are XML Form grammars with Korean
yes/no content. The first represents the Korean symbols as Unicode
characters and has UTF-8 encoding. The second represents the same
Unicode characters using character escaping.</p>
<blockquote>
<h4 id="AppJ.3-abnf">ABNF Form Grammar with Unicode Characters in
UTF-8 Encoding</h4>
<pre class="xml" xml:space="preserve">
#ABNF 1.0 UTF-8;

language ko;
mode voice;
root $yes_no_ko;

/* 
 * Simple Korean yes/no grammar 
 * @example &#50696;
 */

public $yes_no_ko = &#50696; | &#50500;&#45768;&#50724; ;
</pre>
<h4 id="AppJ.3-xml">XML Form Grammar with Unicode Characters in
UTF-8 Encoding</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" 
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar xml:lang="ko" version="1.0" mode="voice"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         root="yes_no_ko"&gt;

  &lt;!-- yes/no grammar --&gt;
  &lt;rule id="yes_no_ko" scope="public"&gt;
    &lt;example&gt;&#50696;&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;&#50696;&lt;/item&gt;
      &lt;item&gt;&#50500;&#45768;&#50724;&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt;
</pre>
<h4 id="AppJ.3-xml-esc">XML Form Grammar with Character Escaping of
Unicode Characters</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" 
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar xml:lang="ko" version="1.0" mode="voice"
         xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         root="main"&gt;

  &lt;!-- yes/no grammar --&gt;
  &lt;rule id="yes_no_ko" scope="public"&gt;
    &lt;example&gt;&amp;#50696;&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;&amp;#50696;&lt;/item&gt;
      &lt;item&gt;&amp;#50500;&amp;#45768;&amp;#50724;&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt;
</pre></blockquote>
<h3 id="id-AppJ.4"><a id="AppJ.4" name="AppJ.4" shape="rect">J.4:
Chinese Examples</a></h3>
<p>The following two grammars are XML Form grammars with Chinese
number content. The first represents the Chinese symbols as Unicode
characters with the UTF-8 encoding. The second represents the same
Unicode characters using character escaping.</p>
<blockquote>
<h4 id="AppJ.4-abnf">ABNF Form Grammar with Unicode Characters in
UTF-8 Encoding</h4>
<pre class="xml" xml:space="preserve">
#ABNF 1.0 UTF-8;

language zh;
mode voice;
root $main;

public $main = $digits1_9;

/*
 * @example &#22235;
 */

private $digits1_9 = &#19968; | &#20108; | &#19977; | &#22235; | &#20116; | &#20845; | &#19971; | &#20843; | &#20061;;
</pre>
<h4 id="AppJ.4-xml">XML Form Grammar with Unicode Characters in
UTF-8 Encoding</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="UTF-8"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" 
          "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="zh" mode="voice" root="main"&gt;

  &lt;rule id="main" scope="public"&gt;
    &lt;ruleref uri="#digits1_9"/&gt;
  &lt;/rule&gt;

  &lt;rule id="digits1_9" scope="private"&gt;
    &lt;example&gt;&#22235;&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;&#19968;&lt;/item&gt;
      &lt;item&gt;&#20108;&lt;/item&gt;
      &lt;item&gt;&#19977;&lt;/item&gt;
      &lt;item&gt;&#22235;&lt;/item&gt;
      &lt;item&gt;&#20116;&lt;/item&gt;
      &lt;item&gt;&#20845;&lt;/item&gt;
      &lt;item&gt;&#19971;&lt;/item&gt;
      &lt;item&gt;&#20843;&lt;/item&gt;
      &lt;item&gt;&#20061;&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt; 
</pre>
<h4 id="AppJ.4-xml-esc">XML Form Grammar with Character Escaping of
Unicode Characters</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" 
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="zh" mode="voice" root="main"&gt;

  &lt;rule id="main" scope="public"&gt;
    &lt;ruleref uri="#digits1_9"/&gt;
  &lt;/rule&gt;

  &lt;rule id="digits1_9" scope="private"&gt;
    &lt;example&gt;&amp;#22235;&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;&amp;#19968;&lt;/item&gt;
      &lt;item&gt;&amp;#20108;&lt;/item&gt;
      &lt;item&gt;&amp;#19977;&lt;/item&gt;
      &lt;item&gt;&amp;#22235;&lt;/item&gt;
      &lt;item&gt;&amp;#20116;&lt;/item&gt;
      &lt;item&gt;&amp;#20845;&lt;/item&gt;
      &lt;item&gt;&amp;#19971;&lt;/item&gt;
      &lt;item&gt;&amp;#20843;&lt;/item&gt;
      &lt;item&gt;&amp;#20061;&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt; 
</pre></blockquote>
<h3 id="id-AppJ.5"><a id="AppJ.5" name="AppJ.5" shape="rect">J.5:
Swedish Examples</a></h3>
<p>This Swedish XML Form grammar provides a comprehensive set of
forms of "yes" and "no". All characters are contained within the
ISO-8859-1 (Latin-1) character set.</p>
<blockquote>
<h4 id="AppJ.5-abnf">XML Form Grammar with ISO-8859-1</h4>
<pre class="xml" xml:space="preserve">
&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;

&lt;!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" 
                  "http://www.w3.org/TR/speech-grammar/grammar.dtd"&gt;

&lt;grammar version="1.0" xmlns="http://www.w3.org/2001/06/grammar"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.w3.org/2001/06/grammar 
                             http://www.w3.org/TR/speech-grammar/grammar.xsd"
         xml:lang="sv" mode="voice" root="main"&gt;

  &lt;rule id="main" scope="public"&gt;
    &lt;example&gt;ja det &auml;r r&auml;tt&lt;/example&gt;
    &lt;example&gt;nej det &auml;r fel&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;
        &lt;ruleref uri="#yes_rule"/&gt;
      &lt;/item&gt;
      &lt;item&gt;
        &lt;ruleref uri="#no_rule"/&gt;
      &lt;/item&gt;
    &lt;/one-of&gt;    
  &lt;/rule&gt;

  &lt;rule id="yes_rule" scope="private"&gt;
    &lt;example&gt;ja det &auml;r r&auml;tt&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;exakt&lt;/item&gt;
      &lt;item&gt;javisst&lt;/item&gt;
      &lt;item&gt;
        ja
        &lt;item repeat="0-1"&gt;
          &lt;ruleref uri="#yes_emphasis"/&gt;
        &lt;/item&gt;
      &lt;/item&gt;
      &lt;item&gt;jepp&lt;/item&gt;
      &lt;item&gt;korrekt&lt;/item&gt;
      &lt;item&gt;okej&lt;/item&gt;
      &lt;item&gt;r&auml;tt&lt;/item&gt;
      &lt;item&gt;si&lt;/item&gt;
      &lt;item&gt;s&auml;kert&lt;/item&gt;
      &lt;item&gt;visst&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;

  &lt;rule id="yes_emphasis" scope="private"&gt;
    &lt;example&gt;det st&auml;mmer&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;det gjorde jag&lt;/item&gt;
      &lt;item&gt;
        &lt;item repeat="0-1"&gt;det&lt;/item&gt;
        st&auml;mmer
      &lt;/item&gt;
      &lt;item&gt;det &auml;r r&auml;tt&lt;/item&gt;
      &lt;item&gt;det &auml;r korrekt&lt;/item&gt;
      &lt;item&gt;det &auml;r riktigt&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;

  &lt;rule id="no_rule" scope="private"&gt;
    &lt;example&gt;nej det &auml;r fel&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;icke&lt;/item&gt;
      &lt;item&gt;fel&lt;/item&gt;
      &lt;item&gt;
        nej
        &lt;item repeat="0-1"&gt;
          &lt;ruleref uri="#no_emphasis"/&gt;
        &lt;/item&gt;
      &lt;/item&gt;
      &lt;item&gt;nix&lt;/item&gt;
      &lt;item&gt;no&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;

  &lt;rule id="no_emphasis" scope="private"&gt;
    &lt;example&gt;det &auml;r fel&lt;/example&gt;
    &lt;one-of&gt;
      &lt;item&gt;det gjorde jag inte&lt;/item&gt;
      &lt;item&gt;
        &lt;item repeat="0-1"&gt;det&lt;/item&gt;
        st&auml;mmer inte
      &lt;/item&gt;
      &lt;item&gt;det &auml;r fel&lt;/item&gt;
      &lt;item&gt;absolut inte&lt;/item&gt;
      &lt;item&gt;inte alls&lt;/item&gt;
    &lt;/one-of&gt;
  &lt;/rule&gt;
&lt;/grammar&gt;
</pre></blockquote>
</div>
</div>
</body>
</html>