# IBM Watson NLU Text Analysis

> `UiPath.Cognitive.Activities.Text.Analysis.IbmWatsonNluTextAnalysis`

`UiPath.Cognitive.Activities.Text.Analysis.IbmWatsonNluTextAnalysis`

:::important
Important:
:::

Extracts key information from a specified text, and returns multiple IBM Watson NLU specific data types as well as a raw result in `.json` format, stored in a String variable. You can find more information about the Natural Language Understanding service by reading the official documentation [here](https://console.bluemix.net/docs/services/natural-language-understanding/).

## Properties

### Common

* **DisplayName** - The display name of the activity.

### Input

* **Key** - The API key used to provide you access to the IBM Watson Text Analysis tool. This field supports String variables.
* **Text** - The text that is to be analyzed. This field supports strings or String variables.
* **ServiceUrl** - The custom web address of the **local or regional IBM Watson instance** used to connect to the text analysis service. If the field remains empty at runtime, the default value for this field is "https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze". This field supports only strings and String variables.
* **Service Version** - The Natural Language Understanding service version that is to be used. The default value for this field is "2017-02-27". This field supports only strings and String variables.
* **Password** - The password used to login to the Natural Language Understanding service. This field supports only strings and String variables.
* **Username** - The username used to login to the Natural Language Understanding service. This field supports only strings and String variables.

### Misc

* **Private** - If selected, the values of variables and arguments are no longer logged at Verbose level.

### Options

* **AnalysisType** - Select the type of analysis to be performed on the specified text. The following types are available: **Categories**, **Concepts**, **Entities**, **Keywords**, and **Sentiment**. Depending on the analysis types selected, the output properties may differ.

### Output

* **Categories** - The category which the specified text belongs to, stored in a list of `<KeyValuePair<String,Double>>` variable. Each item in the list contains the category name and the categorization score.
  :::note
  For more info on the categories hierarchy, view the official IBM documentation [here](https://console.bluemix.net/docs/services/natural-language-understanding/categories.html#categories-hierarchy).
  :::
* **Concepts** - The concepts extracted from the specified text, stored in a list of `<KeyValuePair<String,Double>>` variables. Each item in the list contains the concept and the concept score.
* **Entities** - The entities extracted from the specified text, stored in a list of `IBMEntity` variables. The `IBMEntity` variable contains the following information for each entity:
  + **Type** - The type of the entity.
  + **Sentiment** - The sentiment score and label of the entity.
  + **Relevance** - The relevance of the entity in the specified text.
  + **Emotion** - The scores for all the defined emotions.
  + **Disambiguation** - Other concepts that are present in the specified text and are linked to the entity.
  + **Count** - The number of times the entity is mentioned in the specified text.

Here is an example of a `.json` text that shows the `IBMEntity` information and structure:

```
{  
         "type":"Location",
         "text":"Europe",
         "sentiment":{  
            "score":0.0,
            "label":"neutral"
         },
         "relevance":0.677612,
         "emotion":{  
            "sadness":0.336228,
            "joy":0.044658,
            "fear":0.075551,
            "disgust":0.355227,
            "anger":0.076605
         },
         "disambiguation":{  
            "subtype":[  
               "MusicalGroup",
               "BroadcastArtist",
               "FilmMusicContributor",
               "Lyricist",
               "MusicalArtist",
               "RecordProducer",
               "Continent"
            ],
            "name":"Europe",
            "dbpedia_resource":"http://dbpedia.org/resource/Europe"
         },
         "count":2
}
```

* **Error** - Extracts error messages sent by the IBM Watson NLU server, if any, stored in String variables.
* **Keywords** - The keywords extracted from the specified text, stored in an `IBMKeyword` variable. The `IBMKeyword` variable contains the following information for each keyword:
  + **Sentiment** - The sentiment score and label of the keyword.
  + **Relevance** - The relevance of the keyword in the specified text.
  + **Emotion** - The scores for all the defined emotions.

Here is an example of a `.json` text that shows the `IBMKeyword` information and structure:

```
{  
         "text":"Occidental",
         "sentiment":{  
            "score":0.0,
            "label":"neutral"
         },
         "relevance":0.377729,
         "emotion":{  
            "sadness":0.093656,
            "joy":0.56355,
            "fear":0.037183,
            "disgust":0.058567,
            "anger":0.23449
         }
 }
```

* **Language** - Extracts the language the given text is in and stores it in a String variable.
* **RawResult** - Enables you to extract the information from the specified text, in a .JSON format, as a String variable. The data obtained differs depending on the Analysis Type selected.
* **Sentiment** - The sentiment score and label extracted from the specified text, stored in a `KeyValuePair<Double,String>` variable.
