Browse
 
Tools
Rss Categories

"say-as" Element

Reference Number: AA-01562 Views: 25349 0 Rating/ Voters

<say-as>

 

Description

The say-as element provides users the ability to annotate fragments of text in order to force particular interpretation. Marking a fragment with <say-as> disables most default normalization rules, which would otherwise have been applied, therefore it is advised to mark text with <say-as> rarely, only when the default normalization rules fail and render different speech than was expected, or to explicitly force a certain pronunciation.

The "interpret-as" attribute is used to indicate the type of text construct contained within the element and to help specify the level of detail for rendering the contained text, or in other words, how the text within the <say-as> element is to be pronounced or interpreted.  Refer to the W3C Working Group note describing say-as attribute values for more details. 



Syntax

  
  

<say-as

interpret-as = “construct_type”

format = “string”

detail = “string” >

  text

</say-as>

 

Attributes

        
  

Attribute

  

Description

  

interpret-as

  

Type of the text.  mandatory field

  

format

  

Description of the type of the text.  optional field

(Please refer to Limitation / Restriction details for omission method.)

  

detail

  

Text detail information.  optional field

 

Parent 

<audio>, <emphasis>, <p>, <prosody>, <s>, <speak>, <voice>


Children 

#TEXT, #CDATA-SECTION


Limitations/Restrictions 

The maximum length of text, including null characters, is 512 bytes. Any string longer than that will be truncated. LumenVox supports <say-as> elements as below; all other values will be regarded as grammatical errors.

Note that any specified user lexicon will not be applied within say-as elements.


date

  

Syntax

  

<say-as interpret-as="date" format="Format">  Text  </say-as>

  

Format

  

mdy, dmy, ymd, md, dm, ym, my, d, m, y

  

Text

   

only digits, delimiters ( ' / ', ' . ', ' - ' )

If Format is specified, it checks the validity of each number as part of a date.

If Format is not specified:

English synthesizers assume the format is month, day, year 

Spanish synthesizers assume format is day, month, year


Examples


  

Ex. 1

   

<say-as interpret-as="dateformat="mdy"> 01/02/2007 </say-as>

  

Ex. 2

  

<say-as interpret-as="dateformat="dmy"> 01/02/2007 </say-as>

  

Ex. 3

   

<say-as interpret-as="dateformat="ymd"> 2007/01/02 </say-as>

  

Ex. 4

   

<say-as interpret-as="dateformat="md"> 01/02 </say-as>

  

Ex. 5

   

<say-as interpret-as="dateformat="dm"> 01/02 </say-as>

  

Ex. 6

   

<say-as interpret-as="dateformat="ym"> 2007/01 </say-as>

  

Ex. 7

   

<say-as interpret-as="dateformat="my"> 01/2007 </say-as>

  

Ex. 8

   

<say-as interpret-as="dateformat="d"> </say-as>

  

Ex. 9

   

<say-as interpret-as="dateformat="m"> </say-as>

  

Ex. 10

   

<say-as interpret-as="dateformat="y"> 2007 </say-as>

  

Ex. 11

   

<say-as interpret-as="date" > 01/02/2007 </say-as>


time

  

Syntax

  

<say-as interpret-as="time" format="Format">  Text  </say-as>

  

Format

  

hms24, hms12

  

Text

   

Only digits, time delimiters ( ' : ', ' . ', empty string), modifier delimiters (space, empty string).

It permits modifiers like: "AM", "A.M.", "am", "a.m.", "A", "a", "PM", "P.M.", "pm", "p.m.", "P" and "p".

The possible range of each unit is checked. When Format is not specified, it regards it as hms12.

  

Restrictions

   

hms12 only allows hour values to be in the range of 0 to 12.

hms24 only allows hour values to be in the range of 0 to 23.


Examples


  

Ex. 1

   

<say-as interpret-as="timeformat="hms12"> 09:21:15 </say-as>

  

Ex. 2

   

<say-as interpret-as="time" > 2'10" </say-as>

will be pronounced as two minutes and ten seconds

  

Ex. 3


   

<say-as interpret-as="time" > 1234am </say-as>
or
<say-as interpret-as="time" > 1234AM </say-as>
or
<say-as interpret-as="time" > 1234a </say-as>
or
<say-as interpret-as="time" > 1234 a.m. </say-as>

will be pronounced as twelve thirty four A M


telephone

  

Syntax

  

<say-as interpret-as="telephone" format="Format">  Text  </say-as>

  

Format

  

Country code number

  

Text

   

Only the country code symbol ( ' + ' ), digits, telephone number delimiters ( ' ( ', ' ) ', ' - ', ' . ', ' / ', space), symbols ( ' * ', ' # ' ) and letters (excluding Q&Z) are recognized


Examples


  

Ex. 1

   

<say-as interpret-as="telephoneformat="39"> +39(011)777-7777 </say-as>

  

Ex. 2

  

<say-as interpret-as="telephoneformat="39”> +1-800-EXAMPLE </say-as>

  

Ex. 3


  

<say-as interpret-as="telephone"+1-800-555-234 ex. 23 </say-as>

will be pronounced as one eight hundred five five five five two three four extension two three

  

Ex. 4


  

<say-as interpret-as="telephone"*53# </say-as>

will be pronounced as star five three pound (American)

or as star five three hash (British)


characters

  

Syntax

  

<say-as interpret-as="characters" format="Format" detail="Details">  Text  </say-as>

  

Format

  

Characters

  

Detail

  

Character number of the classified group. (In order to distinguish groups, space characters must be used.)

The sum of the character numbers in all groups must be identical to the total number of characters in the entire text

  

Text

   

Only English characters, numbers and 31 1-Byte symbols are allowed.

When Format or Detail are not defined, the text must be spelled out.

The symbols allowed are as follows:

‘ ! ’, ‘ # ’, ‘ $ ’, ‘ % ’, ‘ & ’, ‘ ’ ’, ‘ ( ‘, ‘ ) ’, ‘ * ’, ‘ + ’, ‘ , ’, ‘ - ‘, ‘ . ’, ‘ / ’, ‘ : ’, ‘ ; ’, ‘ < ’, ‘ = ’, ‘ > ’, ‘ ? ’, ‘ @ ’, ‘ [ ‘, ‘ \ ’, ‘ ] ’, ‘ ^ ’, ‘ _ ’, ‘ ` ’, ‘ { ‘, ‘ | ’, ‘ } ’, ‘ ~ ’.


Examples


  

Ex. 1

   

<say-as interpret-as="charactersformat="charactersdetail="3 1 2">

1a3BZ7

</say-as>

will be pronounced as one a three b z seven

  

Ex. 2

  

<say-as interpret-as="charactersformat="characters"> 1a3BZ7 </say-as>

  

Ex. 3

  

<say-as interpret-as="characters"> 1a3BZ7 </say-as>

  

Ex. 4


  

<say-as interpret-as="characters"> speed </say-as>

will be pronounced as s p e e d


cardinal

  

Syntax

  

<say-as interpret-as="cardinal" format="Format" detail="Details">  Text  </say-as>

Roman numerals are also supported

  

Format

  

Symbol or character that distinguishes between integer and decimal numbers

Note that the format attribute is ignored

  

Detail

  

Symbol (character which distinguish the integers)

Note that the detail attribute is ignored 

  

Text

  

Only symbols (“+”, “-“), numbers and Format or Detail symbols are allowed.

  

Restrictions

  

Format and Detail must use different symbols.

En: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.

Es: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.


Examples


  

Ex. 1

   

<say-as interpret-as="cardinalformat="."> 123.456 </say-as>

  

Ex. 2

  

<say-as interpret-as="cardinaldetail="."> 123.456 </say-as>

  

Ex. 3

  

<say-as interpret-as="cardinal"> 123 </say-as>

will be pronounced as one hundred (and) twenty three

  

Ex. 4


  

<say-as interpret-as="cardinal"> CLI </say-as>

will be pronounced as one hundred (and) fifty one


ordinal

  

Syntax

  

<say-as interpret-as="ordinal">  Text  </say-as>

Roman numerals are also supported

  

Text

  

Only numbers are allowed

  

Restrictions

  

En: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.

Es: Numbers with 16 digits and above and that start with 0 are read digit-by-digit


Example


  

Ex. 1

   

<say-as interpret-as="ordinal" > 23 </say-as>

will be pronounced as twenty third

  

Ex. 2


   

<say-as interpret-as="ordinal" > VI </say-as>

will be pronounced as sixth


fraction 

  

Syntax

  

<say-as interpret-as="fraction">  Text  </say-as>

  

Text

  

The syntax of fractions is any of the following:

Fraction
        [ "+" | "-" | "±"] cardinal "/" cardinal

Non-negative mixed number
        [ "+" | "±"] cardinal "+" cardinal "/" cardinal

Negative mixed number
        "-" cardinal "-" cardinal "/" cardinal

where cardinal is a number as defined above


Example


  

Ex. 1

   

<say-as interpret-as="fraction" > 2/9 </say-as>

will be pronounced as two ninths

  

Ex. 2


   

<say-as interpret-as="fraction" > 3+1/2 </say-as>

will be pronounced as three and one half

  

Ex. 3


   

<say-as interpret-as="fraction" > -2-3/8 </say-as>

will be pronounced as minus two and three eighths


measure or unit

  

Syntax

  

<say-as interpret-as="measure">  Text  </say-as>
- or -
<say-as interpret-as="unit">  Text  </say-as>

  

Text

  

The syntax of measure or unit is any of the following:

Unit
        symbol [ "2" | "3" | "4"] [ "/" unit ]

Measurement
        number unit

Adjective measurement
        number "-" unit

A unit symbol may be almost any of the standard metric, imperial or other unit symbols, e.g. N(newtons), kJ (kilojoules), mi (miles), sqft (square feet), MiB (mebibytes), ly (light years), tbsp (tablespoons), °F (degrees Fahrenheit), psi (pounds per square inch), etc. The unit name does not contain periods (dots).

In general the unit symbols are case sensitive, so B is bytes and b is bits, but unambiguous symbols are matched case-insensitively, so that either the proper Hz or improper hz, HZ and hZ will all be treated as the frequency unit hertz.

The SI prefixes as well as binary prefixes may be prepended to unit symbols, if appropriate.

In unambiguous cases, the letter s may be appended to a symbol to force plural even though the number would need a singular qualifier, e.g. 1mph is one mile per hour, but 1mphs will be one miles per hour.

A unit symbol may be suffixed with a power like 2 or 3, so that m2 is square meters and s3 is seconds cubed.

The adjective measurement forces singular unit form, so that whereas 2in is two inches, 2-in is two inch.
A number may be either a cardinal, a signed integer, a real number, or a fraction, as described above.


Example


  

Ex. 1

   

<say-as interpret-as="unit" > 2nmi </say-as>

will be pronounced as two nautical miles

  

Ex. 2


   

<say-as interpret-as="unit" > 1+1/2tsp </say-as>

will be pronounced as one and one half teaspoons

  

Ex. 3


   

<say-as interpret-as="unit" > 5m/s2 </say-as>

will be pronounced as five meters per seconds squared

  

Ex. 4


   

<say-as interpret-as="unit" > 2,100prm </say-as>

will be pronounced as two thousand one hundred revolutions per minute

  

Ex. 5


   

<say-as interpret-as="unit" > 2.7µ</say-as>

will be pronounced as two point seven microfarads


address 

  

Syntax

  

<say-as interpret-as="address">  Text  </say-as>

  

Text

  

Street addresses or parts of an address may be marked with interpret-as="address" attribute. This will force special pronunciation of numbers and expansion of abbreviations.

The two-letter US state abbreviation will be expanded only when followed by a ZIP code, however one may force expansion elsewhere by specifying the attribute format="us-state"


Example


  

Ex. 1

   

<say-as interpret-as="address" > 320 W Mt Willson Ct </say-as>

will be pronounced as three twenty west mount willson court

  

Ex. 2


   

<say-as interpret-as="address" > rm. 103 </say-as>

will be pronounced as room one oh three

  

Ex. 3


   

<say-as interpret-as="address" > Ft Worth, TX 12345 </say-as>

will be pronounced as fort worth texas one two three four five

  

Ex. 4


   

<say-as interpret-as="address" format="us-state" > CO </say-as>

will be pronounced as colorado


spell-out or spell 

  

Syntax

  

<say-as interpret-as="spell-out">  Text  </say-as>
- or -
<say-as interpret-as="spell">  Text  </say-as>

  

Text

  

interprets the specified Text as individual characters, reading them out one at a time.


Example


  

Ex. 1

   

<say-as interpret-as="spell-out" > Hello </say-as>

will be pronounced as h e l l o

  

Ex. 2


   

<say-as interpret-as="spell-out" > speed </say-as>

will be pronounced as s p e e d

  

Ex. 3


   

<say-as interpret-as="spell-out" > 1234 </say-as>

will be pronounced as one two three four

  

Ex. 4


   

<say-as interpret-as="spell-out" > *#! </say-as>

will be pronounced as asterisk hash exclamation mark


vxml:boolean

  

Syntax

  

<say-as interpret-as="vxml:boolean">  Text  </say-as>

  

Text

  

Only "true" or "false" values are allowed


Examples


  

Ex. 1

   

<say-as interpret-as="vxml:boolean" > true </say-as>

  

Ex. 2

   

<say-as interpret-as="vxml:boolean" > false </say-as>


vxml:date

  

Syntax

  

<say-as interpret-as="vxml:date">  Text  </say-as>

  

Text

  

Only yyyyMMdd patterned numbers are allowed. '?'s may be used as undefined placeholders

  

Restriction

  

yyyy is a four-digit number representing the year; MM is a two-digit number representing the month and dd is a two-digit number representing the day


Examples


  

Ex. 1

   

<say-as interpret-as="vxml:date" > 20070102 </say-as>

  

Ex. 2

   

<say-as interpret-as="vxml:date" > ????0102 </say-as>


vxml:digits

  

Syntax

  

<say-as interpret-as="vxml:digits">  Text  </say-as>

  

Text

  

Only numbers are allowed


Examples


  

Ex. 1

   

<say-as interpret-as="vxml:digits" > 123 </say-as>


vxml:currency

  

Syntax

  

<say-as interpret-as="vxml:currency">  Text  </say-as>

  

Text

  

Only UUUmm.nn patterned monetary symbols, numbers and decimal points are allowed

  

Restrictions

  

En: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.

Es: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.


Example


  

Ex. 1

   

<say-as interpret-as="vxml:currency" > USD30.101 </say-as>


vxml:number

  

Syntax

  

<say-as interpret-as="vxml:number">  Text  </say-as>

  

Text

  

Only sign symbols ('+', '-'), numbers and decimal points are allowed

  

Restrictions

  

En: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.

Es: Numbers with 16 digits and above and that start with 0 are read digit-by-digit.


Example


  

Ex. 1

   

<say-as interpret-as="vxml:number" > 123.45 </say-as>


vxml:phone

  

Syntax

  

<say-as interpret-as="vxml:phone">  Text  </say-as>

  

Text

  

Only numbers and 'x' (abbreviation for “extension”) are allowed


Example


  

Ex. 1

   

<say-as interpret-as="vxml:phone" > 8005551234x789 </say-as>


vxml:time

  

Syntax

  

<say-as interpret-as="vxml:time">  Text  </say-as>

  

Text

  

Only HHMMX patterned numbers are allowed

  

Restriction

   

HH is a two-digit number representing the hour. MM is a two-digit number representing the minutes and X represents the AM/PM designation: 'a'(AM), 'p'(PM), 'h'(24 hour) and '?'(ambiguous time of either AM or PM). Only when X is 'h', can the value of HH be from 00 to 23.


Examples


  

Ex. 1

   

<say-as interpret-as="vxml:time" > 0600a </say-as>

  

Ex. 2

   

<say-as interpret-as="vxml:time" > 0600p </say-as>

  

Ex. 3

   

<say-as interpret-as="vxml:time" > 0600? </say-as>

  

Ex. 4

   

<say-as interpret-as="vxml:time" > 2310h </say-as>


  

<?xml version="1.0"?>

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/2001/10/synthesis

                   http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

   <say-as interpret-as="characters" format="characters">VoiceXML</say-as>

   You still owe me <say-as interpret-as="vxml:currency">USD30.10</say-as>

   Today's date is 

   <say-as interpret-as="date" format="ymd">2006/01/01</say-as>

   Please push the <say-as interpret-as="vxml:boolean">true</say-as> button.

   I will get there at 

   <say-as interpret-as="time" format="hms24">07:30:30.0PM</say-as>

</speak>



 

TTS Special Characters

It is sometimes necessary to modify texts to be synthesized in order to make them compatible with the system constraints and achieve the expected output.  LumenVox TTS provides a set of special characters that work only in certain contexts, changing the way texts are being synthesized in terms of pronunciation or intonation. 

The characters are language-specific and do not apply to other languages unless specified otherwise in the language-specific documentation.


Force the letter "a"

_a will be pronounced ey. This is to distinguish the letter a in contexts in which the synthesizer would recognize the input a as the indefinite article a.


Force rising intonation

A question mark followed by caret also known as circumflex (?^) can be used to force the intonation of a question to be rising. Wh-questions (questions starting with an interrogative pronoun) by default have falling intonation. This can be changed by appending a caret to the question mark.

Example

        How are you?^ will result in a rising intonation.


Force falling intonation

A question mark followed by an underscore (?_) can be used to force the intonation of a question to be falling. Yes/No questions by default have a rising intonation. This can be changed by appending the underscore character to the question mark.

Example

        Are you all right?_ will result in a falling intonation.