- From: Lutz Birkhahn <lbirkhahn@adomo.com>
- Date: Fri, 25 Oct 2002 19:11:25 -0700
- To: "Yahn Teisseire" <yahn@ukibi.com>, <www-voice@w3.org>
Yahn Teisseire wrote:
> I'd like a grammar able to return 3 spelled letters to my application
> like:
>
> <grammar root="command">
> <rule id="command" scope="public">
> <item>
> <ruleref uri="#firstletter"/>
> <ruleref uri="#secondletter"/>
> <ruleref uri="#thirdletter"/>
> </item>
> </rule>
>
> <rule id="firstletter">
> <item><ruleref
> uri="#alphabet"/><tag>firstletter=$alphabet</tag></item> </rule>
>
> <rule id="secondletter">
> <item><ruleref
> uri="#alphabet"/><tag>secondletter=$alphabet</tag></item> </rule>
>
> <rule id="thirdletter">
> <item><ruleref
> uri="#alphabet"/><tag>thirdletter=$alphabet</tag></item> </rule>
Looks almost good to me. You most likely want to look at
http://www.w3.org/TR/semantic-interpretation/ (SISR). If we're talking
about a real VXML interpreter, then of course your interpreter's docu-
mentation is more important.
I think you have to copy the subrule's tags to the root rule, i.e.
the root rule would look like
<rule id="command" scope="public">
<item>
<ruleref uri="#firstletter"/>
<ruleref uri="#secondletter"/>
<ruleref uri="#thirdletter"/>
<tag>
firstletter = $firstletter.firstletter;
secondletter = $secondletter.secondletter;
thirdletter = $thirdletter.thirdletter;
</tag>
</item>
</rule>
I would probably simplify it to:
<rule id="command" scope="public">
<item>
<ruleref uri="#firstletter"/>
<ruleref uri="#secondletter"/>
<ruleref uri="#thirdletter"/>
<tag>
$ = $firstletter + $secondletter + $thirdletter;
</tag>
</item>
</rule>
<rule id="firstletter">
<item><ruleref uri="#alphabet"/><tag>$alphabet</tag></item>
</rule>
<rule id="secondletter">
<item><ruleref uri="#alphabet"/><tag>$alphabet</tag></item>
</rule>
<rule id="thirdletter">
<item><ruleref uri="#alphabet"/><tag>$alphabet</tag></item>
</rule>
Or even simpler (not sure if this still works):
<rule id="command" scope="public">
<tag> $ = "" </tag>
<item repeat="3">
<ruleref uri="#alphabet"/>
<tag> $ = $ + $alphabet </tag>
</item>
</rule>
Or return it as list (this is equivalent to the "tops" rule in the sec-
tion 8 example of SISR):
<rule id="command" scope="public">
<ruleref uri="#alphabet"/>
<tag> Append([], $alphabet) </tag>
<item repeat="2">
<ruleref uri="#alphabet"/>
<tag> Append($, $alphabet) </tag>
</item>
</rule>
Have fun,
/lutz
--
Lutz Birkhahn System Software Engineer
Adomo Inc. -- 10001 N. De Anza Boulevard Suite 220 -- Cupertino, CA 95014
phone: +1 (408) 996-7086 ext. 118 private: +1 (408) 564-0162
Received on Friday, 25 October 2002 22:11:27 UTC