| VoiceXML 2.1 Development Guide | Home | Frameset Home |
| format | Data Type: CDATA | Default: Optional |
The format attribute is used in conjunction with the interpret-as attribute to define how a particular TTS string is rendered. Note that not all interpret-as values need the additional format attribute. The allowable types for this element are:
Note that these formats are effectively 'married' to specific interpret-as types. see the below code samples for details on how to implement them in your code. | ||
| interpret-as | Data Type: CDATA | Default: Required |
| The interpret-as attribute is a w3c SSML standard attribute type which is used to denote the content type of the contained TTS string construct, and to appropriately change how the TTS value is rendered to the caller. In addition, the format attribute can give further formatting information for content types that may have more than one possible format. The allowable interpret-as values are:
* interpret-as="digits" is only valid on the Rhetorical TTS platform Note that most interpret-as values have available format attributes which are used to further tune the TTS output. See the code samples below for details on implementing these in your own VXML documents. | ||
| <?xml version="1.0" encoding="UTF-8"?> <vxml version = "2.1"> <meta name="author" content="Matthew Henry"/> <meta name="copyright" content="2005 voxeo corporation"/> <meta name="maintainer" content="YOUR_EMAIL@HERE.COM"/> <form id="F1"> <block> <prompt>testing number <break strength="medium"/> <say-as interpret-as="number">123</say-as> </prompt> <prompt>testing interp as type date M D Y <break strength="medium"/> <say-as interpret-as="date" format="mdy">05/18/2002</say-as> </prompt> <prompt>testing interp as type date D M Y <break strength="medium"/> <say-as interpret-as="date" format="dmy">18/05/1970</say-as> </prompt> <prompt>testing interp as type date Y M D <break strength="medium"/> <say-as interpret-as="date" format="ymd">1970/5/18</say-as> </prompt> <prompt>testing interp as type date Y M <break strength="medium"/> <say-as interpret-as="date" format="ym">1970/5</say-as> </prompt> <prompt>testing interp as type date M Y <break strength="medium"/> <say-as interpret-as="date" format="my">5/1970</say-as> </prompt> <prompt>testing interp as type date M D <break strength="medium"/> <say-as interpret-as="date" format="md">05/18</say-as> </prompt> <prompt>testing interp as type date Y <break strength="medium"/> <say-as interpret-as="date" format="y">1970</say-as> </prompt> <prompt>testing interp as type date M <break strength="medium"/> <say-as interpret-as="date" format="m">05</say-as> </prompt> <prompt>testing interp as type date D <break strength="medium"/> <say-as interpret-as="date" format="d">18</say-as> </prompt> <prompt>testing interp as type ordinal <break strength="medium"/> <say-as interpret-as="number" format="ordinal">3</say-as> </prompt> <prompt>testing interp as type digits <break strength="medium"/> <say-as interpret-as="number" format="digits">123</say-as> </prompt> <prompt>testing interp as type currency <break strength="medium"/> <say-as interpret-as="currency">$12.76</say-as> </prompt> <prompt>testing interp as type duration H M S <break strength="medium"/> <say-as interpret-as="duration" format="hms">8:43:22</say-as> </prompt> <prompt>testing interp as type duration H M <break strength="medium"/> <say-as interpret-as="duration" format="hm">10:22</say-as> </prompt> <prompt>testing interp as type duration H <break strength="medium"/> <say-as interpret-as="duration" format="h">24</say-as> </prompt> <prompt>testing interp as type duration M <break strength="medium"/> <say-as interpret-as="duration" format="m">17</say-as> </prompt> <prompt>testing interp as type duration S <break strength="medium"/> <say-as interpret-as="duration" format="s">8</say-as> </prompt> <prompt>testing interp as type measure <break strength="medium"/> <say-as interpret-as="measure">100 km</say-as>. </prompt> <prompt>testing interp as type name <break strength="medium"/> <say-as interpret-as="name">john jacob smith</say-as> </prompt> <prompt>testing interp as type net U R I <break strength="medium"/> <say-as interpret-as="net" format="uri">http://www.piggy.com</say-as> </prompt> <prompt>testing interp as type net email <break strength="medium"/> <say-as interpret-as="net" format="email">piggy@mydomain.com</say-as> </prompt> <prompt>testing interp as type address <break strength="medium"/> <say-as interpret-as="address">123 main street anytown, CA</say-as> </prompt> <prompt>testing interp as type time HMS <break strength="medium"/> <say-as interpret-as="time" format="hms">10:57:02</say-as> </prompt> <!-- Note that Speechify 2.0 only allows 10 digit string values --> <!-- Speechify 2.0 and Rhetorical rVoice 4.2 do not suffer from this --> <prompt>testing interp as type telephone <break strength="medium"/> <say-as interpret-as="telephone">111-222-3333</say-as> </prompt> </block> </form> </vxml> |
| ANNOTATIONS: EXISTING POSTS |
MattHenry
|
|
|
Note: When using say-as type 'date' with any 'year' format specified, it is recommended that you stick to using 4 digit strings, otherwise the TTS may be slightly garbled: <prompt> interp as type date DMY <break size="medium"/> <say-as interpret-as="date" format="dmy">18/05/70</say-as> </prompt> ~Matt |
|
MattHenry
|
|
| Another caveat to using the Say-as element is that you will want to ensure none of the 'format' attribute values are capitalized, else the text will be ignored entirely. To illustrate:
WORKS: <say-as interpret-as="date" format="mdy">05/18/2002</say-as> WON'T WORK: <say-as interpret-as="date" format="MDY">05/18/2002</say-as> ~ Matt |
|
sildev3
|
|
| Another note:
If you use <say-as interpret-as="telephone">3125551212</say-as> you'll get "three billion one hundred twenty-five million five hundred fifty-one thousand two hundred twelve" If you use <say-as interpret-as="phone">3125551212</say-as> as per the VoiceXML 2.0 spec appendix P, you'll get "three one two five five five one two one two", but without any pauses between digit groups (area code, exchange, number). |
|
MattHenry
|
|
| Hiya Rick,
This might not be way obvious in the docs, as it is touched on in the <say-as> the sample code: <!-- Note that Speechify 2.0 only allows 10 digit string values --> <!-- Speechify 2.0 and Rhetorical rVoice 4.2 do not suffer from this --> <prompt>testing interp as type telephone <break strength="medium"/> <say-as interpret-as="telephone">111-222-3333</say-as> </prompt> Per the rVoice manual, (available upon request), the say-as type for this should indeed be set as type="telephone", but note that it does expect dashes in the string for it to be rendered properly: "1112223333" versus "111-222-3333" I understand that this may cause some problems with your existing string values, but the inclusion of some very simple JS would take care of this problem quite nicely. If this is something that you'll need a hand with, do let me know, and I'd be happy to cook something up for you. ~Matt |
|
Michael.Book
|
|
| Hi Rick, All,
Just wanted to add that if you want to get real fancy, you can control the rate at which the TTS engine reads the number back by using the <prosody> element, like so: <prompt> <prosody rate="slow"> <say-as interpret-as="telephone">111-222-3333</say-as> </prosody> </prompt> Have Fun, ~ Michael |
|
jagadishsuri
|
|
| hi
i need information about the say-as tag to speak about the time in the form of AM or PM, i.e if i specify the time in the tag as <prompt>testing interp as type duration H M S <break strength="medium"/> <say-as interpret-as="duration" format="hm">18:43</say-as> </prompt> then it should speak out the time as 6 hours and 43 minutes PM , like it should speak out the time in the form am or pm. hope iam clear with this. thanks. regards, jagadish.suri |
|
MattHenry
|
|
|
Hello Jagadish, If you require the am/pm designation to be rendered by the <say-as> tag, then you will want to use the type="time" rather thyan duration. The concept of duration is to measure a time value, and not to specify an AM/PM value at all. Of course, you can always use a client side script to append an " A M" or " P M" to the end of the string in question, if you want to manually overide this. ~Matt |
|
Veesup
|
|
| I'm using <say-as> tags on a time,
the vxml trace shows <say-as interpret-as="time" format="h">1800h</say-as> but prophecy still says "eighteen hundred h". I was hoping to at least get rid of the " h" at the end. Even better would be "six pm" or something along those lines (which was what I spoke - it is just reading back for confirmation). -- Thomas |
|
MattHenry
|
|
|
Hiya Andrew, This doesn't mean that we are dead in the water or anything. You can still use some simple ECMAScript on the return value from the time grammar to strip off the last character if you want to customize the format. Heck, you could even bypass the <say-as> tag altogether, and do a regexpr to replace 'h' with 'hours' or 'P M ' if you like. Hope this helps you out, ~Matthew Henry |
|
alexey.timofeev
|
|
| code example:
<say-as interpret-as="address"> De la Baya TX CA </say-as> it is interpreted as: "Delaware Luisiana Baya Texas California" how can I force Voxeo to speak 'De', not 'Delaware' ? |
|
jbassett
|
|
| Hi Andrew,
I whipped up a quick app and used the code below, and I did not encounter the same result. "De La Baya" is read correctly, and if I add a comma before TX, it is read correctly as well. If you would like to, feel free to open a support ticket about this on our support forums. You could attach the xml file you are using if you would like, and let us know whether you are using prophecy, or our free osted platform. <prompt>test <say-as interpret-as="address">De la Baya TX CA</say-as> </prompt> |
|
alexey.timofeev
|
|
| jbassett, I found the reason. First script:
<?xml version="1.0"?> <vxml version="2.1"> <property name="nuance.core.tts.ResourceName" value="en-US.F019"/> <form id="start"> <block>addres is:<prompt><say-as interpret-as="address">De la Baya TX CA</say-as></prompt></block> </form> </vxml> Second script: <?xml version="1.0"?> <vxml version="2.1"> <form id="start"> <block>addres is:<prompt><say-as interpret-as="address">De la Baya TX CA</say-as></prompt></block> </form> </vxml> First script pronounces: "Delaware Luisiana Baya Texas California", second script pronounces address correctly. The difference is <property name="nuance.core.tts.ResourceName" value="en-US.F019"/>. Could you please explain such behaviuor? |
|
MattHenry
|
|
|
Hi there, Bear in mind that the different TTS engines are going to interpret the SSML in a different fashion: No two TTS engines are identical in terms of how they will interpret abbreviations for SSML tags; each engine will simply do it's best to interpret the string in the format requested. This isn't a bug by any means, simply an example of how different TTS engines behave. ~Matt |
|
sdriscoll
|
|
| Hi There,
I am trying to capture a time using <field name="myTime" type="time"> and have it read back using <say-as interpret-as="time" format="hmm"> but it does not seem to work. Is there a format for the say as tag that knows what the <field> format is or should I create a custom grammer that returns the string in a format that can be parsed by the <say-as> tag? Simon |
|
VoxeoTony
|
|
| Hi,
You stated that you were unable to have your test application read back the type time. In your testing, what platform you use may determine the TTS engine, such as Matt was describing in an earlier post. With your example the Prophecy TTS engine will play the time format you asked about in your post. If you do not have the urge to try out Prophecy platform for your developing needs then you may look into the custom grammar string you mentioned. Regards, Tony |
|
sdriscoll
|
|
| Hey Tony,
I am using your platform! I tried a heap of other ones and this id by far the best to develop for. Especially since I need to get a decent proof of concept together in my own time to convince the company I work for to put some cash into this project. The time returned is in a format like "-901a" or "1810p" which seems to be read literally when using the say-as tag. If I replace this with "18:00 PM" it works fine. Any ideas? Thanks, Simon |
|
sidvoxeo
|
|
| Hi there,
We are glad that you are using our platform, now when you say that you are using "The Platform" , I presume you are using the Prophecy or are using VoiceCenter 5.5 . The reason I ask is because both of these use different TTS engines to synthesize text and say-as is a function of the TTS engine in question. Would be kind enough to send me the actual syntax that you are using in the context of the say-as tag. Sid |
|
aniruddha
|
|
| Hi,
I want to accept the input from the user and want to play that as currency. The specs say that the format to accept the input is UUUmm.nn where UUU is the currency code. So do I give the input as 84050.75 (840 is the currency code for USD) if I want to play it as 50 Dollars 75 cents? Thanks in advance. Aniruddha |
|
jbassett
|
|
| Hello,
Yes, that would be acceptable for input. As far as the <say-as> tag, you would only need to do something like the example. <prompt>testing interp as type currency <break strength="medium"/> <say-as interpret-as="currency">$12.76</say-as> </prompt> If you are looking for ways to use grammars to capture input, I would suggest looking at the nuane extension grammars for currency. http://docs.voxeo.com/voicexml/2.0/xnuancegrams.htm e.g. <rule id="MYRULE"> <one-of> <item> <ruleref uri="builtin:x-nuance-currency-10k"/> <tag><![CDATA[ <MyField $return> ]]> </tag> </item> </one-of> </rule> </grammar> Let me know if this helps. Thanks, Jesse Bassett Voxeo Support |
|
Erakles
|
|
| Hello
ABOUT TIME in the following script: <prompt> your appointment for the day <break time="100"/><prosody rate="slow"><say-as interpret-as="date" format="mdy"> 07/05/2007 </say-as><break time="1000"/> at <break time="500"/><say-as interpret-as="time" format="hm"> 08:30 </say-as><break time="1000"/></prosody> </prosody> </prompt> time(8:30) is read as "oh eight thirty am" if I change to 17:30, I get "seventeen thirty am" questions: - is there a way to get the voice to pronounce morning hours (01, 02 ... 09) without the "oh" (zero) ? - is there a way to get the voice to say "5:30pm" when it reads a '17:30' string? - the "AM" I hear now is not very clear, is more like an "m" at the end of the time-string. And, as I said, I hear it both for 08:30 and 17:30, with the latter very strangely sounding like "seventeen thirty am". That said, what's the general rule for using am/pm? can I get the "AM/PM" spelled out more clearly? Thanks in advance Erakles |
|
jbassett
|
|
| Hello,
There is actually more information on the <say-as> element on the official W3C standards documentation. The first link is to the root of the document, and the second goes straight to the section you will be interested in. http://www.w3.org/TR/ssml-sayas/ Time section: http://www.w3.org/TR/ssml-sayas/#S3.2 I think you will find this is exactly what you are looking for, as it has a good examples for 12 hour and 24 hours time formatting. Let me know if you have any further questions after looking this over. If you are running into problem, feel free to open a support ticket. Thanks, Jesse Bassett Voxeo Support |
|
Erakles
|
|
| Dear jbasset,
thanks for the prompt reply and the interesting link. Unfortunately it didn't solve my problems. I'll try to explain myself a bit better. Sorry in advance as I'm very new at this. An application for managing appointments automatically generates time strings in the format hh:mm (hh following the 24 hours clock) I would like tts to read those string and pronounce them in a natural english fashion. That is: 1- hours before 10 (01 to 09) should be pronounced without the starting zero (currently 09:00 is pronounced "0h-nine") 2- Not sure if this feature even exist but - at least in my dreams- an "am" or "pm" should be attached respectevely to hours from 0:00 to 11:00 and from 12 to 23:00 so that the string '9:00' is pronounced as "nine AM" and the string '21:00' as "nine PM". (currently an unclear "am" sound seems to be automatically attached to both 9:00 and 21:00 and, what's worse, 21:00 is pronounced as "twentyone am") Instead, reading the document from w3c, it seems that the AM/PM qualifier needs to be there in the string in order to get the TTS to read it. Besides, I have tried to use the formats hm12 hm24 hms12 hms24 in order to see what I could get and the voicexml 2.0 doesnt seem to recognize them: I got a long pause where the time was supposed to be. It would be great if you could advise me on the best way to address the above 2 issues: the initial zero and am/pm. Thanks in advance Erakles |
|
mikethompson
|
|
| Hi there,
After much testing, I've determined this to be a discrepancy between how Speechify handles the SSML vs. Rhetorical. It appears Speechify reads 09:57 as "zero 9:57", while Rhetorical correctly reads "9:57". Below is the say-as format I used: <say-as interpret-as="time" format="hm">09:57</say-as></prompt> Using Rhetorical should get you where you want to be with eliminating the leading zeros. As for the AM/PM integration, this is not automatically added to the say-as by the SSML. This being said, you will need to manually integrate the AM/PM characters to your time strings. So, if your time returns are dynamic, you can use some ECMA script to tack on AM or PM to the string. Hope this helps, Mike Thompson Voxeo Corporation |
|
chicks
|
|
| I'm trying to say highway numbers correctly, without luck so far.
E.g., I want hiway 101 to be spoken as one-oh-one, not one-hundred-one, and 415 as four-fifteen, not four-hundred-fifteen, and 980 as nine-eighty, not nine-hundred-eighty. Any hints? |
|
mikethompson
|
|
| Hi there,
While what you're after is not part of a say-as solution, you can utilize conditional logic within your <filled> to determine the highway spoken, and output as necessary. For example: <filled> <if cond="Field1=='408'"> <prompt> <audio src="408.wav">four oh eight</audio> </prompt> </if> </filled> Hope this helps, Mike Thompson Voxeo Corporation |
|
bose123
|
|
| Hi Friends,
IS this possible to play the address as "WEST" if the input is given as "W" in VXML 2.0? I have a input as "200 W Monroe Street". If i gave like this, the observed behaviour is as 200 W Monroe street, but my expected one is as 200 West Monroe street. Please help me ASAP. Thanks, Bose. |
|
VoxeoDustin
|
|
| Hey Bose,
This is in fact possible using the interpret-as="address" attribute of <say-as>, however this is a proprietary Nuance tag, and as such, will only work when using Nuance TTS. I have added access to this on your Evolution account and you can test it out by creating a new application using the multi-language platform listed in Application Manager. Thanks, Dustin |
|
jefo12
|
|
| What is the difference in voxeo and tell me servers..
i compiled in voxeo and executed but i can't able to sxecute in tellme studio... can u plz suggest me why it happens?. |
|
voxeo_chris
|
|
| Hi Jefo,
Unfortunately we do not have a great deal of insight into what exactly Tellme Studios supports but I would take a gander that they currently do not support the <say-as> element. However, Voxeo being the only 100% VXML 2.0 compliant company, does support this element. Hope this answers your question. Regards, Chris |
| login |