Speech
Speech Modify Commands
Modifies the list of available speech commands.
Identifier: speech_modify_commands_in_grammar
Attributes
- modification:This enables the user to add or remove commands.
- Possible values: add_commands, remove_commands, remove_all_commands
- Required: Yes
- Default value: Empty
- reset_before:Removes all commands in a particular slot.
- Possible values: true, false
- Required: No
- Default value: False
- slot:Location of the commands
- Possible values: wf_editor_slot
- Required: No
- Default value: wf_editor_slot
- grammar:The grammar that should be used.
- Possible values: xGuide
- Required: No
- Default value: Empty
Elements
- commands:Contains a list of command elements that are getting added or removed.
- Default value: Empty
Command attributes
- name:Defines the speech value.
- Possible value: Text
- Required: Yes
- Default value: Empty
- description:Displays Information about an attribute.
- Possible values: Text
- Required: No
- Default value: Empty
Examples
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>
Speech Modify Rules in Grammar
This action allows the user to activate and deactivate specific slots in grammar.
Identifier: speech_modify_rules_in_grammar
Attributes
- modification: Type of the modifications for a grammar slot.
- Possible values: ACTIVATE, ACTIVATE_ALL, DEACTIVATE, DEACTIVATE_ALL
- Required: Yes
- Default value: Empty
Elements
- rules: Contains a list of rule elements that can be activated or deactivated.
- Default value: Empty
Rules attribute
- name:Defines the grammar slot that should get activated or deactivated.
- Required: Yes
- Default value: Empty
- description:Displays Information that will be shown in the 'Show Command' screen for that slot.
- Required: No
- Default value: Empty
Examples
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>
Speech Word Filter
It lets you control which speech commands are passed to the handling logic.
Identifier: speech_word_filter
Elements
- words: Contains a list of speech commands that can be added or removed.
- regex_words: Contains regex speech commands that can be added or removed.
Param attributes
- action: Defines how the current speech filter list is getting modified.Possible values: ADD, REPLACE, REMOVE, RESET
- Required: Yes
- Default value: Empty
Example
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>
Speech Word Mapping
Controls the way speech input is mapped.
Identifier: speech_word_mapping
Param attributes
- action:Defines the speech value.
- Possible values: ADD
- Required: Yes
- Default value: Empty
- input:The input that should be mapped.
- Possible values: Text
- Required: Yes
- Default value: Empty
- output:The result produced from a mapped input.
- Possible values: Text
- Required: Yes
- Default value: Empty
- is_regex:Whether a regular expression was specified or not.
- Possible values: True, False
- Required: No
- Default value: False
- sub_mapping:Single integer as a string parameter or a set of integers. This is required when using a regex to map the matched groups to the output.
- Possible values: 1
- Required: No
- Default value: Empty
Example
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>
Full example using regex
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>
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article