Using Phonetic Spellings

Within an SRGS grammar, you can specify pronunciations of words using phonemes. Phonemes are the basic sounds that make up words (see our list of phonemes). Specifying pronunciations this way is useful for adding alternative pronunciations to help deal with some proper names and to help support dialects or even foreign words.

 

To add a phonetic spelling to a rule, enclose the phonetic spelling within double quotation marks " " and curly braces { }.

 

For instance, the word "either" is commonly pronounced in two ways. One has a long I sound at the start (eye-ther) while the other starts with a long E sound (ee-ther). Broken into their phonemes, these two variants would be spelled as AY DH AXR and IY DH AXR.

 

A rule that contained the two variants of the word "either" might look like this:

 

$either = "{AY DH AXR}" | "{IY DH AXR}";

 

A rule set up like this, however, will only return the phonemes if the rule is matched. If you want to get the actual word returned as raw text by the Engine, you need to enclose the word within the quotation marks and curly braces, but separate it from the phonemes with a colon.

 

$either = "{AY DH AXR:either}" | "{IY DH AXR:either}";

 

Here is a Spanish grammar that uses these principles:

 

#ABNF 1.0 ISO-8859-1;

/*

 * This is an example name grammar

 * with semantic interpretation tags.

 */

 

language es-MX;

mode voice;

root $main;

tag-format <semantics/1.0>;

 

public $main = "{K R EY D IY T OW:credito}" {$="credito"} //custom pronunciation

      | Si {$="Si"}

      | (("el baŅo") | "{EY L BV AA NG OW}") {$="el baŅo"}

      | hola {$="hola"};