

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Analisi in tempo reale tramite l'API
<a name="using-api-sync"></a>

Gli esempi seguenti mostrano come utilizzare l'API Amazon Comprehend per l'analisi in tempo reale, utilizzando e AWS SDKs per .NET, Java e Python. AWS CLI Usa gli esempi per conoscere le operazioni sincrone di Amazon Comprehend e come elementi costitutivi per le tue applicazioni.

Negli esempi di .NET riportati in questa sezione viene utilizzato [AWS SDK per .NET](https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/welcome.html). Puoi usarli [AWS Toolkit for Visual Studio](https://docs.aws.amazon.com/AWSToolkitVS/latest/UserGuide/welcome.html)per sviluppare AWS applicazioni usando.NET. Include modelli utili e AWS Explorer per la distribuzione di applicazioni e la gestione dei servizi. Per una prospettiva da sviluppatore.NET AWS, consulta la [AWS guida per gli sviluppatori.NET](https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/welcome.html). 

**Topics**
+ [Rilevare la lingua dominante](#get-started-api-dominant-language)
+ [Rilevamento di entità denominate](#get-started-api-entities)
+ [Rilevamento delle frasi chiave](#get-started-api-key-phrases)
+ [Determinare il sentimento](#get-started-api-sentiment)
+ [Analisi in tempo reale per un sentiment mirato](#get-started-api-targeted-sentiment)
+ [Rilevamento della sintassi](#get-started-api-syntax)
+ [Batch in tempo reale APIs](#get-started-batch)

## Rilevare la lingua dominante
<a name="get-started-api-dominant-language"></a>

Per determinare la lingua dominante utilizzata nel testo, utilizzare l'[DetectDominantLanguage](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectDominantLanguage.html)operazione. Per rilevare la lingua dominante in un massimo di 25 documenti in un batch, utilizzate l'[BatchDetectDominantLanguage](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectDominantLanguage.html)operazione. Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch).

**Topics**
+ [Usando il AWS Command Line Interface](#get-started-api-dominant-language-cli)
+ [Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET](#get-started-api-dominant-language-java)

### Usando il AWS Command Line Interface
<a name="get-started-api-dominant-language-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectDominantLanguage`operazione con. AWS CLI

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

```
aws comprehend detect-dominant-language \
    --region region \
    --text "It is raining today in Seattle."
```

Amazon Comprehend risponde con quanto segue:

```
{
    "Languages": [
        {
            "LanguageCode": "en",
            "Score": 0.9793661236763
        }
    ]
}
```

### Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET
<a name="get-started-api-dominant-language-java"></a>

Per esempi SDK su come determinare la lingua dominante, consulta. [Utilizzo `DetectDominantLanguage` con un AWS SDK o una CLI](example_comprehend_DetectDominantLanguage_section.md)

## Rilevamento di entità denominate
<a name="get-started-api-entities"></a>

Per determinare le entità denominate in un documento, utilizzate l'[DetectEntities](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectEntities.html)operazione. Per rilevare entità in un massimo di 25 documenti in un batch, utilizzate l'[BatchDetectEntities](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectEntities.html)operazione. Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch).

**Topics**
+ [Usando il AWS Command Line Interface](#get-started-api-entities-cli)
+ [Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET](#get-started-api-entities-java)

### Usando il AWS Command Line Interface
<a name="get-started-api-entities-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectEntities`operazione utilizzando. AWS CLIÈ necessario specificare la lingua del testo di input. 

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

```
aws comprehend detect-entities \
    --region region \
    --language-code "en" \
    --text "It is raining today in Seattle."
```

Amazon Comprehend risponde con quanto segue:

```
{
    "Entities": [
        {
            "Text": "today",
            "Score": 0.97,
            "Type": "DATE",
            "BeginOffset": 14,
            "EndOffset": 19
        },
        {
            "Text": "Seattle",
            "Score": 0.95,
            "Type": "LOCATION",
            "BeginOffset": 23,
            "EndOffset": 30
        }
    ],
    "LanguageCode": "en"
}
```

### Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET
<a name="get-started-api-entities-java"></a>

Per esempi SDK su come determinare la lingua dominante, consulta. [Utilizzo `DetectEntities` con un AWS SDK o una CLI](example_comprehend_DetectEntities_section.md)

## Rilevamento delle frasi chiave
<a name="get-started-api-key-phrases"></a>

Per determinare i sostantivi chiave usati nel testo, usate l'operazione. [DetectKeyPhrases](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectKeyPhrases.html) Per rilevare i sostantivi chiave in un massimo di 25 documenti in un batch, utilizzate l'operazione. [BatchDetectKeyPhrases](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectKeyPhrases.html) Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch).

**Topics**
+ [Usando il AWS Command Line Interface](#get-started-api-key-phrases-cli)
+ [Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET](#get-started-api-key-phrases-java)

### Usando il AWS Command Line Interface
<a name="get-started-api-key-phrases-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectKeyPhrases`operazione con. AWS CLIÈ necessario specificare la lingua del testo di input.

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

```
aws comprehend detect-key-phrases \
    --region region \
    --language-code "en" \
    --text "It is raining today in Seattle."
```

Amazon Comprehend risponde con quanto segue:

```
{
    "LanguageCode": "en",
    "KeyPhrases": [
        {
            "Text": "today",
            "Score": 0.89,
            "BeginOffset": 14,
            "EndOffset": 19
        },
        {
            "Text": "Seattle",
            "Score": 0.91,
            "BeginOffset": 23,
            "EndOffset": 30
        }
    ]
}
```

### Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET
<a name="get-started-api-key-phrases-java"></a>

Per esempi SDK che rilevano frasi chiave, consulta. [Utilizzo `DetectKeyPhrases` con un AWS SDK o una CLI](example_comprehend_DetectKeyPhrases_section.md)

## Determinare il sentimento
<a name="get-started-api-sentiment"></a>

Amazon Comprehend fornisce le seguenti operazioni API per l'analisi del sentiment:
+ [DetectSentiment](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectSentiment.html)— Determina il sentimento emotivo generale di un documento.
+  [BatchDetectSentiment](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectSentiment.html)— Determina il sentimento generale in un massimo di 25 documenti in batch. Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch)
+  [StartSentimentDetectionJob](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_StartSentimentDetectionJob.html)— Avvia un processo asincrono di rilevamento del sentiment per una raccolta di documenti.
+  [ListSentimentDetectionJobs](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_ListSentimentDetectionJobs.html)— Restituisce l'elenco dei lavori di rilevamento dei sentimenti che hai inviato.
+  [DescribeSentimentDetectionJob](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DescribeSentimentDetectionJob.html)— Ottiene le proprietà (incluso lo stato) associate al lavoro di rilevamento del sentiment specificato.
+  [StopSentimentDetectionJob](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_StopSentimentDetectionJob.html)— Interrompe il processo di sentiment in corso specificato.

**Topics**
+ [Usando il AWS Command Line Interface](#get-started-api-sentiment-cli)
+ [Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET](#get-started-api-sentiment-java)

### Usando il AWS Command Line Interface
<a name="get-started-api-sentiment-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectSentiment`operazione con. AWS CLI Questo esempio specifica la lingua del testo di input.

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

```
aws comprehend detect-sentiment \
    --region region \
    --language-code "en" \
    --text "It is raining today in Seattle."
```

 Amazon Comprehend risponde con quanto segue:

```
{
    "SentimentScore": {
        "Mixed": 0.014585512690246105,
        "Positive": 0.31592071056365967,
        "Neutral": 0.5985543131828308,
        "Negative": 0.07093945890665054
    },
    "Sentiment": "NEUTRAL",
    "LanguageCode": "en"
}
```

### Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET
<a name="get-started-api-sentiment-java"></a>

Per esempi SDK che determinano il sentimento del testo in ingresso, consulta. [Utilizzo `DetectSentiment` con un AWS SDK o una CLI](example_comprehend_DetectSentiment_section.md)

## Analisi in tempo reale per un sentiment mirato
<a name="get-started-api-targeted-sentiment"></a>

Amazon Comprehend fornisce le seguenti operazioni API per l'analisi mirata del sentiment in tempo reale:
+ [DetectTargetedSentiment](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectTargetedSentiment.html)— Analizza il sentiment delle entità menzionate in un documento.
+  [BatchDetectTargetedSentiment](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectTargetedSentiment.html)— Analizza il sentiment mirato per un massimo di 25 documenti in batch. Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch)

Se il testo che stai analizzando non include alcun sentimento mirato[Tipi di entità](how-targeted-sentiment.md#how-targeted-sentiment-entities), l'API restituisce un array Entities vuoto.

### Usando il AWS Command Line Interface
<a name="get-started-api-targeted-sentiment-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectTargetedSentiment`operazione con. AWS CLI Questo esempio specifica la lingua del testo di input.

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

```
aws comprehend detect-targeted-sentiment \
    --region region \
    --language-code "en" \
    --text "The burger was cooked perfectly but it was cold. The service was OK."
```

 Amazon Comprehend risponde con quanto segue:

```
{
"Entities": [
    {
      "DescriptiveMentionIndex": [
        0
      ],
      "Mentions": [
        {
          "BeginOffset": 4,
          "EndOffset": 10,
          "Score": 1,
          "GroupScore": 1,
          "Text": "burger",
          "Type": "OTHER",
          "MentionSentiment": {
            "Sentiment": "POSITIVE",
            "SentimentScore": {
              "Mixed": 0.001515,
              "Negative": 0.000822,
              "Neutral": 0.000243,
              "Positive": 0.99742
            }
          }
        },
        {
          "BeginOffset": 36,
          "EndOffset": 38,
          "Score": 0.999843,
          "GroupScore": 0.999661,
          "Text": "it",
          "Type": "OTHER",
          "MentionSentiment": {
            "Sentiment": "NEGATIVE",
            "SentimentScore": {
              "Mixed": 0,
              "Negative": 0.999996,
              "Neutral": 0.000004,
              "Positive": 0
            }
          }
        }
      ]
    },
    {
      "DescriptiveMentionIndex": [
        0
      ],
      "Mentions": [
        {
          "BeginOffset": 53,
          "EndOffset": 60,
          "Score": 1,
          "GroupScore": 1,
          "Text": "service",
          "Type": "ATTRIBUTE",
          "MentionSentiment": {
            "Sentiment": "NEUTRAL",
            "SentimentScore": {
              "Mixed": 0.000033,
              "Negative": 0.000089,
              "Neutral": 0.993325,
              "Positive": 0.006553
            }
          }
        }
      ]
    }
  ]
}
```

## Rilevamento della sintassi
<a name="get-started-api-syntax"></a>

Per analizzare il testo per estrarre le singole parole e determinare le parti del discorso per ogni parola, usa l'operazione. [DetectSyntax](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_DetectSyntax.html) Per analizzare la sintassi di un massimo di 25 documenti in un batch, utilizzate l'operazione. [BatchDetectSyntax](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectSyntax.html) Per ulteriori informazioni, consulta [Batch in tempo reale APIs](#get-started-batch).

**Topics**
+ [Usando il. AWS Command Line Interface](#get-started-api-syntax-cli)
+ [Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET](#get-started-api-syntax-java)

### Usando il. AWS Command Line Interface
<a name="get-started-api-syntax-cli"></a>

Nell'esempio seguente viene illustrato l'utilizzo dell'`DetectSyntax`operazione con. AWS CLI Questo esempio specifica la lingua del testo di input. 

L'esempio è formattato per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^). 

```
aws comprehend detect-syntax \
   --region region \
   --language-code "en" \
   --text "It is raining today in Seattle."
```

Amazon Comprehend risponde con quanto segue:

```
{
    "SyntaxTokens": [
        {
            "Text": "It",
            "EndOffset": 2,
            "BeginOffset": 0,
            "PartOfSpeech": {
                "Tag": "PRON",
                "Score": 0.8389829397201538
            },
            "TokenId": 1
        },
        {
            "Text": "is",
            "EndOffset": 5,
            "BeginOffset": 3,
            "PartOfSpeech": {
                "Tag": "AUX",
                "Score": 0.9189288020133972
            },
            "TokenId": 2
        },
        {
            "Text": "raining",
            "EndOffset": 13,
            "BeginOffset": 6,
            "PartOfSpeech": {
                "Tag": "VERB",
                "Score": 0.9977611303329468
            },
            "TokenId": 3
        },
        {
            "Text": "today",
            "EndOffset": 19,
            "BeginOffset": 14,
            "PartOfSpeech": {
                "Tag": "NOUN",
                "Score": 0.9993606209754944
            },
            "TokenId": 4
        },
        {
            "Text": "in",
            "EndOffset": 22,
            "BeginOffset": 20,
            "PartOfSpeech": {
                "Tag": "ADP",
                "Score": 0.9999061822891235
            },
            "TokenId": 5
        },
        {
            "Text": "Seattle",
            "EndOffset": 30,
            "BeginOffset": 23,
            "PartOfSpeech": {
                "Tag": "PROPN",
                "Score": 0.9940338730812073
            },
            "TokenId": 6
        },
        {
            "Text": ".",
            "EndOffset": 31,
            "BeginOffset": 30,
            "PartOfSpeech": {
                "Tag": "PUNCT",
                "Score": 0.9999997615814209
            },
            "TokenId": 7
        }
    ]
}
```

### Utilizzando l' AWS SDK per Java SDK per Python o SDK per .NET
<a name="get-started-api-syntax-java"></a>

Per esempi SDK che rilevano la sintassi del testo di input, consulta. [Utilizzo `DetectSyntax` con un AWS SDK o una CLI](example_comprehend_DetectSyntax_section.md)

## Batch in tempo reale APIs
<a name="get-started-batch"></a>

Per inviare batch composti da un massimo di 25 documenti, puoi utilizzare le operazioni batch in tempo reale di Amazon Comprehend. La chiamata di un'operazione batch è identica alla chiamata del singolo documento APIs per ogni documento della richiesta. L'utilizzo del batch APIs può migliorare le prestazioni delle applicazioni. Per ulteriori informazioni, consulta [Elaborazione sincrona di più documenti](concepts-processing-modes.md#how-batch).

**Topics**
+ [Elaborazione in batch con AWS CLI](#batch-cli)
+ [Elaborazione in batch con AWS SDK per .NET](#batch-csharp)

### Elaborazione in batch con AWS CLI
<a name="batch-cli"></a>

Questi esempi mostrano come utilizzare le operazioni dell'API batch utilizzando AWS Command Line Interface. Tutte le operazioni tranne `BatchDetectDominantLanguage` l'utilizzo del seguente file JSON `process.json` chiamato input. Per tale operazione l'`LanguageCode`entità non è inclusa.

Il terzo documento nel file JSON (`"$$$$$$$$"`) causerà un errore durante l'elaborazione in batch. È incluso in modo che le operazioni includano un [BatchItemError](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchItemError.html)nella risposta.

```
{
   "LanguageCode": "en",
   "TextList": [
      "I have been living in Seattle for almost 4 years",
      "It is raining today in Seattle",
      "$$$$$$$$"
   ]
}
```

Gli esempi sono formattati per Unix, Linux e macOS. Per Windows, sostituisci il carattere di continuazione UNIX barra rovesciata (\$1) al termine di ogni riga con un accento circonflesso (^).

**Topics**
+ [Rileva la lingua dominante usando un batch ()AWS CLI](#batch-dominant-language)
+ [Rileva le entità utilizzando un batch (AWS CLI)](#batch-entities)
+ [Rileva le frasi chiave usando un batch ()AWS CLI](#batch-key-phrase)
+ [Rileva il sentimento usando un batch ()AWS CLI](#batch-sentiment)

#### Rileva la lingua dominante usando un batch ()AWS CLI
<a name="batch-dominant-language"></a>

L'[BatchDetectDominantLanguage](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectDominantLanguage.html)operazione determina la lingua dominante di ogni documento in un batch. Per un elenco delle lingue che Amazon Comprehend è in grado di rilevare, consulta. [Lingua dominante](how-languages.md) Il AWS CLI comando seguente richiama l'`BatchDetectDominantLanguage`operazione.

```
aws comprehend batch-detect-dominant-language \
    --endpoint endpoint \
    --region region \
    --cli-input-json file://path to input file/process.json
```

Di seguito è riportata la risposta dell'`BatchDetectDominantLanguage`operazione:

```
{
    "ResultList": [
        {
          "Index": 0,
          "Languages":[
            {
              "LanguageCode":"en",
              "Score": 0.99
            }
          ]
        },
        {
          "Index": 1
          "Languages":[
            {
              "LanguageCode":"en",
              "Score": 0.82
            }
          ]
        }
    ],
    "ErrorList": [
      {
        "Index": 2,
        "ErrorCode": "InternalServerException",
        "ErrorMessage": "Unexpected Server Error. Please try again."
      }
    ]
}
```

#### Rileva le entità utilizzando un batch (AWS CLI)
<a name="batch-entities"></a>

Utilizzate l'[BatchDetectEntities](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectEntities.html)operazione per trovare le entità presenti in un batch di documenti. Per ulteriori informazioni sulle entità, consulta [Entità](how-entities.md). Il AWS CLI comando seguente richiama l'`BatchDetectEntities`operazione.

```
aws comprehend batch-detect-entities \
    --endpoint endpoint \
    --region region \
    --cli-input-json file://path to input file/process.json
```

#### Rileva le frasi chiave usando un batch ()AWS CLI
<a name="batch-key-phrase"></a>

L'[BatchDetectKeyPhrases](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectKeyPhrases.html)operazione restituisce le frasi nominali chiave in un batch di documenti. Il AWS CLI comando seguente richiama l'operazione. `BatchDetectKeyNounPhrases`

```
aws comprehend batch-detect-key-phrases
    --endpoint endpoint
    --region region
    --cli-input-json file://path to input file/process.json
```

#### Rileva il sentimento usando un batch ()AWS CLI
<a name="batch-sentiment"></a>

Rileva il sentimento generale di un batch di documenti utilizzando l'[BatchDetectSentiment](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectSentiment.html)operazione. Il AWS CLI comando seguente richiama l'`BatchDetectSentiment`operazione.

```
aws comprehend batch-detect-sentiment \
    --endpoint endpoint \
    --region region \
    --cli-input-json file://path to input file/process.json
```

### Elaborazione in batch con AWS SDK per .NET
<a name="batch-csharp"></a>

Il seguente programma di esempio mostra come utilizzare l'[BatchDetectEntities](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectEntities.html)operazione con SDK per .NET. La risposta del server contiene un [BatchDetectEntitiesItemResult](https://docs.aws.amazon.com/comprehend/latest/APIReference/API_BatchDetectEntitiesItemResult.html)oggetto per ogni documento che è stato elaborato correttamente. Se si verifica un errore nell'elaborazione di un documento, nella risposta verrà visualizzato un record nell'elenco degli errori. L'esempio recupera ogni documento con un errore e li invia nuovamente.

L'esempio.NET in questa sezione utilizza il [AWS SDK per .NET](https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/welcome.html). È possibile utilizzarli [AWS Toolkit for Visual Studio](https://docs.aws.amazon.com/AWSToolkitVS/latest/UserGuide/welcome.html)per sviluppare AWS applicazioni utilizzando .NET. Include modelli utili e AWS Explorer per la distribuzione di applicazioni e la gestione dei servizi. Per una prospettiva da sviluppatore.NET AWS, consulta la [AWS guida per gli sviluppatori.NET](https://docs.aws.amazon.com/sdk-for-net/latest/developer-guide/welcome.html). 

```
using System;
using System.Collections.Generic;
using Amazon.Comprehend;
using Amazon.Comprehend.Model;

namespace Comprehend
{
    class Program
    {
        // Helper method for printing properties
        static private void PrintEntity(Entity entity)
        {
            Console.WriteLine("     Text: {0}, Type: {1}, Score: {2}, BeginOffset: {3} EndOffset: {4}",
                entity.Text, entity.Type, entity.Score, entity.BeginOffset, entity.EndOffset);
        }

        static void Main(string[] args)
        {
            AmazonComprehendClient comprehendClient = new AmazonComprehendClient(Amazon.RegionEndpoint.USWest2);

            List<String> textList = new List<String>()
            {
                { "I love Seattle" },
                { "Today is Sunday" },
                { "Tomorrow is Monday" },
                { "I love Seattle" }
            };

            // Call detectEntities API
            Console.WriteLine("Calling BatchDetectEntities");
            BatchDetectEntitiesRequest batchDetectEntitiesRequest = new BatchDetectEntitiesRequest()
            {
                TextList = textList,
                LanguageCode = "en"
            };
            BatchDetectEntitiesResponse batchDetectEntitiesResponse = comprehendClient.BatchDetectEntities(batchDetectEntitiesRequest);

            foreach (BatchDetectEntitiesItemResult item in batchDetectEntitiesResponse.ResultList)
            {
                Console.WriteLine("Entities in {0}:", textList[item.Index]);
                foreach (Entity entity in item.Entities)
                    PrintEntity(entity);
            }

            // check if we need to retry failed requests
            if (batchDetectEntitiesResponse.ErrorList.Count != 0)
            {
                Console.WriteLine("Retrying Failed Requests");
                List<String> textToRetry = new List<String>();
                foreach(BatchItemError errorItem in batchDetectEntitiesResponse.ErrorList)
                    textToRetry.Add(textList[errorItem.Index]);

                batchDetectEntitiesRequest = new BatchDetectEntitiesRequest()
                {
                    TextList = textToRetry,
                    LanguageCode = "en"
                };

                batchDetectEntitiesResponse = comprehendClient.BatchDetectEntities(batchDetectEntitiesRequest);

                foreach(BatchDetectEntitiesItemResult item in batchDetectEntitiesResponse.ResultList)
                {
                    Console.WriteLine("Entities in {0}:", textList[item.Index]);
                    foreach (Entity entity in item.Entities)
                        PrintEntity(entity);
                }
            }
            Console.WriteLine("End of DetectEntities");
        }
    }
}
```