Skip to content

Commit e7d57b3

Browse files
authored
add bingEntitySearchApiId (#14805)
1 parent 1fefd28 commit e7d57b3

File tree

6 files changed

+36
-15
lines changed

6 files changed

+36
-15
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Support added for Opinion Mining. This feature is available in the Text Analytics service v3.1-preview.1 and above.
99
- 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
1010
- `TextAnalyticsError` and `TextAnalyticsWarning` now are marked as immutable.
11+
- 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.
1112

1213
## 5.0.0 (2020-07-27)
1314
- Re-release of version `1.0.1` with updated version `5.0.0`.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public readonly partial struct LinkedEntity
136136
{
137137
private readonly object _dummy;
138138
private readonly int _dummyPrimitive;
139+
public string BingEntitySearchApiId { get { throw null; } }
139140
public string DataSource { get { throw null; } }
140141
public string DataSourceEntityId { get { throw null; } }
141142
public string Language { get { throw null; } }
@@ -349,7 +350,9 @@ public static partial class TextAnalyticsModelFactory
349350
public static Azure.AI.TextAnalytics.ExtractKeyPhrasesResult ExtractKeyPhrasesResult(string id, Azure.AI.TextAnalytics.TextDocumentStatistics statistics, Azure.AI.TextAnalytics.KeyPhraseCollection keyPhrases) { throw null; }
350351
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; }
351352
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; }
353+
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
352354
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; }
355+
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; }
353356
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; }
354357
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
355358
public static Azure.AI.TextAnalytics.LinkedEntityMatch LinkedEntityMatch(string text, double score) { throw null; }

sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,15 @@ namespace Azure.AI.TextAnalytics
1616
[CodeGenModel("LinkedEntity")]
1717
public readonly partial struct LinkedEntity
1818
{
19-
/// <summary>
20-
/// Gets the URL that identifies the linked entity's entry in the data source.
21-
/// </summary>
22-
[CodeGenMember("Url")]
23-
private string _url { get; }
24-
25-
internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, string language, string dataSourceEntityId, string url, string dataSource, string bingId)
19+
internal LinkedEntity(string name, IEnumerable<LinkedEntityMatch> matches, string language, string dataSourceEntityId, Uri url, string dataSource, string bingEntitySearchApiId)
2620
{
2721
Name = name;
2822
DataSourceEntityId = dataSourceEntityId;
2923
Language = language;
3024
DataSource = dataSource;
31-
_url = url;
32-
Url = new Uri(url);
25+
Url = url;
3326
Matches = matches;
34-
BingId = bingId;
27+
BingEntitySearchApiId = bingEntitySearchApiId;
3528
}
3629

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

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

69-
/// <summary> Bing unique identifier of the recognized entity. Use in conjunction with the Bing Entity Search API to fetch additional relevant information. </summary>
70-
private string BingId { get; }
63+
/// <summary> Bing Entity Search API unique identifier of the recognized entity.
64+
/// Use in conjunction with the Bing Entity Search API to fetch additional relevant information.
65+
/// This property is only available for v3.1-preview.2 and up.
66+
/// </summary>
67+
[CodeGenMember("BingId")]
68+
public string BingEntitySearchApiId { get; }
7169
}
7270
}

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,26 @@ public static ExtractKeyPhrasesResultCollection ExtractKeyPhrasesResultCollectio
397397
/// <param name="url">Sets the <see cref="LinkedEntity.Url"/> property.</param>
398398
/// <param name="matches">Sets the <see cref="LinkedEntity.Matches"/> property.</param>
399399
/// <returns>A new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.</returns>
400+
[EditorBrowsable(EditorBrowsableState.Never)]
400401
public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable<LinkedEntityMatch> matches)
401402
{
402-
return new LinkedEntity(name, matches, language, dataSourceEntityId, url.AbsoluteUri, dataSource, default);
403+
return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, default);
404+
}
405+
406+
/// <summary>
407+
/// Initializes a new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.
408+
/// </summary>
409+
/// <param name="name">Sets the <see cref="LinkedEntity.Name"/> property.</param>
410+
/// <param name="dataSourceEntityId">Sets the <see cref="LinkedEntity.DataSourceEntityId"/> property.</param>
411+
/// <param name="language">Sets the <see cref="LinkedEntity.Language"/> property.</param>
412+
/// <param name="dataSource">Sets the <see cref="LinkedEntity.DataSource"/> property.</param>
413+
/// <param name="url">Sets the <see cref="LinkedEntity.Url"/> property.</param>
414+
/// <param name="matches">Sets the <see cref="LinkedEntity.Matches"/> property.</param>
415+
/// <param name="bingEntitySearchApiId">Sets the <see cref="LinkedEntity.BingEntitySearchApiId"/> property.</param>
416+
/// <returns>A new instance of <see cref="TextAnalytics.LinkedEntity"/> for mocking purposes.</returns>
417+
public static LinkedEntity LinkedEntity(string name, string dataSourceEntityId, string language, string dataSource, Uri url, IEnumerable<LinkedEntityMatch> matches, string bingEntitySearchApiId)
418+
{
419+
return new LinkedEntity(name, matches, language, dataSourceEntityId, url, dataSource, bingEntitySearchApiId);
403420
}
404421

405422
/// <summary>

sdk/textanalytics/Azure.AI.TextAnalytics/tests/RecognizeLinkedEntitiesTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public async Task RecognizeLinkedEntitiesTest()
5353
Assert.IsNotNull(entity.Language);
5454
Assert.IsNotNull(entity.Url);
5555
Assert.IsNotNull(entity.Matches);
56+
Assert.IsNotNull(entity.BingEntitySearchApiId);
5657

5758
LinkedEntityMatch match = entity.Matches.First();
5859
Assert.IsNotNull(match.ConfidenceScore);

0 commit comments

Comments
 (0)