diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/README.md b/sdk/textanalytics/Azure.AI.TextAnalytics/README.md index ffe44ec7862d3..52fdd1668bbb1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/README.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/README.md @@ -485,16 +485,29 @@ Text Analytics for health is a containerized service that extracts and labels re 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, key phrase extraction, and Personally Identifiable Information (PII) Recognition. For more information see [How to: Use Text Analytics for analyze operation][analyze_operation_howto]. ```C# Snippet:AnalyzeOperationBatchConvenience - string document = @"We went to Contoso Steakhouse located at midtown NYC last week for a dinner party, - and we adore the spot! They provide marvelous food and they have a great menu. The - chief cook happens to be the owner (I think his name is John Doe) and he is super - nice, coming out of the kitchen and greeted us all. We enjoyed very much dining in - the place! The Sirloin steak I ordered was tender and juicy, and the place was impeccably - clean. You can even pre-order from their online menu at www.contososteakhouse.com, - call 312-555-0176 or send email to order@contososteakhouse.com! The only complaint - I have is the food didn't come fast enough. Overall I highly recommend it!"; - - var batchDocuments = new List { document }; + string documentA = @"We love this trail and make the trip every year. The views are breathtaking and well + worth the hike! Yesterday was foggy though, so we missed the spectacular views. + We tried again today and it was amazing. Everyone in my family liked the trail although + it was too challenging for the less athletic among us. + Not necessarily recommended for small children. + A hotel close to the trail offers services for childcare in case you want that."; + + string documentB = @"Last week we stayed at Hotel Foo to celebrate our anniversary. The staff knew about + our anniversary so they helped me organize a little surprise for my partner. + The room was clean and with the decoration I requested. It was perfect!"; + + string documentC = @"That was the best day of my life! We went on a 4 day trip where we stayed at Hotel Foo. + They had great amenities that included an indoor pool, a spa, and a bar. + The spa offered couples massages which were really good. + The spa was clean and felt very peaceful. Overall the whole experience was great. + We will definitely come back."; + + var batchDocuments = new List + { + documentA, + documentB, + documentC + }; TextAnalyticsActions batchActions = new TextAnalyticsActions() { @@ -506,7 +519,13 @@ The Analyze functionality allows to choose which of the supported Text Analytics AnalyzeBatchActionsOperation operation = client.StartAnalyzeBatchActions(batchDocuments, batchActions); - await operation.WaitForCompletionAsync(); + TimeSpan pollingInterval = new TimeSpan(1000); + + while (!operation.HasCompleted) + { + Thread.Sleep(pollingInterval); + operation.UpdateStatus(); + } foreach (AnalyzeBatchActionsResult documentsInPage in operation.GetValues()) { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md index 118032fffbcf8..ebabc821f2e21 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample_AnalyzeBatchActions.md @@ -52,7 +52,13 @@ To run analyze operation in multiple documents, call `StartAnalyzeOperationBatch AnalyzeBatchActionsOperation operation = client.StartAnalyzeBatchActions(batchDocuments, batchActions); - await operation.WaitForCompletionAsync(); + TimeSpan pollingInterval = new TimeSpan(1000); + + while (!operation.HasCompleted) + { + Thread.Sleep(pollingInterval); + operation.UpdateStatus(); + } foreach (AnalyzeBatchActionsResult documentsInPage in operation.GetValues()) {