Skip to content

Commit 0825bb8

Browse files
authored
Merge pull request #107199 from thediris/dotnet_quickstart_update
[Cog Svcs] Update Text Analytics C# Quickstarts with preview.3
2 parents f622bc5 + 584ff30 commit 0825bb8

File tree

1 file changed

+25
-25
lines changed
  • articles/cognitive-services/text-analytics/includes/quickstarts

1 file changed

+25
-25
lines changed

articles/cognitive-services/text-analytics/includes/quickstarts/csharp-sdk.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ static void SentimentAnalysisExample(TextAnalyticsClient client)
165165
var si = new StringInfo(inputText);
166166
foreach (var sentence in documentSentiment.Sentences)
167167
{
168-
Console.WriteLine($"\tSentence [offset {sentence.Offset}, length {sentence.Length}]");
169-
Console.WriteLine($"\tText: \"{si.SubstringByTextElements(sentence.Offset, sentence.Length)}\"");
168+
Console.WriteLine($"\tSentence [length {sentence.GraphemeLength}]");
169+
Console.WriteLine($"\tText: \"{si.SubstringByTextElements(sentence.GraphemeOffset, sentence.GraphemeLength)}\"");
170170
Console.WriteLine($"\tSentence sentiment: {sentence.Sentiment}");
171-
Console.WriteLine($"\tPositive score: {sentence.SentimentScores.Positive:0.00}");
172-
Console.WriteLine($"\tNegative score: {sentence.SentimentScores.Negative:0.00}");
173-
Console.WriteLine($"\tNeutral score: {sentence.SentimentScores.Neutral:0.00}\n");
171+
Console.WriteLine($"\tPositive score: {sentence.ConfidenceScores.Positive:0.00}");
172+
Console.WriteLine($"\tNegative score: {sentence.ConfidenceScores.Negative:0.00}");
173+
Console.WriteLine($"\tNeutral score: {sentence.ConfidenceScores.Neutral:0.00}\n");
174174
}
175175
}
176176
```
@@ -180,14 +180,14 @@ static void SentimentAnalysisExample(TextAnalyticsClient client)
180180
```console
181181
Document sentiment: Positive
182182

183-
Sentence [offset 0, length 30]
183+
Sentence [length 30]
184184
Text: "I had the best day of my life."
185185
Sentence sentiment: Positive
186186
Positive score: 1.00
187187
Negative score: 0.00
188188
Neutral score: 0.00
189189

190-
Sentence [offset 31, length 30]
190+
Sentence [length 30]
191191
Text: "I wish you were there with me."
192192
Sentence sentiment: Neutral
193193
Positive score: 0.21
@@ -270,10 +270,10 @@ static void EntityRecognitionExample(TextAnalyticsClient client)
270270
{
271271
var response = client.RecognizeEntities("I had a wonderful trip to Seattle last week.");
272272
Console.WriteLine("Named Entities:");
273-
foreach(var entity in response.Value)
273+
foreach (var entity in response.Value)
274274
{
275275
Console.WriteLine($"\tText: {entity.Text},\tCategory: {entity.Category},\tSub-Category: {entity.SubCategory}");
276-
Console.WriteLine($"\t\tOffset: {entity.Offset},\tLength: {entity.Length},\tScore: {entity.Score:F3}\n");
276+
Console.WriteLine($"\t\tLength: {entity.GraphemeLength},\tScore: {entity.ConfidenceScore:F2}\n");
277277
}
278278
}
279279
```
@@ -283,10 +283,10 @@ static void EntityRecognitionExample(TextAnalyticsClient client)
283283
```console
284284
Named Entities:
285285
Text: Seattle, Category: Location, Sub-Category: GPE
286-
Offset: 26, Length: 7, Score: 0.920
286+
Length: 7, Score: 0.92
287287

288288
Text: last week, Category: DateTime, Sub-Category: DateRange
289-
Offset: 34, Length: 9, Score: 0.800
289+
Length: 9, Score: 0.80
290290
```
291291

292292
## Detect personal information
@@ -299,10 +299,10 @@ static void EntityPIIExample(TextAnalyticsClient client)
299299
string inputText = "Insurance policy for SSN on file 123-12-1234 is here by approved.";
300300
var response = client.RecognizePiiEntities(inputText);
301301
Console.WriteLine("Personally Identifiable Information Entities:");
302-
foreach(var entity in response.Value)
302+
foreach (var entity in response.Value)
303303
{
304304
Console.WriteLine($"\tText: {entity.Text},\tCategory: {entity.Category},\tSub-Category: {entity.SubCategory}");
305-
Console.WriteLine($"\t\tOffset: {entity.Offset},\tLength: {entity.Length},\tScore: {entity.Score:F3}\n");
305+
Console.WriteLine($"\t\tLength: {entity.GraphemeLength},\tScore: {entity.ConfidenceScore:F2}\n");
306306
}
307307
}
308308
```
@@ -311,8 +311,8 @@ static void EntityPIIExample(TextAnalyticsClient client)
311311

312312
```console
313313
Personally Identifiable Information Entities:
314-
Text: 123-12-1234, Category: U.S. Social Security Number (SSN), Sub-Category: None
315-
Offset: 33, Length: 11, Score: 0.850
314+
Text: 123-12-1234, Category: U.S. Social Security Number (SSN), Sub-Category:
315+
Length: 11, Score: 0.85
316316
```
317317

318318

@@ -332,12 +332,12 @@ static void EntityLinkingExample(TextAnalyticsClient client)
332332
Console.WriteLine("Linked Entities:");
333333
foreach (var entity in response.Value)
334334
{
335-
Console.WriteLine($"\tName: {entity.Name},\tID: {entity.Id},\tURL: {entity.Url}\tData Source: {entity.DataSource}");
335+
Console.WriteLine($"\tName: {entity.Name},\tID: {entity.DataSourceEntityId},\tURL: {entity.Url}\tData Source: {entity.DataSource}");
336336
Console.WriteLine("\tMatches:");
337337
foreach (var match in entity.Matches)
338338
{
339339
Console.WriteLine($"\t\tText: {match.Text}");
340-
Console.WriteLine($"\t\tOffset: {match.Offset},\tLength: {match.Length},\tScore: {match.Score:F3}\n");
340+
Console.WriteLine($"\t\tLength: {match.GraphemeLength},\tScore: {match.ConfidenceScore:F2}\n");
341341
}
342342
}
343343
}
@@ -350,38 +350,38 @@ Linked Entities:
350350
Name: Altair 8800, ID: Altair 8800, URL: https://en.wikipedia.org/wiki/Altair_8800 Data Source: Wikipedia
351351
Matches:
352352
Text: Altair 8800
353-
Offset: 116, Length: 11, Score: 0.777
353+
Length: 11, Score: 0.78
354354

355355
Name: Bill Gates, ID: Bill Gates, URL: https://en.wikipedia.org/wiki/Bill_Gates Data Source: Wikipedia
356356
Matches:
357357
Text: Bill Gates
358-
Offset: 25, Length: 10, Score: 0.555
358+
Length: 10, Score: 0.55
359359

360360
Text: Gates
361-
Offset: 161, Length: 5, Score: 0.555
361+
Length: 5, Score: 0.55
362362

363363
Name: Paul Allen, ID: Paul Allen, URL: https://en.wikipedia.org/wiki/Paul_Allen Data Source: Wikipedia
364364
Matches:
365365
Text: Paul Allen
366-
Offset: 40, Length: 10, Score: 0.533
366+
Length: 10, Score: 0.53
367367

368368
Name: Microsoft, ID: Microsoft, URL: https://en.wikipedia.org/wiki/Microsoft Data Source: Wikipedia
369369
Matches:
370370
Text: Microsoft
371-
Offset: 0, Length: 9, Score: 0.469
371+
Length: 9, Score: 0.47
372372

373373
Text: Microsoft
374-
Offset: 150, Length: 9, Score: 0.469
374+
Length: 9, Score: 0.47
375375

376376
Name: April 4, ID: April 4, URL: https://en.wikipedia.org/wiki/April_4 Data Source: Wikipedia
377377
Matches:
378378
Text: April 4
379-
Offset: 54, Length: 7, Score: 0.248
379+
Length: 7, Score: 0.25
380380

381381
Name: BASIC, ID: BASIC, URL: https://en.wikipedia.org/wiki/BASIC Data Source: Wikipedia
382382
Matches:
383383
Text: BASIC
384-
Offset: 89, Length: 5, Score: 0.281
384+
Length: 5, Score: 0.28
385385
```
386386

387387
#### [Version 2.1](#tab/version-2)

0 commit comments

Comments
 (0)