Skip to content

Commit

Permalink
[TA] Update documentation, samples, links, code (#28612)
Browse files Browse the repository at this point in the history
  • Loading branch information
maririos authored and paterasMSFT committed Jun 14, 2022
1 parent ef4f211 commit 1af248e
Show file tree
Hide file tree
Showing 75 changed files with 322 additions and 374 deletions.
1 change: 1 addition & 0 deletions sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- In `AnalyzeHealthcareEntitiesOperation`, `Cancel` calls won't overwrite the response from `GetRawResponse` anymore. PR [28375](https://github.com/Azure/azure-sdk-for-net/pull/28375)

### Other Changes
This is the first version of the client library that targets the Azure Cognitive Service for Language APIs which includes the existing text analysis and natural language processing features found in the Text Analytics client library. In addition, the service API has changed from semantic to date-based versioning. This version of the client library defaults to the latest supported API version, which currently is `2022-04-01-preview`.

## 5.1.1 (2021-11-19)
### Breaking changes
Expand Down
189 changes: 66 additions & 123 deletions sdk/textanalytics/Azure.AI.TextAnalytics/README.md

Large diffs are not rendered by default.

26 changes: 15 additions & 11 deletions sdk/textanalytics/Azure.AI.TextAnalytics/samples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,30 @@ description: Samples for the Azure.AI.TextAnalytics client library
---

# Azure Text Analytics client SDK Samples
Azure Cognitive Services Text Analytics is a cloud service that provides advanced natural language processing over raw text, and includes the following main features:
* Language Detection
* Sentiment Analysis
* Key Phrase Extraction
* Entity Recognition (Named, Linked, and Personally Identifiable Information (PII) entities)
* Healthcare Recognition
* Extractive Text Summarization
* Custom Entity Recognition
* Custom Single and Multi Category Classification
Azure Cognitive Services Text Analytics is one of the three services that are part of the Azure Cognitive Service for Language. This client library includes the following main features:

* Extract Information: Use Natural Language Understanding (NLU) to extract information from unstructured text. For example:
* Key Phrase Extraction
* Entity Recognition (Named, Linked, and Personally Identifiable Information (PII) entities)
* Healthcare Entities Recognition
* Extractive Text Summarization
* Custom Named Entity Recognition
* Classify Text: Use NLU to detect the language, analyze sentiment, or classify the text you have
* Language Detection
* Sentiment Analysis
* Custom Text Classification


## Common scenarios samples
- [Detect Language](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample1_DetectLanguage.md)
- [Analyze Sentiment](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample2_AnalyzeSentiment.md)
- [Extract Key Phrases](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample3_ExtractKeyPhrases.md)
- [Recognize Entities](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample4_RecognizeEntities.md)
- [Recognize Named Entities](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample4_RecognizeEntities.md)
- [Recognize PII Entities](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample5_RecognizePiiEntities.md)
- [Recognize Linked Entities](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample6_RecognizeLinkedEntities.md)
- [Analyze Healthcare Entities](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample7_AnalyzeHealthcareEntities.md)
- [Perform Extractive Text Summarization](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample8_ExtractSummary.md)
- [Custom Entity Recognition](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample9_RecognizeCustomEntities.md)
- [Custom Named Entity Recognition](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample9_RecognizeCustomEntities.md)
- [Custom Single Category Classification](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample10_SingleCategoryClassify.md)
- [Custom Multi Category Classification](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample11_MultiCategoryClassify.md)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Perform Custom Single Category Classification on Documents
This sample demonstrates how to run a single category classification action in one or more documents. In order to use this feature, you need to train a model with your own data. For more information on how to do the training, see [train model][train_model].

To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient` to perform a single category classify on a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient` to perform a single category classify on a document, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Perform Custom Multiple Category Classification in Documents
This sample demonstrates how to run a Multi Category Classification action in one or more documents. In order to use this feature, you need to train a model with your own data. For more information on how to do the training, see [train model][train_model].

To get started you will need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient` to perform a custom multi category classification on a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient` to perform a custom multi category classification on a document, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Detecting the Language of Documents

This sample demonstrates how to detect the language that one or more documents are written in. To get started you'll need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.
This sample demonstrates how to detect the language that one or more documents are written in.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient` to detect the language a document is written in, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient` to detect the language a document is written in, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down Expand Up @@ -80,7 +80,7 @@ Response<DetectLanguageResultCollection> response = client.DetectLanguageBatch(d
DetectLanguageResultCollection documentsLanguage = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Detect Language\" Model, version: \"{documentsLanguage.ModelVersion}\"");
Console.WriteLine($"Results of \"Detect Language\" Model, version: \"{documentsLanguage.ModelVersion}\"");
Console.WriteLine("");

foreach (DetectLanguageResult documentLanguage in documentsLanguage)
Expand Down Expand Up @@ -153,7 +153,7 @@ Response<DetectLanguageResultCollection> response = client.DetectLanguageBatch(d
DetectLanguageResultCollection documentsLanguage = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Detect Language\" Model, version: \"{documentsLanguage.ModelVersion}\"");
Console.WriteLine($"Results of \"Detect Language\" Model, version: \"{documentsLanguage.ModelVersion}\"");
Console.WriteLine("");

foreach (DetectLanguageResult documentLanguage in documentsLanguage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ This sample demonstrates how to analyze sentiment of documents and get more gran
For example, if a customer leaves feedback about a hotel such as "The room was great, but the staff was unfriendly.", Opinion Mining will locate targets in the text, and their associated opinion and sentiments. Sentiment Analysis might only report a negative sentiment.

For the purpose of the sample, we will be the administrator of a hotel and we've set a system to look at the online reviews customers are posting to identify the major complaints about our hotel.
In order to do so, we will use the Sentiment Analysis feature of the Text Analytics client library. To get started you'll need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.
In order to do so, we will use the Sentiment Analysis feature of the Text Analytics client library.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient`, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient`, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Analyzing the Sentiment of Documents

This sample demonstrates how to analyze the sentiment in one or more documents. To get started you'll need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.
This sample demonstrates how to analyze the sentiment in one or more documents.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient` to analyze the sentiment in a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient` to analyze the sentiment in a document, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down Expand Up @@ -77,7 +77,7 @@ Response<AnalyzeSentimentResultCollection> response = client.AnalyzeSentimentBat
AnalyzeSentimentResultCollection sentimentPerDocuments = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: \"{sentimentPerDocuments.ModelVersion}\"");
Console.WriteLine($"Results of \"Sentiment Analysis\" Model, version: \"{sentimentPerDocuments.ModelVersion}\"");
Console.WriteLine("");

foreach (AnalyzeSentimentResult sentimentInDocument in sentimentPerDocuments)
Expand Down Expand Up @@ -158,7 +158,7 @@ Response<AnalyzeSentimentResultCollection> response = client.AnalyzeSentimentBat
AnalyzeSentimentResultCollection sentimentPerDocuments = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Sentiment Analysis\" Model, version: \"{sentimentPerDocuments.ModelVersion}\"");
Console.WriteLine($"Results of \"Sentiment Analysis\" Model, version: \"{sentimentPerDocuments.ModelVersion}\"");
Console.WriteLine("");

foreach (AnalyzeSentimentResult sentimentInDocument in sentimentPerDocuments)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Extracting Key Phrases from Documents

This sample demonstrates how to extract key phrases from one or more documents. To get started you'll need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.
This sample demonstrates how to extract key phrases from one or more documents.

## Creating a `TextAnalyticsClient`

To create a new `TextAnalyticsClient` to extract key phrases from a document, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
To create a new `TextAnalyticsClient` to extract key phrases from a document, you need a Cognitive Services or Language service endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client. See [README][README] for links and instructions.

You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.

Expand Down Expand Up @@ -79,7 +79,7 @@ Response<ExtractKeyPhrasesResultCollection> response = client.ExtractKeyPhrasesB
ExtractKeyPhrasesResultCollection keyPhrasesInDocuments = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Extract Key Phrases\" Model, version: \"{keyPhrasesInDocuments.ModelVersion}\"");
Console.WriteLine($"Results of \"Extract Key Phrases\" Model, version: \"{keyPhrasesInDocuments.ModelVersion}\"");
Console.WriteLine("");

foreach (ExtractKeyPhrasesResult keyPhrases in keyPhrasesInDocuments)
Expand Down Expand Up @@ -149,7 +149,7 @@ Response<ExtractKeyPhrasesResultCollection> response = client.ExtractKeyPhrasesB
ExtractKeyPhrasesResultCollection keyPhrasesInDocuments = response.Value;

int i = 0;
Console.WriteLine($"Results of Azure Text Analytics \"Extract Key Phrases\" Model, version: \"{keyPhrasesInDocuments.ModelVersion}\"");
Console.WriteLine($"Results of \"Extract Key Phrases\" Model, version: \"{keyPhrasesInDocuments.ModelVersion}\"");
Console.WriteLine("");

foreach (ExtractKeyPhrasesResult keyPhrases in keyPhrasesInDocuments)
Expand Down
Loading

0 comments on commit 1af248e

Please sign in to comment.