Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created November 11, 2012 19:07
Show Gist options
  • Select an option

  • Save mheadd/4055904 to your computer and use it in GitHub Desktop.

Select an option

Save mheadd/4055904 to your computer and use it in GitHub Desktop.
<?php
$grammar = "https://raw.github.com/gist/4055904/a349bed1263e97d30ccb6106598c2cabc5d3916b/th-test.xml";
$station_name = ask("", array("choices" => $grammar, "attempts" => 1));
if($station_name->value == 'NO_MATCH') {
say("I did not understand what you sent.");
}
else {
say("You entered " . $station_name->value);
}
?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<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"
version="1.0" xml:lang="en-US" mode="voice" root="main">
<rule id="main">
<one-of>
<item>
<item> 30th </item>
<item repeat="0-">street</item>
<item repeat="0-">station</item>
<tag>30th Street Station</tag>
</item>
<item>
<item>forty ninth</item>
<item repeat="0-">street</item>
<item repeat="0-">station</item>
<tag>49th Street</tag>
</item>
</one-of>
</rule>
</grammar>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment