Microsoft Text Analytics
(Available from version 7.2 onwards.)
Microsoft Text Analytics Library uses Microsoft’s Text Analytics service to provide Sentiment Analysis, Entity Recognition, and Key Phrase Extraction functions.
Note that Microsoft applies limitations to the quantity of text that can be submitted per request and to the quantity of requests that can be submitted per second and minute. For details, see here.
Use the functions listed below to submit requests to Microsoft Text Analytics. To use a function, you must first create an instance of the appropriate variable type to which to assign the function's response. For example, you must create an instance of an MS Entity Response variable to capture the response to a MS Entity Recognition function. For information on those variable types, see here.
Prerequisites
To use Microsoft Text Analytics, ensure that you have all of the following:
-
An active Microsoft Azure account. To create an account, see here.
-
An active Internet connection on your machine. The machine on which the automation will be run will also need an active Internet connection.
-
An API key and endpoint for the Text Analytics service. (These must be stored in a variable of type MS client credential, see here). Note that Microsoft endpoints are specific to region, see here.
Functions
An individual example is provided for each function described in this topic.
Download the project here and unzip to the folder %AppData%/Nice_Systems/AutomationStudio/Projects\. This project includes one workflow per function.
You must first enter your credential details before you can use these examples:
-
In the Assets Panel, locate the variable MSClientCredential, click the Menu button, and select Edit.
-
Click API Key.
-
Enter your MS Analytics key in the Initial Value field.
-
Click End Point.
-
Enter your MS Analytics end point.
-
Click Save.
Requests sentiment analysis of specified text from Microsoft Text Analytics to obtain a sentiment score from 0 (negative) to +1 (positive).
See Microsoft's documentation for more information. For a list of supported languages, see here.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
MS Client Credential | MS client credential | The name of the variable of type MS Client Credential that holds your Microsoft Text Analytics key and endpoint URL. |
Language Code |
text |
The code of the language of the text provided. For a list of supported languages and their codes, see here. |
Text for Analysis |
text |
The text for sentiment analysis. |
Returns
Sentiment analysis results in MS Sentiment Response format
Example
This example requests sentiment analysis on the following text:
I am writing about the service I received on Monday. I was extremely satisfied and would like to thank you very much for the fantastic service.
The workflow is shown below. The result is stored in the variable SentimentResponse.
The results are shown below.
The sentiment score of 0.98 indicates a very positive sentiment.
Requests entity analysis of specified text from Microsoft Text Analytics to identify named entities present in the text.
See Microsoft's documentation for more information. For a list of supported languages, see here.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
MS Client Credential | MS client credential | The name of the variable of type MS Client Credential that holds your Microsoft Text Analytics key and endpoint URL. |
Language Code |
text |
The code of the language of the text provided. For a list of supported languages and their codes, see here. |
Text for Analysis |
text |
The text for entity recognition. |
Returns
A list of entity recognition analysis results in MS Entity Response format
Example
This example requests entity recognition on the following text:
Paris was extremely enjoyable. Our guide, Guy de Lombard, was helpful and pleasant. Unfortunately, our hotel, Chateau Granville, was dirty and offered terrible service.
The workflow is shown below. The result is stored in the variable EntityResponse.
The results are shown below.
Note the following:
-
Three entities were identified.
-
Paris was identified as a location.
-
Paris is mentioned once in the text.
-
The length of the word Paris is 5 characters, and starts at the start of the text (offset is 0).
Requests key phrase extraction from specified text from Microsoft Text Analytics.
See Microsoft's documentation for more information. For a list of supported languages, see here.
Parameters
Parameter |
Input Type |
Description |
---|---|---|
MS Client Credential | MS client credential | The name of the variable of type MS Client Credential that holds your Microsoft Text Analytics key and endpoint URL. |
Language Code |
text |
The code of the language of the text provided. For a list of supported languages and their codes, see here. |
Text for Analysis |
text |
The text for entity key phrase extraction |
Returns
A list of key phrase extraction results in MS Key Phrase Response format
Example
This example requests key phrase extraction on the following text:
You asked for my opinion on your service. I would say that I am happy. The workers were polite, but on the other hand I can't overemphasize how long they took to finish the job. They left in a hurry and did not clean up after.
The workflow is shown below. The result is stored in the variable KeyPhraseResponse.
The results are shown below.
Six key phrases were identified.