Export (0) Print
Expand All

lexicon Element SSML

Specifies an external pronunciation lexicon file.

Syntax

<lexicon
    uri = lexiconUri
    type = mediaType />

Attributes

Attribute

Description

uri

Required. Specifies the location of the pronunciation lexicon, which is a relative URI or an absolute URI.

type

Optional. Specifies the media type of the pronunciation lexicon document. System.Speech currently supports two values.

The value application/pls+xml indicates that the lexicon conforms to the Pronunciation Lexicon Specification (PLS) Version 1.0 specification. This is the preferred format to use.

The value application/vdn.ms-sapi-lex indicates the lexicon format is “Uncompressed Lexicon”, which was created by Microsoft. This is a legacy format and we recommend that you use the PLS format described above.

Remarks

A pronunciation lexicon is a collection of words or phrases together with their pronunciations, which consist of letters and characters from a supported phonetic alphabet. You can use lexicons to create custom pronunciations for specialized vocabulary in your application. Pronunciations specified in an external lexicon file take precedence over the pronunciations of the speech synthesizer's internal lexicon or dictionary. However, pronunciations specified inline in prompts using the phoneme Element take precedence over pronunciations specified in any lexicon. Inline pronunciations apply only to a single occurrence of a word. For more information, see Lexicons and Phonetic Alphabets.

The lexicon element is an immediate child of the speak Element. Multiple lexicon elements can occur in a Speech Synthesis Markup Language (SSML) document. If there are references to multiple lexicons, the order in which they are listed dictates their priority. Speech synthesis (TTS) engines use lexicons of higher priority first when determining which pronunciations to use.

The pronunciation information provided by a lexicon is specific to the single language declared in the xml:lang attribute of the speak element, and is used only for content defined within the enclosing SSML document.

Example

The following example specifies a lexicon that defines a pronunciation for an uncommon word: whatchamacallit. Typically, you would use the phoneme Element to specify a pronunciation for a single occurrence of an uncommon word. However, this example demonstrates how to attach a lexicon to an SSML prompt and how the pronunciation defined in a lexicon may improve the speech synthesizer's pronunciation of an uncommon word. A custom lexicon overrides the pronunciations in the speech synthesizer's internal lexicon and applies to all occurrences of the words it defines.

<?xml version="1.0"?>

<speak version="1.0"
   xmlns="http://www.w3.org/2001/10/synthesis"
   xml:lang="en-US">

  <lexicon uri="c:\Test\whatchamacallit.pls" type="application/pls+xml"/>
  
  Gimme the whatchamacallit.

</speak>

The following are the contents of the SSML prompt file whatchamacallit.pls.

<?xml version="1.0" encoding="UTF-8"?>

<lexicon version="1.0" 
  xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
  alphabet="x-microsoft-ups" xml:lang="en-US">

  <lexeme>
    <grapheme> whatchamacallit </grapheme>
    <phoneme> W S1 AX T CH AX M AX K S2 AA L IH T </phoneme>
  </lexeme>

</lexicon>
Show:
© 2014 Microsoft