Defining dynamic grammar phrase properties
Last reviewed: 9/10/2008
HOW Article ID: H090807
The information in this article applies to:
- SpeechKit 6
A vocabulary phrase added to a dynamic grammar maps to a phrase element for SAPI 5 dynamic grammars.
With SpeechKit 6, phrase properties now can be added as part of the word list phrase for dynamic SAPI 5 grammars.
Word lists enable you to substitute a list of words or phrases at runtime. You define a word list using the DefineResource method with the CSRVocabList speech resource using the vocabulary resource id with which it is associated. Then you add the words to the list using the ChantSR AddResource method with the CSRVocabPhrase speech resource.
For a Microsoft SAPI 5 XML Grammar, you may add a phrase with properties. Specify comma separated values for the PROPNAME, PROPID, VALSTR, and/or VAL attributes. For example, a phrase would look something like "vocabPhrase, pszName, ulId, pszValue, value" where:
The spoken utterance. This is the PHRASE element value.
The name information of the property. This is the PROPNAME attribute.
An identifier associated with the property. This is the PROPID attribute.
The string value of the property. This is the VALSTR attribute.
The numeric value of the property. This is the VAL attribute
Properties values are positional so leave value empty if not setting. The following illustrates setting the vocabulary phrase with properties:
// Add phrase with the PROPNAME and VALSTR attributes ChantSR.AddResource(CSRVocabPhrase, ListID, "Log Call,commandstr,,log_call,") // Add phrase with the PROPNAME and VAL attributes ChantSR.AddResource(CSRVocabPhrase, ListID, "Log Call,commandid,,,101")