Page 1 of 1
Digits being prompted
Posted: Wed Sep 25, 2013 4:59 pm
by vishaltalentbeat
Hi
In my application digits are getting played in different way randomely. Like for prompt of for 5406 some times it says "Fifty Four Hundred six" and some time it says "Five Four O six".
Could you please how we we prompt this always as "Five Four O six". Below is the sample code we are using:
out.println("<audio src= '"+YOUR_NAME+"'>");
out.println("Your name is <break time=\"100\"/>");
out.println("</audio>");
out.println("<prompt>");
out.println(mrcName);
out.println("</prompt>");
here value fro mercName is 5406.
Re: Digits being prompted
Posted: Wed Sep 25, 2013 5:27 pm
by support
Hi,
You could go about this in a number of ways.
1. If you are using the realspeak engine, it supports the digits tag type for the <say-as> tag.
An example of this is:
Code: Select all
<say-as type="digits"><value expr="YourVariableHere"/></say-as>
This will spell out your number as if saying individual digits, but again, only if you're using the realspeak engine.
2. There is another potential workaround by using some simple vxml code.
Code: Select all
<value expr="YourVariableHere.toString().replace(/(.)/g, '$1, ')"/>
What this code does is place a comma between each number, separating the whole number and making the engine say each digit individually. Hopefully, this solution helps if you are not using the realspeak engine.
3. If the above solution doesn't work for you, since you're using vxml within a higher level language, what you can do is the same concept above, but in your programming language. Then once you formatted the string you can just have the vxml read it.
Hope that helps!
Regards,
Plum Support
Re: Digits being prompted
Posted: Wed Sep 25, 2013 5:42 pm
by vishaltalentbeat
Thanks for your prompt reply.
Acutually the name is combination of character and digits like "SUPER 4567" etc.
Could you please suggest on this.
Re: Digits being prompted
Posted: Wed Sep 25, 2013 5:55 pm
by support
Hi,
I take it you're looking to still have it spell out the variable, like "S-U-P-E-R 4-5-6-7".
If you aren't using the the At&T or Cepstral engine, you can using the <say-as> tag with the acromym tag type:
Code: Select all
<say-as type="acronym">SUPER 4506</say-as>
And this will output each individual item.
OR
If you are using the realspeak engine, this 'acronym' type is not supported, but you could still use the previously mention solution of:
Code: Select all
<value expr="YourVariableHere.toString().replace(/(.)/g, '$1, ')"/>
and it should say each individual item.
Hope that helps!
Regards,
Plum Support
Re: Digits being prompted
Posted: Thu Sep 26, 2013 7:18 am
by vishaltalentbeat
Hi,
Our actual requirement is to prompt like "SUPER" 4-5-6-7.
Means only digits should be play as single,
Re: Digits being prompted
Posted: Thu Sep 26, 2013 10:48 am
by support
Hi,
Since you're looking to play only part of the variable as an acronym, then you could simply separate the variable into the word and the numbers. Then you could simply play only the numbers in this format. Here's an example of how to do that in PHP.
Code: Select all
<prompt>
<?php
$testVar = "SUPER 4506";
//split up the variable.
$pieces = explode(' ',$testVar);
//say 'SUPER'
echo $pieces[0];
//say number as acronym '4-5-0-6'
echo '<say-as type="acronym">';
echo $pieces[1];
echo '</say-as>';
?>
</prompt>
You could carry out this same process in your language of choice to get the same results.
Again, depending on your TTS engine, you can use <say-as type="acronym"> for At&T or Cepstral, and <say-as type="digits"> for Realspeak.
Regards,
Plum Support