How do I define dynamic grammar phrase properties?
Last reviewed: 9/10/2008
HOW Article ID: H090807
The information in this article applies to:
- SpeechKit 6
Summary
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.
More Information
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:
vocabPhrase
The spoken utterance. This is the PHRASE element value.
pszName
The name information of the property. This is the PROPNAME attribute.
ulId
An identifier associated with the property. This is the PROPID attribute.
pszValue
The string value of the property. This is the VALSTR attribute.
value
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")