Modifies the list of available speech commands.
Identifier: speech_modify_commands_in_grammar
Adding commands
Add two commands to the list of allowed speech commands:
<speech_modify_commands_in_grammar id="speech_add_commands"> <param name="grammar">xGuide</param> <param name="slot">wf_editor_slot</param> <param name="modification">add_commands</param> <list name="commands" listType="UNNAMED"> <list name="login" listType="NAMED"> <param name="name">LOGIN</param> <param name="description">Login</param> </list> <list name="logout" listType="NAMED"> <param name="name">LOGOUT</param> <param name="description">Logout</param> </list> </list> <param name="reset_before" type="bool">false</param> </speech_modify_commands_in_grammar>
Generating commands using JavaScript
<speech_modify_commands_in_grammar id="speech_add_commands"> <param name="grammar">xGuide</param> <param name="slot">wf_editor_slot</param> <param name="modification">add_commands</param> <param name="commands"><![CDATA[?{ var cmds = []; var i; cmds.push({ 'name': 1 + " Label", 'description': `[1-50] Label(s)`}); for(i = 2; i <= 50; i++){ cmds.push({ 'name': i + " Labels", 'description': `[1-50] Label(s)`}); } cmds }?]]></param> <param name="reset_before" type="bool">false</param> </speech_modify_commands_in_grammar>
Removing commands
Remove one command from the current custom commands:
<speech_modify_commands_in_grammar id="remove_save_selection"> <param name="slot">wf_editor_slot</param> <param name="commands">Logout</param> <param name="modification">remove_commands</param> <param name="reset_before" type="bool">false</param> </speech_modify_commands_in_grammar>
Remove all custom commands
<speech_modify_commands_in_grammar id="add_save_selection"> <param name="modification">remove_all_commands</param> </speech_modify_commands_in_grammar>
This action allows the user to activate and deactivate specific slots in grammar.
Identifier: speech_modify_rules_in_grammar
Disable all grammar slots. No speech commands will be recognized anymore.
<speech_modify_rules_in_grammar id="deactivate_all" modification="DEACTIVATE_ALL"/>
Activate a grammar slot and add a description of it to the 'Show Commands' window.
<speech_modify_rules_in_grammar id="remove_login_command" modification="ACTIVATE"> <rules> <rule name="wf_editor_slot" description="Pick <1 to 10>"/> </rules> </speech_modify_rules_in_grammar>
It lets you control which speech commands are passed to the handling logic.
Identifier: speech_word_filter
Adds some commands to the list of filtered speech commands.
<speech_word_filter id="speech_actions"> <param name="action">ADD</param> <list name="words" listType="UNNAMED"> <elem>command</elem> </list> <list name="regex_words" listType="UNNAMED"> <elem>start .*</elem> </list> </speech_word_filter>
Controls the way speech input is mapped.
Identifier: speech_word_mapping
Add two commands to the allowed speech commands. Both commands should have the same description in the 'Show Commands' window.
<speech_word_mapping id="speech_actions"> <param name="action">add</param> <param name="input">input</param> <param name="output">output</param> <param name="is_regex">true</param> </speech_word_mapping>
In this example, a speech command "Zoom Level X" with a dynamic number is added like this:
<speech_modify_commands_in_grammar id="speech_add_commands"> <param name="grammar">xGuide</param> <param name="slot">wf_editor_slot</param> <param name="modification">add_commands</param> <param name="commands"><![CDATA[?{ var cmds = []; var i; for(i = 1; i <= 5; i++){ cmds.push({ 'name': "ANDRRES_zoom_level " + i, 'description': `ANDRRES_zoom_level [1-5]`}); } cmds }?]]></param> <param name="reset_before" type="bool">false</param> </speech_modify_commands_in_grammar>
With "ANDRRES_zoom_level" we are using a resource string from Frontline Workplace which will be translated automatically based on the user language. In this rule, we want to react to the speech command. However, we always want to compare this with the same command, not with translations of the command. Thus the speech_word_mapping
action is used to map the translated command to the command we will be using in the rule.
<speech_word_mapping id="zoom_level_mapping_action_add"> <param name="action">add</param> <param name="input">ANDRRES_zoom_level ([1-5])</param> <param name="output">ZOOM LEVEL $1</param> <param name="is_regex">true</param> <param name="sub_mapping">1</param> </speech_word_mapping>