Skip to content

Instantly share code, notes, and snippets.

@tessro
Created February 24, 2009 02:25
Show Gist options
  • Save tessro/69343 to your computer and use it in GitHub Desktop.
Save tessro/69343 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN" "http://www.w3.org/TR/speech-grammar/grammar.dtd">
<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="command"
tag-format="semantics-ms/1.0">
<rule id="firstName">
<one-of>
<item>paul</item>
<item>ryan</item>
<item>james</item>
<item>dan</item>
<item>sarah</item>
<item>kim</item>
<item>nicole</item>
</one-of>
</rule>
<rule id="lastName">
<one-of>
<item>rosania</item>
<item>wheeler</item>
<item>lambert</item>
</one-of>
</rule>
<rule id="zipCode">
<item repeat="5">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>0</item>
</one-of>
</item>
</rule>
<rule id="phoneNumber">
<item repeat="10">
<one-of>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>0</item>
</one-of>
</item>
</rule>
<rule id="sportsTeam">
<one-of>
<item>the celtics</item>
<item>the patriots</item>
<item>the bruins</item>
<item>the red sox</item>
</one-of>
</rule>
<rule id="command">
<tag>
$.agent = {};
</tag>
<one-of>
<item>
<tag>$.agent = "system";</tag>
<ruleref uri="#systemCommand"/>
</item>
<item>
<tag>$.agent = "time";</tag>
<ruleref uri="#timeQuestion"/>
</item>
<item>
<tag>$.agent = "sports";</tag>
<ruleref uri="#sportsQuestion"/>
</item>
<item>
<tag>$.agent = "phone";</tag>
<ruleref uri="#phoneCommand"/>
</item>
<item>
<tag>$.agent = "weather";</tag>
<ruleref uri="#weatherQuestion"/>
</item>
</one-of>
<tag>
$.details = $$;
</tag>
</rule>
<rule id="timeQuestion">
<one-of>
<item>
what time is it
</item>
</one-of>
</rule>
<rule id="systemCommand">
<tag>$.command = {};</tag>
<one-of>
<item></item>
<item>can you</item>
</one-of>
<one-of>
<item>tell ryan what to do</item>
<item>
reload grammar
<tag>$.command._value = "reload-grammar";</tag>
</item>
</one-of>
<one-of>
<item></item>
<item>for me</item>
</one-of>
<one-of>
<item></item>
<item>please</item>
</one-of>
</rule>
<rule id="phoneCommand">
call
<one-of>
<item>kim</item>
<item>jeff</item>
<item>upper crust</item>
<item>
<ruleref uri="#phoneNumber"/>
</item>
</one-of>
</rule>
<rule id="sportsQuestion">
<one-of>
<item>how did</item>
</one-of>
<one-of>
<item>
<ruleref uri="#sportsTeam"/>
</item>
</one-of>
do
<one-of>
<item>yesterday</item>
<item>today</item>
<item>last night</item>
</one-of>
</rule>
<rule id="weatherQuestion">
<tag>$.city = {}</tag>
<one-of>
<item>what's</item>
<item>what is</item>
<item>how's</item>
<item>how is</item>
</one-of>
the
<one-of>
<item>temp</item>
<item>temperature</item>
<item>weather</item>
<item>forecast</item>
</one-of>
<one-of>
<item></item>
<item>like</item>
</one-of>
<one-of>
<item>
<one-of>
<item>in</item>
<item>at</item>
<item>for</item>
</one-of>
<one-of>
<item>
san francisco<tag>$.city._value = "SFO";</tag>
</item>
<item>boston</item>
<item>new york</item>
<item>dallas</item>
<item>
<ruleref uri="#zipCode"/>
</item>
</one-of>
</item>
<item>outside</item>
<item>today</item>
<item>tomorrow</item>
<item></item>
</one-of>
</rule>
</grammar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment