All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.

Speech Recognition and Virtual Assistant (Nuance) CTP

  • 3 minutes to read

This topic contains instructions on how to bind the Rich Text Editor to the Nuance Dragon SpeechKit to integrate speech recognition and voice-enabled workflows into your applications.

IMPORTANT

This functionality is available in v20.2.5 as a community technology preview (CTP).

Requirement

To use the RichEdit control with Nuance Speech Recognition, you need to have a Nuance Dragon subscription.

Register Rich Text Editor in Nuance

Register a RichEdit control in the Dragon SpeechKit's NUSA_configure method to enable Nuance API support in RichEdit. Note that you should register every RichEdit control on the page. After registration, a control can processes the Nuance default commands.

Use the nusaSettings property to access the RichEdit's Nuance-related settings.

function NUSA_configure() {
    ...
    // register every RichEdit control that should work with Nuance functionality
    richEdit1.nusaSettings.register();
    richEdit2.nusaSettings.register();
}

Speech-Enabled RichEdit Focus

Specify the conceptName option in the register method to allow users to focus a RichEdit with the go to voice command.

function NUSA_configure() {
    ...
    // register every RichEdit control that should work with Nuance functionality
    richEdit1.nusaSettings.register({ conceptName: 'patient description' });
    richEdit2.nusaSettings.register({ conceptName: 'medical history' });
}

RichEdit Commands for Nuance

Rich Text Editor contains a set of custom Nuance commands that allow you to manage RichEdit functionality (for instance, change font name and color). Call the registerCommands method to register the commands. Note that regardless of the number of RichEdit controls on the page, the function should be called only once.

function NUSA_configure() {
    ...
    richEdit1.nusaSettings.registerCommands();
}

Add a command handler for every RichEdit control in the Dragon SpeechKit's NUSA_onCommandRecognized event handler.

function NUSA_onCommandRecognized(cmdId, spokenText, content, placeholderIds, placeholderValues) {
    if(richs[0].nusaSettings.getCommandHandler()(cmdId, placeholderIds, placeholderValues))
        return;
// your custom commands
...
}

Custom User Commands

You can add custom RichEdit commands in the Dragon SpeechKit's NUSA_onCommandRecognized event handler. Use the getFocusedRichEdit method to get the focused RichEdit control.

/** @type {DevExpress.RichEdit.RichEdit} */
const focusedRichEdit = richEdit.nusaSettings.getFocusedRichEdit();

Get Control Type and Container Type

Use the following methods to get the current instance of the NusaCustomControlType or NusaCustomContainerType type.

richEdit.nusaSettings.getCustomControl();
richEdit.nusaSettings.getCustomContainer();

Use the returned objects to modify the RichEdit's Nuance-related settings (for instance, insert two paragraphs with the new paragraph voice command).

function NUSA_configure() {
    richEdit.nusaSettings.register();
    var customControl = richEdit.nusaSettings.getCustomControl();
    customControl.paragraphFormat = DevExpress.RichEdit.Characters.ParagraphBreak + 
        DevExpress.RichEdit.Characters.ParagraphBreak;
}

Use the customControlType and customContainerType parameters of the NusaRegisterOptions interface to specify the type names. The default values are: "DevExpressRichEdit" and "DevExpressRichEditContainer".

Customize the Registered Commands

The registerCommands method accepts an optional parameter that allows you to modify command settings (for instance, change a command description).

richEdit.nusaSettings.registerCommands(function(commandSets/*: NusaCommandSet[]*/, placeholders: /*NusaPlaceholder[]*/) {
    commandSets[0].commands.find(function(cmd){
        return cmd.commandId == “DxReFontColor”}).description = 'Custom description';
});