Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TA] Add BingEntitySearchApiId property to LinkedEntity #14805

Merged
merged 1 commit into from
Sep 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sdk/textanalytics/Azure.AI.TextAnalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Support added for Opinion Mining. This feature is available in the Text Analytics service v3.1-preview.1 and above.
- Added `Offset` and `Length` properties for `CategorizedEntity`, `SentenceSentiment`, and `LinkedEntityMatch`. The default encoding is UTF-16 code units. For additional information see https://aka.ms/text-analytics-offsets
- `TextAnalyticsError` and `TextAnalyticsWarning` now are marked as immutable.
- Added property `BingEntitySearchApiId` to the `LinkedEntity` class. This property is only available for v3.1-preview.2 and up, and it is to be used in conjunction with the Bing Entity Search API to fetch additional relevant information about the returned entity.

## 5.0.0 (2020-07-27)
- Re-release of version `1.0.1` with updated version `5.0.0`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public readonly partial struct LinkedEntity
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public string BingEntitySearchApiId { get { throw null; } }
public string DataSource { get { throw null; } }
public string DataSourceEntityId { get { throw null; } }
public string Language { get { throw null; } }
Expand Down Expand Up @@ -349,7 +350,9 @@ public static partial class TextAnalyticsModelFactory
public static Azure.AI.TextAnalytics.ExtractKeyPhrasesResult ExtractKeyPhrasesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.KeyPhraseCollection keyPhrases) { throw null; }
public static Azure.AI.TextAnalytics.ExtractKeyPhrasesResultCollection ExtractKeyPhrasesResultCollection(System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.ExtractKeyPhrasesResult> list, Azure.AI.TextAnalytics.TextDocumentBatchStatistics statistics, string modelVersion) { throw null; }
public static Azure.AI.TextAnalytics.KeyPhraseCollection KeyPhraseCollection(System.Collections.Generic.IList<string> keyPhrases, System.Collections.Generic.IList<Azure.AI.TextAnalytics.TextAnalyticsWarning> warnings = null) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static Azure.AI.TextAnalytics.LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, System.Uri url, System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.LinkedEntityMatch> matches) { throw null; }
public static Azure.AI.TextAnalytics.LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, System.Uri url, System.Collections.Generic.IEnumerable<Azure.AI.TextAnalytics.LinkedEntityMatch> matches, string bingEntitySearchApiId) { throw null; }
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; }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 10 additions & 12 deletions sdk/textanalytics/Azure.AI.TextAnalytics/src/LinkedEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,15 @@ namespace Azure.AI.TextAnalytics
[CodeGenModel("LinkedEntity")]
public readonly partial struct LinkedEntity
{
/// <summary>
/// Gets the URL that identifies the linked entity's entry in the data source.
/// </summary>
[CodeGenMember("Url")]
private string _url { get; }

internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, string language, string dataSourceEntityId, string url, string dataSource, string bingId)
internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, string language, string dataSourceEntityId, Uri url, string dataSource, string bingEntitySearchApiId)
{
Name = name;
DataSourceEntityId = dataSourceEntityId;
Language = language;
DataSource = dataSource;
_url = url;
Url = new Uri(url);
Url = url;
Matches = matches;
BingId = bingId;
BingEntitySearchApiId = bingEntitySearchApiId;
}

/// <summary>
Expand All @@ -58,6 +51,7 @@ internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, strin
/// <summary>
/// Gets the URL that identifies the linked entity's entry in the data source.
/// </summary>
[CodeGenMember("Url")]
public Uri Url { get; }

/// <summary>
Expand All @@ -66,7 +60,11 @@ internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, strin
/// </summary>
public IEnumerable<LinkedEntityMatch> Matches { get; }

/// <summary> Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. </summary>
private string BingId { get; }
/// <summary> Bing Entity Search API unique identifier of the recognized entity.
/// Use in conjunction with the Bing Entity Search API to fetch additional relevant information.
/// This property is only available for v3.1-preview.2 and up.
/// </summary>
[CodeGenMember("BingId")]
public string BingEntitySearchApiId { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,26 @@ public static ExtractKeyPhrasesResultCollection ExtractKeyPhrasesResultCollectio
/// <param name="url">Sets the <see cref="LinkedEntity.Url"/> property.</param>
/// <param name="matches">Sets the <see cref="LinkedEntity.Matches"/> property.</param>
/// <returns>A new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.</returns>
[EditorBrowsable(EditorBrowsableState.Never)]
public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable<LinkedEntityMatch> matches)
{
return new LinkedEntity(name, matches, language, dataSourceEntityId, url.AbsoluteUri, dataSource, default);
return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, default);
}

/// <summary>
/// Initializes a new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.
/// </summary>
/// <param name="name">Sets the <see cref="LinkedEntity.Name"/> property.</param>
/// <param name="dataSourceEntityId">Sets the <see cref="LinkedEntity.DataSourceEntityId"/> property.</param>
/// <param name="language">Sets the <see cref="LinkedEntity.Language"/> property.</param>
/// <param name="dataSource">Sets the <see cref="LinkedEntity.DataSource"/> property.</param>
/// <param name="url">Sets the <see cref="LinkedEntity.Url"/> property.</param>
/// <param name="matches">Sets the <see cref="LinkedEntity.Matches"/> property.</param>
/// <param name="bingEntitySearchApiId">Sets the <see cref="LinkedEntity.BingEntitySearchApiId"/> property.</param>
/// <returns>A new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.</returns>
public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable<LinkedEntityMatch> matches, string bingEntitySearchApiId)
{
return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, bingEntitySearchApiId);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public async Task RecognizeLinkedEntitiesTest()
Assert.IsNotNull(entity.Language);
Assert.IsNotNull(entity.Url);
Assert.IsNotNull(entity.Matches);
Assert.IsNotNull(entity.BingEntitySearchApiId);

LinkedEntityMatch match = entity.Matches.First();
Assert.IsNotNull(match.ConfidenceScore);
Expand Down