Skip to content

Commit 867e419

Browse files
authored
[TA] Modify wording on samples (Azure#19243)
1 parent dea3117 commit 867e419

File tree

7 files changed

+272
-187
lines changed

7 files changed

+272
-187
lines changed

sdk/textanalytics/Azure.AI.TextAnalytics/README.md

Lines changed: 47 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Azure Cognitive Services Text Analytics is a cloud service that provides advance
77
* Personally Identifiable Information (PII) Recognition
88
* Linked Entity Recognition
99
* Healthcare Recognition <sup>beta</sup>
10-
* Analyze Operation <sup>beta</sup>
10+
* Running multiple actions in one or more documents <sup>beta</sup>
1111

1212
[Source code][textanalytics_client_src] | [Package (NuGet)][textanalytics_nuget_package] | [API reference documentation][textanalytics_refdocs] | [Product documentation][textanalytics_docs] | [Samples][textanalytics_samples]
1313

@@ -151,7 +151,7 @@ The following section provides several code snippets using the `client` [created
151151
* [Detect Language Asynchronously](#detect-language-asynchronously)
152152
* [Recognize Entities Asyncronously](#recognize-entities-asynchronously)
153153
* [Recognize Healthcare Entities Asyncronously](#recognize-healthcare-entities-asynchronously)
154-
* [Run Analyze Operation Asyncronously](#run-analyze-operation-asynchronously)
154+
* [Run multiple actions Asyncronously](#run-multiple-actions-asynchronously)
155155

156156
### Detect Language
157157
Run a Text Analytics predictive model to determine the language that the passed-in document or batch of documents are written in.
@@ -493,8 +493,8 @@ Text Analytics for health is a containerized service that extracts and labels re
493493
}
494494
```
495495

496-
### Run Analyze Operation Asynchronously
497-
The Analyze functionality allows to choose which of the supported Text Analytics features to execute in the same set of documents. Currently the supported features are: entity recognition, linked entity recognition, key phrase extraction, and Personally Identifiable Information (PII) Recognition. For more information see [How to: Use Text Analytics for analyze operation][analyze_operation_howto].
496+
### Run multiple actions Asynchronously
497+
This functionality allows running multiple actions in one or more documents. Actions include entity recognition, linked entity recognition, key phrase extraction, and Personally Identifiable Information (PII) Recognition. For more information see [Using analyze][analyze_operation_howto].
498498

499499
```C# Snippet:AnalyzeOperationBatchConvenienceAsync
500500
string documentA = @"We love this trail and make the trip every year. The views are breathtaking and well
@@ -521,7 +521,7 @@ The Analyze functionality allows to choose which of the supported Text Analytics
521521
documentC
522522
};
523523

524-
TextAnalyticsActions batchActions = new TextAnalyticsActions()
524+
TextAnalyticsActions actions = new TextAnalyticsActions()
525525
{
526526
ExtractKeyPhrasesOptions = new List<ExtractKeyPhrasesOptions>() { new ExtractKeyPhrasesOptions() },
527527
RecognizeEntitiesOptions = new List<RecognizeEntitiesOptions>() { new RecognizeEntitiesOptions() },
@@ -530,10 +530,21 @@ The Analyze functionality allows to choose which of the supported Text Analytics
530530
DisplayName = "AnalyzeOperationSample"
531531
};
532532

533-
AnalyzeBatchActionsOperation operation = await client.StartAnalyzeBatchActionsAsync(batchDocuments, batchActions);
533+
AnalyzeBatchActionsOperation operation = await client.StartAnalyzeBatchActionsAsync(batchDocuments, actions);
534534

535535
await operation.WaitForCompletionAsync();
536536

537+
Console.WriteLine($"Status: {operation.Status}");
538+
Console.WriteLine($"Created On: {operation.CreatedOn}");
539+
Console.WriteLine($"Expires On: {operation.ExpiresOn}");
540+
Console.WriteLine($"Last modified: {operation.LastModified}");
541+
if (!string.IsNullOrEmpty(operation.DisplayName))
542+
Console.WriteLine($"Display name: {operation.DisplayName}");
543+
Console.WriteLine($"Total actions: {operation.TotalActions}");
544+
Console.WriteLine($" Succeeded actions: {operation.ActionsSucceeded}");
545+
Console.WriteLine($" Failed actions: {operation.ActionsFailed}");
546+
Console.WriteLine($" In progress actions: {operation.ActionsInProgress}");
547+
537548
await foreach (AnalyzeBatchActionsResult documentsInPage in operation.Value)
538549
{
539550
RecognizeEntitiesResultCollection entitiesResult = documentsInPage.RecognizeEntitiesActionsResults.FirstOrDefault().Result;
@@ -542,21 +553,22 @@ The Analyze functionality allows to choose which of the supported Text Analytics
542553

543554
RecognizePiiEntitiesResultCollection piiResult = documentsInPage.RecognizePiiEntitiesActionsResults.FirstOrDefault().Result;
544555

545-
RecognizeLinkedEntitiesResultCollection elResult = documentsInPage.RecognizeLinkedEntitiesActionsResults.FirstOrDefault().Result;
556+
RecognizeLinkedEntitiesResultCollection linkedEntitiesResult = documentsInPage.RecognizeLinkedEntitiesActionsResults.FirstOrDefault().Result;
546557

547558
Console.WriteLine("Recognized Entities");
548559

549560
foreach (RecognizeEntitiesResult result in entitiesResult)
550561
{
551-
Console.WriteLine($" Recognized the following {result.Entities.Count} entities:");
562+
Console.WriteLine($" Recognized the following {result.Entities.Count} entities:");
552563

553564
foreach (CategorizedEntity entity in result.Entities)
554565
{
555-
Console.WriteLine($" Entity: {entity.Text}");
556-
Console.WriteLine($" Category: {entity.Category}");
557-
Console.WriteLine($" Offset: {entity.Offset}");
558-
Console.WriteLine($" ConfidenceScore: {entity.ConfidenceScore}");
559-
Console.WriteLine($" SubCategory: {entity.SubCategory}");
566+
Console.WriteLine($" Entity: {entity.Text}");
567+
Console.WriteLine($" Category: {entity.Category}");
568+
Console.WriteLine($" Offset: {entity.Offset}");
569+
Console.WriteLine($" Length: {entity.Length}");
570+
Console.WriteLine($" ConfidenceScore: {entity.ConfidenceScore}");
571+
Console.WriteLine($" SubCategory: {entity.SubCategory}");
560572
}
561573
Console.WriteLine("");
562574
}
@@ -565,15 +577,16 @@ The Analyze functionality allows to choose which of the supported Text Analytics
565577

566578
foreach (RecognizePiiEntitiesResult result in piiResult)
567579
{
568-
Console.WriteLine($" Recognized the following {result.Entities.Count} PII entities:");
580+
Console.WriteLine($" Recognized the following {result.Entities.Count} PII entities:");
569581

570582
foreach (PiiEntity entity in result.Entities)
571583
{
572-
Console.WriteLine($" Entity: {entity.Text}");
573-
Console.WriteLine($" Category: {entity.Category}");
574-
Console.WriteLine($" Offset: {entity.Offset}");
575-
Console.WriteLine($" ConfidenceScore: {entity.ConfidenceScore}");
576-
Console.WriteLine($" SubCategory: {entity.SubCategory}");
584+
Console.WriteLine($" Entity: {entity.Text}");
585+
Console.WriteLine($" Category: {entity.Category}");
586+
Console.WriteLine($" Offset: {entity.Offset}");
587+
Console.WriteLine($" Length: {entity.Length}");
588+
Console.WriteLine($" ConfidenceScore: {entity.ConfidenceScore}");
589+
Console.WriteLine($" SubCategory: {entity.SubCategory}");
577590
}
578591
Console.WriteLine("");
579592
}
@@ -582,36 +595,36 @@ The Analyze functionality allows to choose which of the supported Text Analytics
582595

583596
foreach (ExtractKeyPhrasesResult result in keyPhrasesResult)
584597
{
585-
Console.WriteLine($" Recognized the following {result.KeyPhrases.Count} Keyphrases:");
598+
Console.WriteLine($" Recognized the following {result.KeyPhrases.Count} Keyphrases:");
586599

587600
foreach (string keyphrase in result.KeyPhrases)
588601
{
589-
Console.WriteLine($" {keyphrase}");
602+
Console.WriteLine($" {keyphrase}");
590603
}
591604
Console.WriteLine("");
592605
}
593606

594607
Console.WriteLine("Recognized Linked Entities");
595608

596-
foreach (RecognizeLinkedEntitiesResult result in elResult)
609+
foreach (RecognizeLinkedEntitiesResult result in linkedEntitiesResult)
597610
{
598-
Console.WriteLine($" Recognized the following {result.Entities.Count} linked entities:");
611+
Console.WriteLine($" Recognized the following {result.Entities.Count} linked entities:");
599612

600613
foreach (LinkedEntity entity in result.Entities)
601614
{
602-
Console.WriteLine($" Entity: {entity.Name}");
603-
Console.WriteLine($" DataSource: {entity.DataSource}");
604-
Console.WriteLine($" DataSource EntityId: {entity.DataSourceEntityId}");
605-
Console.WriteLine($" Language: {entity.Language}");
606-
Console.WriteLine($" DataSource Url: {entity.Url}");
615+
Console.WriteLine($" Entity: {entity.Name}");
616+
Console.WriteLine($" DataSource: {entity.DataSource}");
617+
Console.WriteLine($" DataSource EntityId: {entity.DataSourceEntityId}");
618+
Console.WriteLine($" Language: {entity.Language}");
619+
Console.WriteLine($" DataSource Url: {entity.Url}");
607620

608-
Console.WriteLine($" Total Matches: {entity.Matches.Count()}");
621+
Console.WriteLine($" Total Matches: {entity.Matches.Count()}");
609622
foreach (LinkedEntityMatch match in entity.Matches)
610623
{
611-
Console.WriteLine($" Match Text: {match.Text}");
612-
Console.WriteLine($" ConfidenceScore: {match.ConfidenceScore}");
613-
Console.WriteLine($" Offset: {match.Offset}");
614-
Console.WriteLine($" Length: {match.Length}");
624+
Console.WriteLine($" Match Text: {match.Text}");
625+
Console.WriteLine($" ConfidenceScore: {match.ConfidenceScore}");
626+
Console.WriteLine($" Offset: {match.Offset}");
627+
Console.WriteLine($" Length: {match.Length}");
615628
}
616629
Console.WriteLine("");
617630
}
@@ -714,7 +727,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
714727

715728
[recognize_healthcare_sample]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_RecognizeHealthcareEntities.md
716729
[analyze_operation_sample]: https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md
717-
[analyze_operation_howto]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-call-api?tabs=analyze
730+
[analyze_operation_howto]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-how-to-call-api?tabs=synchronous#using-the-api-asynchronously
718731
[healthcare]: https://docs.microsoft.com/azure/cognitive-services/text-analytics/how-tos/text-analytics-for-health?tabs=ner
719732
[language_detection]: https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-language-detection
720733
[sentiment_analysis]: https://docs.microsoft.com/azure/cognitive-services/Text-Analytics/how-tos/text-analytics-how-to-sentiment-analysis

sdk/textanalytics/Azure.AI.TextAnalytics/samples/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Azure Cognitive Services Text Analytics is a cloud service that provides advance
2929

3030
## Advanced samples
3131
- [Analyze Sentiment with Opinion Mining](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample2.1_AnalyzeSentimentWithOpinionMining.md)
32+
- [Running multiple actions in one or more documents](https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md)
3233
- [Mock client](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_MockClient.md)
3334

3435
[README]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/textanalytics/Azure.AI.TextAnalytics/README.md

0 commit comments

Comments
 (0)