Simple GRXML Grammar
This example shows a minimal GRXML grammar — the XML form of the Speech Recognition Grammar Specification (SRGS). It defines a single root rule that accepts one of two spoken words, “black” or “white”, and uses a semantic interpretation tag to return a short result string for each. It is a useful starting point for understanding GRXML structure: the <grammar> element declares the namespace, language, mode, root rule, and tag-format, while the <one-of> element lists the alternative phrases the rule can match.
Example
| <?xml version="1.0" encoding="UTF-8" ?> <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" root="rootrule" mode="voice" tag-format="semantics/1.0.2006"> <rule id="rootrule"> <one-of> <item>black<tag>out="You said black";</tag></item> <item>white<tag>out="You said white";</tag></item> </one-of> </rule> </grammar> |
