Skip to content

Commit a1fe52b

Browse files
authored
delete length property (Azure#15534)
1 parent 52096a4 commit a1fe52b

32 files changed

+52
-103
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Release History
22

33
## 5.1.0-beta.2 (Unreleased)
4-
4+
### Breaking changes
5+
- Removed property `Length` from `CategorizedEntity`, `SentenceSentiment`, `LinkedEntityMatch`, `AspectSentiment`, `OpinionSentiment`, and `PiiEntity`.
56

67
## 5.1.0-beta.1 (2020-09-17)
78

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ CategorizedEntityCollection entities = client.RecognizeEntities(document);
194194
Console.WriteLine($"Recognized {entities.Count} entities:");
195195
foreach (CategorizedEntity entity in entities)
196196
{
197-
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
197+
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
198198
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
199199
}
200200
```
@@ -243,7 +243,7 @@ foreach (LinkedEntity linkedEntity in linkedEntities)
243243
Console.WriteLine($"Name: {linkedEntity.Name}, Language: {linkedEntity.Language}, Data Source: {linkedEntity.DataSource}, Url: {linkedEntity.Url.ToString()}, Entity Id in Data Source: {linkedEntity.DataSourceEntityId}");
244244
foreach (LinkedEntityMatch match in linkedEntity.Matches)
245245
{
246-
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}, Length (in UTF-16 code units): {match.Length}");
246+
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}");
247247
Console.WriteLine($" Confidence score: {match.ConfidenceScore}");
248248
}
249249
}
@@ -274,7 +274,7 @@ CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(docum
274274
Console.WriteLine($"Recognized {entities.Count} entities:");
275275
foreach (CategorizedEntity entity in entities)
276276
{
277-
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
277+
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
278278
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
279279
}
280280
```

sdk/textanalytics/Azure.AI.TextAnalytics/api/Azure.AI.TextAnalytics.netstandard2.0.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public readonly partial struct AspectSentiment
2828
private readonly object _dummy;
2929
private readonly int _dummyPrimitive;
3030
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
31-
public int Length { get { throw null; } }
3231
public int Offset { get { throw null; } }
3332
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
3433
public string Text { get { throw null; } }
@@ -40,7 +39,6 @@ public readonly partial struct CategorizedEntity
4039
private readonly int _dummyPrimitive;
4140
public Azure.AI.TextAnalytics.EntityCategory Category { get { throw null; } }
4241
public double ConfidenceScore { get { throw null; } }
43-
public int Length { get { throw null; } }
4442
public int Offset { get { throw null; } }
4543
public string SubCategory { get { throw null; } }
4644
public string Text { get { throw null; } }
@@ -155,7 +153,6 @@ public readonly partial struct LinkedEntityMatch
155153
private readonly object _dummy;
156154
private readonly int _dummyPrimitive;
157155
public double ConfidenceScore { get { throw null; } }
158-
public int Length { get { throw null; } }
159156
public int Offset { get { throw null; } }
160157
public string Text { get { throw null; } }
161158
}
@@ -174,7 +171,6 @@ public readonly partial struct OpinionSentiment
174171
private readonly int _dummyPrimitive;
175172
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
176173
public bool IsNegated { get { throw null; } }
177-
public int Length { get { throw null; } }
178174
public int Offset { get { throw null; } }
179175
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
180176
public string Text { get { throw null; } }
@@ -186,7 +182,6 @@ public readonly partial struct PiiEntity
186182
private readonly int _dummyPrimitive;
187183
public Azure.AI.TextAnalytics.EntityCategory Category { get { throw null; } }
188184
public double ConfidenceScore { get { throw null; } }
189-
public int Length { get { throw null; } }
190185
public int Offset { get { throw null; } }
191186
public string SubCategory { get { throw null; } }
192187
public string Text { get { throw null; } }
@@ -245,7 +240,6 @@ public readonly partial struct SentenceSentiment
245240
private readonly object _dummy;
246241
private readonly int _dummyPrimitive;
247242
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
248-
public int Length { get { throw null; } }
249243
public System.Collections.Generic.IReadOnlyCollection<Azure.AI.TextAnalytics.MinedOpinion> MinedOpinions { get { throw null; } }
250244
public int Offset { get { throw null; } }
251245
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
@@ -380,10 +374,10 @@ public static partial class TextAnalyticsModelFactory
380374
public static Azure.AI.TextAnalytics.AnalyzeSentimentResult AnalyzeSentimentResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
381375
public static Azure.AI.TextAnalytics.AnalyzeSentimentResult AnalyzeSentimentResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.DocumentSentiment documentSentiment) { throw null; }
382376
public static Azure.AI.TextAnalytics.AnalyzeSentimentResultCollection AnalyzeSentimentResultCollection(System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.AnalyzeSentimentResult> list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string modelVersion) { throw null; }
383-
public static Azure.AI.TextAnalytics.AspectSentiment AspectSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset, int length) { throw null; }
377+
public static Azure.AI.TextAnalytics.AspectSentiment AspectSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset) { throw null; }
384378
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
385379
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score) { throw null; }
386-
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; }
380+
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score, int offset) { throw null; }
387381
public static Azure.AI.TextAnalytics.CategorizedEntityCollection CategorizedEntityCollection(System.Collections.Generic.IList<Azure.AI.TextAnalytics.CategorizedEntity> entities, System.Collections.Generic.IList<Azure.AI.TextAnalytics.TextAnalyticsWarning> warnings = null) { throw null; }
388382
public static Azure.AI.TextAnalytics.DetectedLanguage DetectedLanguage(string name, string iso6391Name, double confidenceScore, System.Collections.Generic.IList<Azure.AI.TextAnalytics.TextAnalyticsWarning> warnings = null) { throw null; }
389383
public static Azure.AI.TextAnalytics.DetectLanguageResult DetectLanguageResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
@@ -400,10 +394,10 @@ public static partial class TextAnalyticsModelFactory
400394
public static Azure.AI.TextAnalytics.LinkedEntityCollection LinkedEntityCollection(System.Collections.Generic.IList<Azure.AI.TextAnalytics.LinkedEntity> entities, System.Collections.Generic.IList<Azure.AI.TextAnalytics.TextAnalyticsWarning> warnings = null) { throw null; }
401395
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
402396
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score) { throw null; }
403-
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score, int offset, int length) { throw null; }
397+
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score, int offset) { throw null; }
404398
public static Azure.AI.TextAnalytics.MinedOpinion MinedOpinion(Azure.AI.TextAnalytics.AspectSentiment aspect, System.Collections.Generic.IReadOnlyList<Azure.AI.TextAnalytics.OpinionSentiment> opinions) { throw null; }
405-
public static Azure.AI.TextAnalytics.OpinionSentiment OpinionSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset, int length) { throw null; }
406-
public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; }
399+
public static Azure.AI.TextAnalytics.OpinionSentiment OpinionSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset) { throw null; }
400+
public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset) { throw null; }
407401
public static Azure.AI.TextAnalytics.PiiEntityCollection PiiEntityCollection(System.Collections.Generic.IList<Azure.AI.TextAnalytics.PiiEntity> entities, string redactedText, System.Collections.Generic.IList<Azure.AI.TextAnalytics.TextAnalyticsWarning> warnings = null) { throw null; }
408402
public static Azure.AI.TextAnalytics.RecognizeEntitiesResult RecognizeEntitiesResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
409403
public static Azure.AI.TextAnalytics.RecognizeEntitiesResult RecognizeEntitiesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.CategorizedEntityCollection entities) { throw null; }
@@ -416,7 +410,7 @@ public static partial class TextAnalyticsModelFactory
416410
public static Azure.AI.TextAnalytics.RecognizePiiEntitiesResultCollection RecognizePiiEntitiesResultCollection(System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.RecognizePiiEntitiesResult> list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string modelVersion) { throw null; }
417411
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
418412
public static Azure.AI.TextAnalytics.SentenceSentiment SentenceSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore) { throw null; }
419-
public static Azure.AI.TextAnalytics.SentenceSentiment SentenceSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, int offset, int length, System.Collections.Generic.IReadOnlyList<Azure.AI.TextAnalytics.MinedOpinion> minedOpinions) { throw null; }
413+
public static Azure.AI.TextAnalytics.SentenceSentiment SentenceSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore, int offset, System.Collections.Generic.IReadOnlyList<Azure.AI.TextAnalytics.MinedOpinion> minedOpinions) { throw null; }
420414
public static Azure.AI.TextAnalytics.SentimentConfidenceScores SentimentConfidenceScores(double positiveScore, double neutralScore, double negativeScore) { throw null; }
421415
public static Azure.AI.TextAnalytics.TextAnalyticsError TextAnalyticsError(string code, string message, string target = null) { throw null; }
422416
public static Azure.AI.TextAnalytics.TextAnalyticsWarning TextAnalyticsWarning(string code, string message) { throw null; }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ CategorizedEntityCollection entities = client.RecognizeEntities(document);
2323
Console.WriteLine($"Recognized {entities.Count} entities:");
2424
foreach (CategorizedEntity entity in entities)
2525
{
26-
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
26+
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
2727
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
2828
}
2929
```

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ foreach (LinkedEntity linkedEntity in linkedEntities)
2626
Console.WriteLine($"Name: {linkedEntity.Name}, Language: {linkedEntity.Language}, Data Source: {linkedEntity.DataSource}, Url: {linkedEntity.Url.ToString()}, Entity Id in Data Source: {linkedEntity.DataSourceEntityId}");
2727
foreach (LinkedEntityMatch match in linkedEntity.Matches)
2828
{
29-
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}, Length (in UTF-16 code units): {match.Length}");
29+
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}");
3030
Console.WriteLine($" Confidence score: {match.ConfidenceScore}");
3131
}
3232
}

sdk/textanalytics/Azure.AI.TextAnalytics/src/AspectSentiment.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ public readonly struct AspectSentiment
1717
{
1818
private const double _neutralValue = 0d;
1919

20-
internal AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset, int length)
20+
internal AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset)
2121
{
2222
Sentiment = sentiment;
2323
Text = text;
2424
ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
2525
Offset = offset;
26-
Length = length;
2726
}
2827

2928
internal AspectSentiment(SentenceAspect sentenceAspect)
@@ -34,7 +33,6 @@ internal AspectSentiment(SentenceAspect sentenceAspect)
3433
ConfidenceScores = new SentimentConfidenceScores(sentenceAspect.ConfidenceScores.Positive, _neutralValue, sentenceAspect.ConfidenceScores.Negative);
3534
Sentiment = (TextSentiment)Enum.Parse(typeof(TextSentiment), sentenceAspect.Sentiment, ignoreCase: true);
3635
Offset = sentenceAspect.Offset;
37-
Length = sentenceAspect.Length;
3836
}
3937

4038
/// <summary>
@@ -59,10 +57,5 @@ internal AspectSentiment(SentenceAspect sentenceAspect)
5957
/// Gets the starting position (in UTF-16 code units) for the aspect text.
6058
/// </summary>
6159
public int Offset { get; }
62-
63-
/// <summary>
64-
/// Gets the length (in UTF-16 code units) of the aspect text.
65-
/// </summary>
66-
public int Length { get; }
6760
}
6861
}

sdk/textanalytics/Azure.AI.TextAnalytics/src/CategorizedEntity.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ internal CategorizedEntity(Entity entity)
2222
SubCategory = entity.Subcategory;
2323
ConfidenceScore = entity.ConfidenceScore;
2424
Offset = entity.Offset;
25-
Length = entity.Length;
2625
}
2726

2827
/// <summary>
@@ -57,10 +56,5 @@ internal CategorizedEntity(Entity entity)
5756
/// Gets the starting position (in UTF-16 code units) for the matching text in the input document.
5857
/// </summary>
5958
public int Offset { get; }
60-
61-
/// <summary>
62-
/// Gets the length (in UTF-16 code units) of the matching text in the input document.
63-
/// </summary>
64-
public int Length { get; }
6559
}
6660
}

sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntityMatch.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ namespace Azure.AI.TextAnalytics
1313
[CodeGenModel("Match")]
1414
public readonly partial struct LinkedEntityMatch
1515
{
16+
// use for deserialization
1617
internal LinkedEntityMatch(double confidenceScore, string text, int offset, int length)
18+
: this(confidenceScore, text, offset) => Length = length;
19+
20+
internal LinkedEntityMatch(double confidenceScore, string text, int offset)
1721
{
1822
// We shipped TA 5.0.0 Text == string.Empty if the service returned a null value for Text.
1923
// Because we don't want to introduce a breaking change, we are transforming that null to string.Empty
2024
Text = text ?? string.Empty;
2125
ConfidenceScore = confidenceScore;
2226
Offset = offset;
23-
Length = length;
27+
Length = default;
2428
}
2529

2630
/// <summary>
@@ -40,8 +44,8 @@ internal LinkedEntityMatch(double confidenceScore, string text, int offset, int
4044
public int Offset { get; }
4145

4246
/// <summary>
43-
/// Gets the length (in UTF-16 code units) of the matching text in the document.
47+
/// Gets the length (in UTF-16 code units) of the matching text in the sentence.
4448
/// </summary>
45-
public int Length { get; }
49+
private int Length { get; }
4650
}
4751
}

sdk/textanalytics/Azure.AI.TextAnalytics/src/OpinionSentiment.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ public readonly struct OpinionSentiment
1515
{
1616
private const double _neutralValue = 0d;
1717

18-
internal OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset, int length)
18+
internal OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset)
1919
{
2020
Sentiment = sentiment;
2121
ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
2222
Text = text;
2323
IsNegated = isNegated;
2424
Offset = offset;
25-
Length = length;
2625
}
2726

2827
internal OpinionSentiment(SentenceOpinion opinion)
@@ -34,7 +33,6 @@ internal OpinionSentiment(SentenceOpinion opinion)
3433
Sentiment = (TextSentiment)Enum.Parse(typeof(TextSentiment), opinion.Sentiment, ignoreCase: true);
3534
IsNegated = opinion.IsNegated;
3635
Offset = opinion.Offset;
37-
Length = opinion.Length;
3836
}
3937

4038
/// <summary>
@@ -66,10 +64,5 @@ internal OpinionSentiment(SentenceOpinion opinion)
6664
/// Gets the starting position (in UTF-16 code units) for the opinion text.
6765
/// </summary>
6866
public int Offset { get; }
69-
70-
/// <summary>
71-
/// Gets the length (in UTF-16 code units) of the opinion text.
72-
/// </summary>
73-
public int Length { get; }
7467
}
7568
}

sdk/textanalytics/Azure.AI.TextAnalytics/src/PiiEntity.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ internal PiiEntity(Entity entity)
2020
SubCategory = entity.Subcategory;
2121
ConfidenceScore = entity.ConfidenceScore;
2222
Offset = entity.Offset;
23-
Length = entity.Length;
2423
}
2524

2625
/// <summary>
@@ -55,10 +54,5 @@ internal PiiEntity(Entity entity)
5554
/// Gets the starting position (in UTF-16 code units) for the matching text in the input document.
5655
/// </summary>
5756
public int Offset { get; }
58-
59-
/// <summary>
60-
/// Gets the length (in UTF-16 code units) of the matching text in the input document.
61-
/// </summary>
62-
public int Length { get; }
6357
}
6458
}

0 commit comments

Comments
 (0)