Author Message
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hello Gurus!

I am looking for a solution for some specific case.
Speech application produces a lot of audio with currency elements.

Everything is fine but many sums of money have some amount of dollars and 0 cents (zero cents).

Is it possible to skip pronouncing of "zero cents" part only when sum of money contains zero cents? I.e. 5.45$ should be pronounced both dollars and cents but in case 5.0$ it should say only dollars.

As I see in audio variable there are three options "whole dollars", "dollars and cents", "Dollars as decimal number". Those options are not applicable for me.

Another case is to customize directly in java. I can do such customization but see no options for my case. I got stucked at a point:
1. Use com.avaya.sce.runtime.Prompt class for my prompt.
2. Add currency format com.avaya.sce.runtime.Format with inflection N$R2.
3. Use ByteArrayOutputStream and com.avaya.sce.runtime.OutputGenerator and perform prompt.generate(generator).
4. Later (from byte stream) I can get string output like below.
<audio src=".../data/russian/phrases/0051.wav">:50</audio>
<audio src=".../data/russian/phrases/0152.wav">:rubles(5+)</audio>
<audio src=".../data/russian/phrases/0028.wav">:0</audio>
<audio src=".../data/russian/phrases/0270.wav">:kopecks(5+).</audio>

So, my idea is to tell somehow to avaya generator to skip generation of last two lines
<audio src=".../data/russian/phrases/0028.wav">:0</audio>
<audio src=".../data/russian/phrases/0270.wav">:kopecks(5+).</audio>

Is it possible at all?
May be I am on a totally wrong way?

Could you please help me with the situation above?

Thanks in advance for your help!
Vasily.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
I am not familiar with the bundle. You probably have to customize the logic in the FormatLocale class. Have you tried chopping off the decimal from the amount before the Announce node?
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Hi Wilson!
Thanks for a piece of advice.

I have tried to cut off the cents part but still have in the pronounce "zero cents" and I see in the vxml output the lines which correspond to "zero cenets" part.

Which class do you have in view with the FormatLocale proposal? Pure Java or some Avaya runtime customization?

The main problem with the "cents" part is that I need conditional pronounce option, i.e. if I have zero cents then I do not want the following vxml part to be generated at all (the following lines are the same but in russian and corresponds to the zero cents)
<audio src=".../data/russian/phrases/0028.wav">:0</audio>
<audio src=".../data/russian/phrases/0270.wav">:kopecks(5+).</audio>

So, in my case I need conditional formatting.

And could you please point me the article or a manual name where I can find the description for formats, for example for currency vxml format "N$R2"?
Thanks in advance!
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Could you add some logic in the prompt? For example, if the amount has 0 cent, set use a Audio Variable and set the format to "Whole", else add another Audio Variable and set the other format?
We have a guide document that help developer develop a complete new language bundle. I think that's too much for your case. The modification I was alluding to was in the FormatLocale.java in the WEB-INF/lib/ru-ru.jar directory. The toCurrency method is what dictates the number parsing to determine the wav files. You can take a look at that too.
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Wilson, I think that your proposal is quite good. Most probably I will follow that way.

But could you please share the guide document you are talking about? Or just give me the title and I will try to find it by myself.

And thanks for sharing info about FormatLocale.java. Now it is clear for me.
WilsonYu
Joined: Nov 6, 2013
Messages: 3950
Offline
Search the Devconnect site for this document "Dialog Designer Localization Package Developers Guide".
VasilyL
Joined: Jul 11, 2016
Messages: 230
Offline
Wilson, thanks a lot for your help!
I have no more questions.
The topic can be closed.

By the way don't you think that it could be a good point for improvement?
Go to:   
Mobile view