Set NLP Provider

Sets a natural language processing provider to the script.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Defines the natural language processing provider used in the script.

Added in 21.0.3: Use this command to choose the natural language processing provider that you want to use in your script. Subsequent natural language processing commands will use the defined provider.

See Commands that Support Watson NLP.

Script syntax

IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

setNlpProvider --provider(NlpProviderType)

Input parameters

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Provider provider Required NlpProviderType Defines the natural language processing provider that is used by the commands that come after it.
See the provider parameter options for details.

provider parameter options

The following table displays the options available for the provider input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Legacy Legacy Uses IBM RPA's legacy natural language processing provider.
IBM Watson Watson Uses the IBM Watson natural language processing provider.
Default Default Uses the default natural language processing provider that is defined in the IBM RPA Control Center.

Example

The following example switches between both providers to demonstrate their differences.

defVar --name entities --type String
defVar --name entitiesList --type List --innertype String
defVar --name result --type Boolean
defVar --name firstEntity --type String
defVar --name valueMappings --type DataTable
setVar --name "${entities}" --value "My favorite authors are Sir Arthur Conan Doyle, and Agatha Christie. I also like some books from Edgar Allan Poe, such as Eureka. But my favorite book of all time is Don Quixote, from Miguel de Cervantes."
setNlpProvider --provider "Legacy"
extractNamedEntities --entities "Person" --culture "en-US" --text "${entities}" entitiesList=values firstEntity=first valueMappings=valuesmapping result=success
logMessage --message "Named entities list: ${entitiesList}\r\nFirst entity found: ${firstEntity}\r\nMappings: ${valueMappings}\r\nResult: ${result}" --type "Info"
setNlpProvider --provider "Watson"
extractNamedEntities --entities "Person" --culture "en-US" --text "${entities}" entitiesList=values firstEntity=first valueMappings=valuesmapping result=success
logMessage --message "Named entities list: ${entitiesList}\r\nFirst entity found: ${firstEntity}\r\nMappings: ${valueMappings}\r\nResult: ${result}" --type "Info"