Compartir a través de


lexicon Element PLS

Specifies the highest level container for an XML-format lexicon document.

Syntax

<lexicon
   version = "1.0"
   xmlns = "http://www.w3.org/2001/06/grammar"
   alphabet = “ipa” | “x-microsoft-sapi” | “x-microsoft-ups”
   xml:lang = “(language code-country/region code)”
</lexicon>

Attributes

Attribute

Description

alphabet

Required. Specifies the default pronunciation alphabet to be used within the PLS document. The only acceptable values are ipa or x-microsoft-sapi or x-microsoft-ups. These values are case-sensitive and must be entered in lower case.

version

Required. Specifies the version number of the Pronunciation Lexicon Specification (PLS) Version 1.0 used. The only accepted value is 1.0.

xml:base

Optional. Specifies a lexicon document's base Uniform Resource Identifier (URI). The value for xml:base is used to resolve relative URIs in a lexicon document. Currently, only the contents of the metadata element can potentially use relative URIs.

xml:lang

Required. Declares the single language for the content of the containing lexicon document. The value may contain either a lower-case, two-letter language code, (such as "en" for English or "fr" for French) or may optionally include an upper-case, country/region or other variation in addition to the language code. Examples with a county/region code include "zh-TW" for Chinese as spoken in Taiwan, or "de-DE" for German.

xmlns

Required. Specifies the XML namespace for W3C pronunciation lexicon. The XML namespace is “http://www.w3.org/2005/01/pronunciation-lexicon”.

Remarks

The pronunciation alphabet specified in the alphabet attribute may be overridden for a specific lexeme using the alphabet attribute of the phoneme Element PLS. You can also specify a phonetic alphabet programmatically for a speech recognition grammar, using the PhoneticAlphabet property.

See Phonetic Alphabet Reference for more information about the phonetic alphabets that System.Speech supports.

For a given language code declared in the xml:lang attribute, a speech engine that supports that language code must be installed for the lexicon to be loaded successfully.

If the xml:lang attribute specifies only a language code, and not a country/region code, (such as xml:lang="en"), then any installed speech engine that expresses support for that generic, region-independent language will be able to load the lexicon.

Example

The following example illustrates the use of the alphabet attribute of the phoneme element to specify a pronunciation using a different phonetic alphabet than the one specified by the alphabet attribute in the lexicon element, for a single instance of the word “hello”.

<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0" 
      xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon 
        http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
      alphabet="ipa" xml:lang="en-US">

  <lexeme>
    <grapheme> hello </grapheme>
    <phoneme alphabet=”x-microsoft-ups”> H EH . S1 L O </phoneme>
  </lexeme>

</lexicon>