Note that the text on this page is intended for concept/phrase grammars. LumenVox recommends using SRGS grammars instead of concept/phrase grammars, as SRGS provides a more robust and standard method of writing grammars. For information about writing SRGS grammars, see our SRGS tutorial.
When using AddPhrase(LV_SRE_AddPhrase or LVSpeechPort::AddPhrase) you may use the Backus-Naur Form for entering multiple words. This allows for a significant level of control over how phrases are entered.
A phrase may be entered simply as one or more words, such as "California" or "how do I".
The BNF format allows for several operators. Optional words may be enclosed in square brackets (the [ ] characters). A pipe (the | character) denotes a logical "or" statement, and parentheses clarify order of operation and control nesting.
For instance, the phrase:
[that's] (right | correct)
Would be matched to any of the following: "that's right", "that's correct", "right" or "correct".
You may also add in raw phonemes by surrounding them in curly braces (the { } characters). Phonemes represent the basic units of sound in a language; see Using Phonetic Spellings for more information.
For example, the phrase:
{Y EH S P L IY Z}
Would be matched to "yes please".
You may also combine any of these formats:
is that ( correct | {R AY T} )
The above phrase would be matched to either "is that correct" or "is that right".
The engine has an internal dictionary of approximately 120,000 words, which it uses to know how words should be pronounced. There is also a robust phonetic speller for words not found in the dictionary. The only valid punctuation marks are the apostrophe (the ' character) and the hyphen (the - character).
Hyphens should be used for multiple words that should be looked up in the internal dictionary as a single word, e.g. new-orleans. If the multiple words do not exist in the dictionary the hyphens will be replaced by spaces and the words will be looked up in the dictionary separately.
Below are two sentences entered in with BNF, followed by the various phrases that would match those concepts:
( (I would like to speak | Please connect me ) with ) John Doe [please]
I WOULD LIKE TO SPEAK WITH JOHN DOE PLEASE
PLEASE CONNECT ME WITH JOHN DOE PLEASE
I WOULD LIKE TO SPEAK WITH JOHN DOE
PLEASE CONNECT ME WITH JOHN DOE
I ( want | need ) [ to ( know | hear ) ] [ the ] directions [ to ]
I WANT TO KNOW THE DIRECTIONS TO
I NEED TO KNOW THE DIRECTIONS TO
I WANT TO HEAR THE DIRECTIONS TO
I NEED TO HEAR THE DIRECTIONS TO
I WANT THE DIRECTIONS TO
I NEED THE DIRECTIONS TO
I WANT TO KNOW DIRECTIONS TO
I NEED TO KNOW DIRECTIONS TO
I WANT TO HEAR DIRECTIONS TO
I NEED TO HEAR DIRECTIONS TO
I WANT DIRECTIONS TO
I NEED DIRECTIONS TO
I WANT TO KNOW THE DIRECTIONS
I NEED TO KNOW THE DIRECTIONS
I WANT TO HEAR THE DIRECTIONS
I NEED TO HEAR THE DIRECTIONS
I WANT THE DIRECTIONS
I NEED THE DIRECTIONS
I WANT TO KNOW DIRECTIONS
I NEED TO KNOW DIRECTIONS
I WANT TO HEAR DIRECTIONS
I NEED TO HEAR DIRECTIONS
I WANT DIRECTIONS
I NEED DIRECTIONS
Complete Help Topic List | Speech Engine Product Information