Re: Using SI with one-of in SRGS?

Hi Dave,

You are right to conclude that references only work with <rule>s.

You could modify your grammar to work by doing something like:

<rule id="tens">
  <tag>var $tens=0; var $units=0;</tag>
  <one-of>
    <item><token>twenty</token><tag>$tens = 20;</tag></item>
    <item><token>thirty</token><tag>$tens = 30;</tag></item>
     ...
  </one-of>
  <item repeat="0-1"><ruleref uri="#units"/></item>
  <tag>out = $tens + $units</tag>
</rule>

-- Dave

----- Original Message ----- 
From: "Dave Raggett" <dsr@w3.org>
To: <www-voice@w3.org>
Sent: Tuesday, April 12, 2005 11:02 AM
Subject: Using SI with one-of in SRGS?


> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> I have a question on using Semantic Interpretation for
> Speech Recognition with SRGS one-of elements:
> 
> I am working on a speech recognition extension for the Firefox
> browser, and to test my understanding have put together a grammar
> for numbers, e.g.
> 
>  <rule id="units">
>  <one-of>
>  <item>one</item>
>  <item>two</item>
>  <item>three</item>
>  <item>four</item>
>  <item>five</item>
>  <item>six</item>
>  <item>seven</item>
>  <item>eight</item>
>  <item>nine</item>
>   </one-of>
>  </rule>
> 
>  <rule id="tens">
>  <one-of>
>  <item>twenty</item>
>  <item>thirty</item>
>  <item>forty</item>
>  <item>fifty</item>
>  <item>sixty</item>
>  <item>seventy</item>
>  <item>eighty</item>
>  <item>ninety</item>
>  </one-of>
>  <item repeat="0-1"><ruleref uri="#units"/></item>
>  </rule>
> 
> for utterances like "twenty one", and similarly for more
> complex numbers.
> 
> I now want to use SI tags to compute the numerical value as
> the interpretation. I started by adding tag elements for
> the numeric literals, e.g.
> 
>  <rule id="tens">
>  <tag>var $units=0;</tag>
>  <one-of>
>  <item><token>twenty</token><tag>20</tag></item>
>  <item><token>thirty</token><tag>30</tag></item>
>  <item><token>forty</token><tag>40</tag></item>
>  <item><token>fifty</token><tag>50</tag></item>
>  <item><token>sixty</token><tag>60</tag></item>
>  <item><token>seventy</token><tag>70</tag></item>
>  <item><token>eighty</token><tag>80</tag></item>
>  <item><token>ninety</token><tag>90</tag></item>
>  </one-of>
>  <item repeat="0-1"><ruleref uri="#units"/></item>
>  <!-- the following won't work as needed -->
>  <tag>out = $tens + $units</tag>
>  </rule>
> 
> where the declaration of $units in the first tag element is based
> upon an example in the SISR specification from section 3.3.2.
> 
> Unfortunately, I don't know how to reference the value obtained
> from  the one-of element within the "tens" rule and $tens clearly
> won't work as written in the above example.
> 
> So how do you name the value from an item or from a one-of
> within a rule without breaking it out into a separate rule?
> 
> Many thanks,
> - --
>  Dave Raggett <dsr@w3.org>  W3C lead for multimodal interaction
>  http://www.w3.org/People/Raggett +44 1225 866240 (or 867351)
> 
> - --[PinePGP]-----------------------------------------------------------
>> Signature made Tue 12 Apr 2005 10:59:46 AM BST using DSA key ID 6C40B14B
>> Good signature from "Dave Raggett <dsr@w3.org>"
> - --[PinePGP]----------------------------------------------------[end]--
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> 
> iD8DBQFCW5zJb3AdEmxAsUsRAnZHAKCKNZnLFmlSwxUkcR60UI10F1BUrwCeL6/f
> z+zmNF9HQXIe2Cx+iZXixNU=
> =me2O
> -----END PGP SIGNATURE-----
>

Received on Tuesday, 12 April 2005 10:23:00 UTC