External Grammars and the use of ruleref - Error Creating
Posted: Fri Apr 04, 2008 8:23 am
Good Morning,
For organizational purposes, I am trying to write a grammar that will understand the phonetic alphabet, Ie: "A as in Apple"
I'm going to chop down my grammar to make it easier to read, but I can't get a ruleref to an external grammar file to work.
If I write my grammar like this, it works fine:
However, if I break out the wordlist for a into it's own xml file, and use a ruleref tag to reference it, I'm getting Error Creating Grammar.
Here is how I'd like it to work, but can not find the write syntax (if it's even possible)
Grammar:
And a.xml looks like this:
Can you help me figure out what I've got wrong here? Also - is there a tool I can use for validatiing this? Or a way to get a more detailed error in the call log then just "Error Creating Grammar"?
Thanks
Steve
For organizational purposes, I am trying to write a grammar that will understand the phonetic alphabet, Ie: "A as in Apple"
I'm going to chop down my grammar to make it easier to read, but I can't get a ruleref to an external grammar file to work.
If I write my grammar like this, it works fine:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="alphanum" xml:lang="en_us">
<rule id="alphanum" scope="public">
<!-- User should be able to say either Letter, or "as in" phonetic form.
Example: Caller Speaks "A" or Caller Speaks "A as in Alpha".
This should be allowed to occur multiple times to facilitate
spelling of arbitrary words.-->
<item repeat="1-"><!--Accept 1 or more letters,numbers or phonetic phrases.-->
<one-of><!--We want to match one spoken letter, number, or phonetic at a time-->
<item><ruleref uri="#alpha" /></item>
</one-of>
</item>
</rule>
<rule id="alpha" scope="private">
<!-- This is the ruleset that matches a phonetic phrase or single letter.
it is a reference to each letters individual ruleset.-->
<one-of>
<!--If one of these match it's tag is placed in the letter tag of this rule-->
<item><ruleref uri="#a"/></item>
</one-of>
</rule>
<rule id="a" scope="private">
<!--The user can say "A" or "A as in Apple"-->
<item>
A
<item repeat="0-1">
as in
<one-of>
<item>Alpha</item>
<item>Alberta</item>
</one-of>
</item>
</item>
<!--If one of the above matches, it is returned as "a"-->
<tag>SWI_literal="A"</tag>
</rule>
</grammar>
Here is how I'd like it to work, but can not find the write syntax (if it's even possible)
Grammar:
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="alphanum" xml:lang="en_us">
<rule id="alphanum" scope="public">
<!-- User should be able to say either Letter, or "as in" phonetic form.
Example: Caller Speaks "A" or Caller Speaks "A as in Alpha".
This should be allowed to occur multiple times to facilitate
spelling of arbitrary words.-->
<item repeat="1-"><!--Accept 1 or more letters,numbers or phonetic phrases.-->
<one-of><!--We want to match one spoken letter, number, or phonetic at a time-->
<item><ruleref uri="#alpha" /></item>
</one-of>
</item>
</rule>
<rule id="alpha" scope="private">
<!-- This is the ruleset that matches a phonetic phrase or single letter.
it is a reference to each letters individual ruleset.-->
<one-of>
<!--If one of these match it's tag is placed in the letter tag of this rule-->
<item><ruleref uri="#a"/></item>
</one-of>
</rule>
<rule id="a" scope="private">
<!--The user can say "A" or "A as in Apple"-->
<item>
A
<item repeat="0-1">
as in
<one-of>
<ruleref uri="a.xml#awords"/>
</one-of>
</item>
</item>
<!--If one of the above matches, it is returned as "a"-->
<tag>SWI_literal="A"</tag>
</rule>
</grammar>
Code: Select all
<?xml version="1.0" ?>
<grammar mode="voice" root="awords" xml:lang="en_us">
<rule id="awords" scope="private">
<item>Alpha</item>
<item>Alberta</item>
</rule>
</grammar>
Can you help me figure out what I've got wrong here? Also - is there a tool I can use for validatiing this? Or a way to get a more detailed error in the call log then just "Error Creating Grammar"?
Thanks
Steve