# Amazon Comprehend

**Supported Labeling Types**: `Row labeling`

We have simplified the process of connecting our system with the Amazon Comprehend model. If you already have data and training pipelines in Amazon Comprehend, you can utilize your trained model to enhance the performance.

To use the Amazon Comprehend model, follow these steps:

## Setup Datasaur ML Assisted Extension

{% hint style="info" %}
Please make sure you have access to our **ML-assisted labeling** extension with AWS Comprehend as a provider.
{% endhint %}

1. [Create a custom project](https://docs.datasaur.ai/data-studio-projects/creating-a-project) for row labeling.
2. Click the gear icon in the extension panel on the right to open the **Manage extensions** dialog.
3. From the **Manage extensions** dialog, enable the **ML-assisted labeling** extension.

<figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-c89f167e9699db04139021a65eb6f1f9b6277025%2FExtension%20-%20Manage%20extensions%20-%20ML-assisted%20Labeling%20(2).png?alt=media" alt=""><figcaption><p>Manage extensions dialog</p></figcaption></figure>

4. Once enabled, select **Amazon Comprehend** as the service provider.

<figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-0d992be763a7ea7de1caef7f294b90cd1cd64915%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20highlight.png?alt=media" alt="Image of ML Assisted with Amazon Comprehend"><figcaption><p>ML Assisted with Amazon Comprehend</p></figcaption></figure>

## Setup Role in AWS Identity and Access Management (IAM)

Before we start to create **Role** in the **IAM** page, please create these policies first for your permissions when creating a new **Role**.

1. Go to your **IAM** page, navigate to the **Policies** section, and then create a new policy.
2. You can download the examples below.

{% file src="<https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-625c6afe21328a2e13dc53cff0715c4abe7f9bf8%2Fcomprehend-policy%20(1).txt?alt=media&token=e26d36c1-7a26-4e54-b7c2-392c50ec3fcc>" %}

Now you can continue to create a new **Role** with the policy.

1. Go to the **IAM** page and navigate to the Roles section
2. Click on **Create Roles** then select **AWS account** as the role type and insert the **Account ID** and **External ID**. These values are automatically generated within the Datasaur **ML-assisted labeling** extension and can be copied and pasted into the AWS platform.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-31e41994b21db1b7d86a6eff2012e809a559ddfb%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20select%20trusted%20entity.png?alt=media" alt="Image of Select trusted entity Menu"><figcaption><p>Select trusted entity</p></figcaption></figure>
3. On the **Add permissions** step, search for the policy you created earlier and add it to the permissions.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-fbfe8261e280aabc06bddaaab6ba7a5df69dd0c4%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20add%20permissions.png?alt=media" alt="Image of Add permissions page"><figcaption><p>Add permissions</p></figcaption></figure>
4. Provide a role name and click **Create role.**

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-6f35c0bb229153c86b51270452a8387559243920%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20name%20review%20create.png?alt=media" alt="Image of Role Creation"><figcaption></figcaption></figure>
5. The role will be created successfully.
6. View your role and copy the Role ARN.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-0bf1f79347c131fe39a0f899aa7dfc3d0402b9d5%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20identity%20and%20access%20management.png?alt=media" alt="Image of Role Menu to copy Role ARN"><figcaption><p>Role ARN</p></figcaption></figure>
7. Paste this information into the **ML-Assisted labeling** extension.
8. Navigate to the Amazon Comprehend page and retrieve the Endpoint ARN. Copy the obtained Endpoint ARN and paste it into the extension.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-a3e60407cc85660da4ea959cb06a7010d2e3c25e%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20endpoint%20details.png?alt=media" alt="Image of Endpoint Details"><figcaption><p>Endpoint details</p></figcaption></figure>

## Start Prediction

Once you have configured the settings, click **Predict labels** to generate predictions from your model.

<figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-44227e7466ef09cfd7cd7845239f6c52d0c665d7%2FExtension%20-%20ML-assisted%20Labeling%20-%20Row%20labeling%20-%20Amazon%20Comprehend%20-%20project.png?alt=media" alt="Image of Prediction result"><figcaption><p>Prediction results</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datasaur.ai/assisted-labeling/ml-assisted-labeling/amazon-comprehend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
