Adding Foreign Words

Adding Foreign Words To Your Grammar

Using phonetic rules within an SRGS grammar, developers can build limited functionality for their speech recognition applications for words in languages not supported by the Speech Engine.

Within a grammar you may create rules that are matched to phonetic spellings by using phonemes. By breaking foreign words into their constituent phonemes, grammars can effectively contain those words.

If a word contains a phoneme that does not occur in English, use the English phoneme that is closest to the foreign phoneme (see the phoneme chart).

For instance, if you were going to build phonetic support for the German numbers zero through ten, you would begin by assembling a list of the digits along with phonetic pronunciations:

Number Phonemes
Null N UH L
Eins AY N S
Zwo T S OW
Zwei T S V AY
Drei D R AY
Vier F IY R
Fünf F UW N F
Sechs Z EH K S
Sieben Z IY B EH N
Acht AA K T
Neun N OY N

Note that several of the phonemes are approximations. The "ch" sound in "acht" is different from the English phoneme represented by K, but since English does not have the phoneme from "acht" we picked the closest sound.

To enter a phonetic spelling as part of a rule within an SRGS grammar, include the phonetic spelling inside of quotes and curly braces. A basic ABNF grammar to return a spoken German digit might look like the following:

#ABNF 1.0;
language en-US;
mode voice;
tag-format <lumenvox/1.0>;

root $Digits;

$Digit =    ("{AY N S: eins}":"1"         |
            ("{S V AY: zwei}" | "{T S V AY: zwei}"):"2" |
            "{D R AY: drei}":"3"          |
            "{F IY R: vier}":"4"          |
            "{F UW N F: funf}":"5"        |
            "{Z EH K S: sechs}":"6"       |
            "{Z IY B EH N: sieben}":"7"   |
            "{AA K T: acht}":"8"          |
            "{N OY N: neun}":"9"          |
            "{N UW L: null}":"0"); 

$Digits = {$=''} ($Digit {$+=$$})<1-> 

© 2018 LumenVox, LLC. All rights reserved.