Skip to content

Commit

Permalink
delete length property (#15534)
Browse files Browse the repository at this point in the history
  • Loading branch information
maririos authored Sep 30, 2020
1 parent 52096a4 commit a1fe52b
Show file tree
Hide file tree
Showing 32 changed files with 52 additions and 103 deletions.
3 changes: 2 additions & 1 deletion sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 5.1.0-beta.2 (Unreleased)

### Breaking changes
- Removed property `Length` from `CategorizedEntity`, `SentenceSentiment`, `LinkedEntityMatch`, `AspectSentiment`, `OpinionSentiment`, and `PiiEntity`.

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

Expand Down
6 changes: 3 additions & 3 deletions sdk/textanalytics/Azure.AI.TextAnalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ CategorizedEntityCollection entities = client.RecognizeEntities(document);
Console.WriteLine($"Recognized {entities.Count} entities:");
foreach (CategorizedEntity entity in entities)
{
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
}
```
Expand Down Expand Up @@ -243,7 +243,7 @@ foreach (LinkedEntity linkedEntity in linkedEntities)
Console.WriteLine($"Name: {linkedEntity.Name}, Language: {linkedEntity.Language}, Data Source: {linkedEntity.DataSource}, Url: {linkedEntity.Url.ToString()}, Entity Id in Data Source: {linkedEntity.DataSourceEntityId}");
foreach (LinkedEntityMatch match in linkedEntity.Matches)
{
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}, Length (in UTF-16 code units): {match.Length}");
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}");
Console.WriteLine($" Confidence score: {match.ConfidenceScore}");
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ CategorizedEntityCollection entities = await client.RecognizeEntitiesAsync(docum
Console.WriteLine($"Recognized {entities.Count} entities:");
foreach (CategorizedEntity entity in entities)
{
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public readonly partial struct AspectSentiment
private readonly object _dummy;
private readonly int _dummyPrimitive;
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
public string Text { get { throw null; } }
Expand All @@ -40,7 +39,6 @@ public readonly partial struct CategorizedEntity
private readonly int _dummyPrimitive;
public Azure.AI.TextAnalytics.EntityCategory Category { get { throw null; } }
public double ConfidenceScore { get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public string SubCategory { get { throw null; } }
public string Text { get { throw null; } }
Expand Down Expand Up @@ -155,7 +153,6 @@ public readonly partial struct LinkedEntityMatch
private readonly object _dummy;
private readonly int _dummyPrimitive;
public double ConfidenceScore { get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public string Text { get { throw null; } }
}
Expand All @@ -174,7 +171,6 @@ public readonly partial struct OpinionSentiment
private readonly int _dummyPrimitive;
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
public bool IsNegated { get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
public string Text { get { throw null; } }
Expand All @@ -186,7 +182,6 @@ public readonly partial struct PiiEntity
private readonly int _dummyPrimitive;
public Azure.AI.TextAnalytics.EntityCategory Category { get { throw null; } }
public double ConfidenceScore { get { throw null; } }
public int Length { get { throw null; } }
public int Offset { get { throw null; } }
public string SubCategory { get { throw null; } }
public string Text { get { throw null; } }
Expand Down Expand Up @@ -245,7 +240,6 @@ public readonly partial struct SentenceSentiment
private readonly object _dummy;
private readonly int _dummyPrimitive;
public Azure.AI.TextAnalytics.SentimentConfidenceScores ConfidenceScores { get { throw null; } }
public int Length { get { throw null; } }
public System.Collections.Generic.IReadOnlyCollection<Azure.AI.TextAnalytics.MinedOpinion> MinedOpinions { get { throw null; } }
public int Offset { get { throw null; } }
public Azure.AI.TextAnalytics.TextSentiment Sentiment { get { throw null; } }
Expand Down Expand Up @@ -380,10 +374,10 @@ public static partial class TextAnalyticsModelFactory
public static Azure.AI.TextAnalytics.AnalyzeSentimentResult AnalyzeSentimentResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
public static Azure.AI.TextAnalytics.AnalyzeSentimentResult AnalyzeSentimentResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.DocumentSentiment documentSentiment) { throw null; }
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; }
public static Azure.AI.TextAnalytics.AspectSentiment AspectSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset, int length) { throw null; }
public static Azure.AI.TextAnalytics.AspectSentiment AspectSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score) { throw null; }
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; }
public static Azure.AI.TextAnalytics.CategorizedEntity CategorizedEntity(string text, string category, string subCategory, double score, int offset) { throw null; }
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; }
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; }
public static Azure.AI.TextAnalytics.DetectLanguageResult DetectLanguageResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
Expand All @@ -400,10 +394,10 @@ public static partial class TextAnalyticsModelFactory
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; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score) { throw null; }
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score, int offset, int length) { throw null; }
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score, int offset) { throw null; }
public static Azure.AI.TextAnalytics.MinedOpinion MinedOpinion(Azure.AI.TextAnalytics.AspectSentiment aspect, System.Collections.Generic.IReadOnlyList<Azure.AI.TextAnalytics.OpinionSentiment> opinions) { throw null; }
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; }
public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset, int length) { throw null; }
public static Azure.AI.TextAnalytics.OpinionSentiment OpinionSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset) { throw null; }
public static Azure.AI.TextAnalytics.PiiEntity PiiEntity(string text, string category, string subCategory, double score, int offset) { throw null; }
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; }
public static Azure.AI.TextAnalytics.RecognizeEntitiesResult RecognizeEntitiesResult(string id, Azure.AI.TextAnalytics.TextAnalyticsError error) { throw null; }
public static Azure.AI.TextAnalytics.RecognizeEntitiesResult RecognizeEntitiesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.CategorizedEntityCollection entities) { throw null; }
Expand All @@ -416,7 +410,7 @@ public static partial class TextAnalyticsModelFactory
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; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.AI.TextAnalytics.SentenceSentiment SentenceSentiment(Azure.AI.TextAnalytics.TextSentiment sentiment, string text, double positiveScore, double neutralScore, double negativeScore) { throw null; }
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; }
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; }
public static Azure.AI.TextAnalytics.SentimentConfidenceScores SentimentConfidenceScores(double positiveScore, double neutralScore, double negativeScore) { throw null; }
public static Azure.AI.TextAnalytics.TextAnalyticsError TextAnalyticsError(string code, string message, string target = null) { throw null; }
public static Azure.AI.TextAnalytics.TextAnalyticsWarning TextAnalyticsWarning(string code, string message) { throw null; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CategorizedEntityCollection entities = client.RecognizeEntities(document);
Console.WriteLine($"Recognized {entities.Count} entities:");
foreach (CategorizedEntity entity in entities)
{
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}, Length (in UTF-16 code units): {entity.Length}");
Console.WriteLine($"Text: {entity.Text}, Offset (in UTF-16 code units): {entity.Offset}");
Console.WriteLine($"Category: {entity.Category}, SubCategory: {entity.SubCategory}, Confidence score: {entity.ConfidenceScore}");
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ foreach (LinkedEntity linkedEntity in linkedEntities)
Console.WriteLine($"Name: {linkedEntity.Name}, Language: {linkedEntity.Language}, Data Source: {linkedEntity.DataSource}, Url: {linkedEntity.Url.ToString()}, Entity Id in Data Source: {linkedEntity.DataSourceEntityId}");
foreach (LinkedEntityMatch match in linkedEntity.Matches)
{
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}, Length (in UTF-16 code units): {match.Length}");
Console.WriteLine($" Match Text: {match.Text}, Offset (in UTF-16 code units): {match.Offset}");
Console.WriteLine($" Confidence score: {match.ConfidenceScore}");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ public readonly struct AspectSentiment
{
private const double _neutralValue = 0d;

internal AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset, int length)
internal AspectSentiment(TextSentiment sentiment, string text, double positiveScore, double negativeScore, int offset)
{
Sentiment = sentiment;
Text = text;
ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
Offset = offset;
Length = length;
}

internal AspectSentiment(SentenceAspect sentenceAspect)
Expand All @@ -34,7 +33,6 @@ internal AspectSentiment(SentenceAspect sentenceAspect)
ConfidenceScores = new SentimentConfidenceScores(sentenceAspect.ConfidenceScores.Positive, _neutralValue, sentenceAspect.ConfidenceScores.Negative);
Sentiment = (TextSentiment)Enum.Parse(typeof(TextSentiment), sentenceAspect.Sentiment, ignoreCase: true);
Offset = sentenceAspect.Offset;
Length = sentenceAspect.Length;
}

/// <summary>
Expand All @@ -59,10 +57,5 @@ internal AspectSentiment(SentenceAspect sentenceAspect)
/// Gets the starting position (in UTF-16 code units) for the aspect text.
/// </summary>
public int Offset { get; }

/// <summary>
/// Gets the length (in UTF-16 code units) of the aspect text.
/// </summary>
public int Length { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ internal CategorizedEntity(Entity entity)
SubCategory = entity.Subcategory;
ConfidenceScore = entity.ConfidenceScore;
Offset = entity.Offset;
Length = entity.Length;
}

/// <summary>
Expand Down Expand Up @@ -57,10 +56,5 @@ internal CategorizedEntity(Entity entity)
/// Gets the starting position (in UTF-16 code units) for the matching text in the input document.
/// </summary>
public int Offset { get; }

/// <summary>
/// Gets the length (in UTF-16 code units) of the matching text in the input document.
/// </summary>
public int Length { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ namespace Azure.AI.TextAnalytics
[CodeGenModel("Match")]
public readonly partial struct LinkedEntityMatch
{
// use for deserialization
internal LinkedEntityMatch(double confidenceScore, string text, int offset, int length)
: this(confidenceScore, text, offset) => Length = length;

internal LinkedEntityMatch(double confidenceScore, string text, int offset)
{
// We shipped TA 5.0.0 Text == string.Empty if the service returned a null value for Text.
// Because we don't want to introduce a breaking change, we are transforming that null to string.Empty
Text = text ?? string.Empty;
ConfidenceScore = confidenceScore;
Offset = offset;
Length = length;
Length = default;
}

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

/// <summary>
/// Gets the length (in UTF-16 code units) of the matching text in the document.
/// Gets the length (in UTF-16 code units) of the matching text in the sentence.
/// </summary>
public int Length { get; }
private int Length { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ public readonly struct OpinionSentiment
{
private const double _neutralValue = 0d;

internal OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset, int length)
internal OpinionSentiment(TextSentiment sentiment, double positiveScore, double negativeScore, string text, bool isNegated, int offset)
{
Sentiment = sentiment;
ConfidenceScores = new SentimentConfidenceScores(positiveScore, _neutralValue, negativeScore);
Text = text;
IsNegated = isNegated;
Offset = offset;
Length = length;
}

internal OpinionSentiment(SentenceOpinion opinion)
Expand All @@ -34,7 +33,6 @@ internal OpinionSentiment(SentenceOpinion opinion)
Sentiment = (TextSentiment)Enum.Parse(typeof(TextSentiment), opinion.Sentiment, ignoreCase: true);
IsNegated = opinion.IsNegated;
Offset = opinion.Offset;
Length = opinion.Length;
}

/// <summary>
Expand Down Expand Up @@ -66,10 +64,5 @@ internal OpinionSentiment(SentenceOpinion opinion)
/// Gets the starting position (in UTF-16 code units) for the opinion text.
/// </summary>
public int Offset { get; }

/// <summary>
/// Gets the length (in UTF-16 code units) of the opinion text.
/// </summary>
public int Length { get; }
}
}
6 changes: 0 additions & 6 deletions sdk/textanalytics/Azure.AI.TextAnalytics/src/PiiEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal PiiEntity(Entity entity)
SubCategory = entity.Subcategory;
ConfidenceScore = entity.ConfidenceScore;
Offset = entity.Offset;
Length = entity.Length;
}

/// <summary>
Expand Down Expand Up @@ -55,10 +54,5 @@ internal PiiEntity(Entity entity)
/// Gets the starting position (in UTF-16 code units) for the matching text in the input document.
/// </summary>
public int Offset { get; }

/// <summary>
/// Gets the length (in UTF-16 code units) of the matching text in the input document.
/// </summary>
public int Length { get; }
}
}
Loading

0 comments on commit a1fe52b

Please sign in to comment.