PLS lexicons to take into account.
PLS lexicons to take into account.
Each lexicon must be specified as a URI, absolute or relative to the input.
Lexicons can also be attached to the source document, using a ‘link’
element.
PLS lexicons allow you to define custom pronunciations of words. It is
meant to help TTS processors deal with ambiguous abbreviations and
pronunciation of proper names. When a word is defined in a lexicon,
the processor will use the provided pronunciation instead of the
default rendering.
The syntax of a PLS lexicon is defined in Pronunciation Lexicon
Specification (PLS) Version
1.0, extended with
regular expression matching. To enable regular expression matching,
add the “regex” attribute, as follows:
<lexicon xmlns="http://www.w3.org/2005/01/pronunciation-lexicon" version="1.0"
alphabet="ipa" xml:lang="en">
<lexeme regex="true">
<grapheme>([0-9]+)-([0-9]+)</grapheme>
<alias>between $1 and $2</alias>
</lexeme>
</lexicon>
The regex feature works only with alias-based substitutions. The regex
syntax used is that from XQuery 1.0 and XPath
2.0.
Whether or not the regex attribute is set to “true”, the grapheme
matching can be made more accurate by specifying the
“positive-lookahead” and “negative-lookahead” attributes:
<lexicon version="1.0" xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
alphabet="ipa" xml:lang="en">
<lexeme>
<grapheme positive-lookahead="[ ]+is">SB</grapheme>
<alias>somebody</alias>
</lexeme>
<lexeme>
<grapheme>SB</grapheme>
<alias>should be</alias>
</lexeme>
<lexeme xml:lang="fr">
<grapheme positive-lookahead="[ ]+[cC]ity">boston</grapheme>
<phoneme>bɔstøn</phoneme>
</lexeme>
</lexicon>
Graphemes with “positive-lookahead” will match if the beginning of
what follows matches the “position-lookahead” pattern. Graphemes with
“negative-lookahead” will match if the beginning of what follows does
not match the “negative-lookahead” pattern. The lookaheads are
case-sensitive while the grapheme contents are not.
The lexemes are matched in this order:
- Graphemes with regex=”false” come first, no matter if there is a lookahead or not;
- then come graphemes with regex=”true” and no lookahead;
- then graphemes with regex=”true” and one or two lookaheads.
Within these categories, lexemes are matched in the same order as they
appear in the lexicons.