How to recognize a phone number using xml grammar?

Asked

Viewed 44 times

1

I’m using nuance to recognize voice in calls,

I need to pick up the person’s phone to validate the registration, how to do?

For example, if the person says 95 (ninety-five) - I’m getting 90 - 5 and not 95.

Follows grammar of test:

NOTE: I put as if it were javascript but it is an xml file.

<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="pt-BR" version="1.0" mode="voice" root="teste">
  <rule id="teste">   
  <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO1=digit.DIGITO;
        SWI_meaning=DIGITO1;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO2=digit.DIGITO;
        SWI_meaning=DIGITO2;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO3=digit.DIGITO;
        SWI_meaning=DIGITO3;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO4=digit.DIGITO;
        SWI_meaning=DIGITO4;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO5=digit.DIGITO;
        SWI_meaning=DIGITO5;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO6=digit.DIGITO;
        SWI_meaning=DIGITO6;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO7=digit.DIGITO;
        SWI_meaning=DIGITO7;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO8=digit.DIGITO;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO9=digit.DIGITO;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO10=digit.DIGITO;
      </tag>
  </item>
   <item repeat="0-">
      <ruleref uri="#digit"/>
      <tag>
        DIGITO11=digit.DIGITO;
      </tag>
  </item>
 
  
      
  </rule>

  <rule id="digit">
    <one-of>
      <item>
        zero <tag>DIGITO = "0";</tag>
      </item>
      <item>
        um <tag>DIGITO = "1";</tag>
      </item>
      <item>
        dois <tag>DIGITO = "2";</tag>
      </item>
      <item>
        tres <tag>DIGITO = "3";</tag>
      </item>
      <item>
        quatro <tag>DIGITO = "4";</tag>
      </item>
      <item>
        cinco <tag>DIGITO = "5";</tag>
      </item>
      <item>
        seis <tag>DIGITO = "6";</tag>
      </item>
        <item>
        meia <tag>DIGITO = "6";</tag>
      </item>
      <item>
        sete <tag>DIGITO = "7";</tag>
      </item>
      <item>
        oito <tag>DIGITO = "8";</tag>
      </item>
      <item>
        nove <tag>DIGITO = "9";</tag>
      </item>
       <item>
        dez <tag>DIGITO = "10";</tag>
      </item>
       <item>
        onze <tag>DIGITO = "11";</tag>
      </item>
        <item>
        doze <tag>DIGITO = "12";</tag>
      </item>
        <item>
        treze <tag>DIGITO = "13";</tag>
      </item>  
      <item>
        quatorze <tag>DIGITO = "14";</tag>
      </item> 
      <item>
        quinze <tag>DIGITO = "15";</tag>
      </item>
      <item>
        dezesseis <tag>DIGITO = "16";</tag>
      </item>
      <item>
        dezessete <tag>DIGITO = "17";</tag>
      </item>
      <item>
        dezoito <tag>DIGITO = "18";</tag>
      </item>
      <item>
        dezenove <tag>DIGITO = "19";</tag>
      </item>
      <item>
        vinte <tag>DIGITO = "20";</tag>
      </item>
        <item>
        trinta <tag>DIGITO = "30";</tag>
      </item>
        <item>
        quarenta <tag>DIGITO = "40";</tag>
      </item>
        <item>
        cinquenta <tag>DIGITO = "50";</tag>
      </item>
        <item>
        sessenta <tag>DIGITO = "60";</tag>
      </item>
        <item>
        setenta <tag>DIGITO = "70";</tag>
      </item>
        <item>
        oitenta <tag>DIGITO = "80";</tag>
      </item>
        <item>
        noventa <tag>DIGITO = "90";</tag>
      </item>
    </one-of>
    <ruleref special="GARBAGE"/>    
  </rule>

</grammar>

I got to see documentation on the site: https://www.w3.org/TR/speech-grammar/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.