Skip to content

Commit 70966f4

Browse files
authored
Merge pull request #273766 from MicrosoftDocs/main
4/29/2024 PM Publish
2 parents d503963 + 7ef66ae commit 70966f4

File tree

253 files changed

+2814
-1239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+2814
-1239
lines changed

articles/ai-services/language-service/entity-linking/includes/quickstarts/csharp-sdk.md

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,30 @@ ms.date: 12/19/2023
88
ms.author: jboback
99
---
1010

11-
[Reference documentation](/dotnet/api/azure.ai.textanalytics?preserve-view=true&view=azure-dotnet) | [Additional samples](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples) | [Package (NuGet)](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.2.0) | [Library source code](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics)
11+
[Reference documentation](/dotnet/api/azure.ai.textanalytics?preserve-view=true&view=azure-dotnet) | [More samples](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples) | [Package (NuGet)](https://www.nuget.org/packages/Azure.AI.TextAnalytics/5.2.0) | [Library source code](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics)
1212

13-
Use this quickstart to create an entity linking application with the client library for .NET. In the following example, you will create a C# application that can identify and disambiguate entities found in text.
13+
Use this quickstart to create an entity linking application with the client library for .NET. In the following example, you create a C# application that can identify and disambiguate entities found in text.
1414

1515
[!INCLUDE [Use Language Studio](../../../includes/use-language-studio.md)]
1616

1717
## Prerequisites
1818

1919
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
2020
* The [Visual Studio IDE](https://visualstudio.microsoft.com/vs/)
21-
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics" title="Create a Language resource" target="_blank">create a Language resource </a> in the Azure portal to get your key and endpoint. After it deploys, select **Go to resource**.
22-
* You will need the key and endpoint from the resource you create to connect your application to the API. You'll paste your key and endpoint into the code below later in the quickstart.
23-
* You can use the free pricing tier (`Free F0`) to try the service, and upgrade later to a paid tier for production.
24-
* To use the Analyze feature, you will need a Language resource with the standard (S) pricing tier.
25-
2621

2722

2823
## Setting up
2924

25+
[!INCLUDE [Create an Azure resource](../../../includes/create-resource.md)]
26+
27+
28+
29+
[!INCLUDE [Get your key and endpoint](../../../includes/get-key-endpoint.md)]
30+
31+
32+
33+
[!INCLUDE [Create environment variables](../../../includes/environment-variables.md)]
34+
3035
### Create a new .NET Core application
3136

3237
Using the Visual Studio IDE, create a new .NET Core console app. This will create a "Hello World" project with a single C# source file: *program.cs*.
@@ -37,9 +42,7 @@ Install the client library by right-clicking on the solution in the **Solution E
3742

3843
## Code example
3944

40-
Copy the following code into your *program.cs* file. Remember to replace the `key` variable with the key for your resource, and replace the `endpoint` variable with the endpoint for your resource. Then run the code.
41-
42-
[!INCLUDE [find the key and endpoint for a resource](../../../includes/find-azure-resource-info.md)]
45+
Copy the following code into your *program.cs* file and run the code.
4346

4447
```csharp
4548
using Azure;
@@ -51,8 +54,12 @@ namespace EntityLinkingExample
5154
{
5255
class Program
5356
{
54-
private static readonly Uri endpoint = new Uri("replace-with-your-endpoint-here");
55-
private static readonly AzureKeyCredential credentials = new AzureKeyCredential("replace-with-your-key-here");
57+
// This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
58+
static string languageKey = Environment.GetEnvironmentVariable("LANGUAGE_KEY");
59+
static string languageEndpoint = Environment.GetEnvironmentVariable("LANGUAGE_ENDPOINT");
60+
61+
private static readonly AzureKeyCredential credentials = new AzureKeyCredential(languageKey);
62+
private static readonly Uri endpoint = new Uri(languageEndpoint);
5663

5764
// Example method for recognizing entities and providing a link to an online data source.
5865
static void EntityLinkingExample(TextAnalyticsClient client)

articles/ai-services/language-service/entity-linking/includes/quickstarts/java-sdk.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,29 @@ ms.custom: devx-track-java
1010
ms.author: jboback
1111
---
1212

13-
[Reference documentation](/java/api/overview/azure/ai-textanalytics-readme?preserve-view=true&view=azure-java-stable) | [Additional samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics/src/samples) | [Package (Maven)](https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics/5.2.0) | [Library source code](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics)
14-
15-
Use this quickstart to create an entity linking application with the client library for Java. In the following example, you will create a Java application that can identify and disambiguate entities found in text.
16-
17-
[!INCLUDE [Use Language Studio](../../../includes/use-language-studio.md)]
13+
[Reference documentation](/java/api/overview/azure/ai-textanalytics-readme?preserve-view=true&view=azure-java-stable) | [More samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics/src/samples) | [Package (Maven)](https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics/5.2.0) | [Library source code](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics)
1814

15+
Use this quickstart to create an entity linking application with the client library for Java. In the following example, you create a Java application that can identify and disambiguate entities found in text.
1916

2017
## Prerequisites
2118

2219
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
2320
* [Java Development Kit](https://www.oracle.com/technetwork/java/javase/downloads/index.html) (JDK) with version 8 or above
24-
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics" title="Create a Language resource" target="_blank">create a Language resource </a> in the Azure portal to get your key and endpoint. After it deploys, select **Go to resource**.
25-
* You will need the key and endpoint from the resource you create to connect your application to the API. You'll paste your key and endpoint into the code below later in the quickstart.
26-
* You can use the free pricing tier (`Free F0`) to try the service, and upgrade later to a paid tier for production.
27-
* To use the Analyze feature, you will need a Language resource with the standard (S) pricing tier.
28-
2921

3022

3123
## Setting up
3224

25+
[!INCLUDE [Create an Azure resource](../../../includes/create-resource.md)]
26+
27+
28+
29+
[!INCLUDE [Get your key and endpoint](../../../includes/get-key-endpoint.md)]
30+
31+
32+
33+
[!INCLUDE [Create environment variables](../../../includes/environment-variables.md)]
34+
35+
3336
### Add the client library
3437

3538
Create a Maven project in your preferred IDE or development environment. Then add the following dependency to your project's *pom.xml* file. You can find the implementation syntax [for other build tools](https://mvnrepository.com/artifact/com.azure/azure-ai-textanalytics/5.2.0) online.
@@ -48,9 +51,7 @@ Create a Maven project in your preferred IDE or development environment. Then ad
4851

4952
## Code example
5053

51-
Create a Java file named `Example.java`. Open the file and copy the below code. Remember to replace the `key` variable with the key for your resource, and replace the `endpoint` variable with the endpoint for your resource. Then run the code.
52-
53-
[!INCLUDE [find the key and endpoint for a resource](../../../includes/find-azure-resource-info.md)]
54+
Create a Java file named `Example.java`. Open the file and copy the below code. Then run the code.
5455

5556
```java
5657
import com.azure.core.credential.AzureKeyCredential;
@@ -60,11 +61,12 @@ import com.azure.ai.textanalytics.TextAnalyticsClient;
6061

6162
public class Example {
6263

63-
private static String KEY = "replace-with-your-key-here";
64-
private static String ENDPOINT = "replace-with-your-endpoint-here";
64+
// This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
65+
private static String languageKey = System.getenv("LANGUAGE_KEY");
66+
private static String languageEndpoint = System.getenv("LANGUAGE_ENDPOINT");
6567

6668
public static void main(String[] args) {
67-
TextAnalyticsClient client = authenticateClient(KEY, ENDPOINT);
69+
TextAnalyticsClient client = authenticateClient(languageKey, languageEndpoint);
6870
recognizeLinkedEntitiesExample(client);
6971
}
7072
// Method to authenticate the client object with your key and endpoint
@@ -144,4 +146,4 @@ Text: Altair 8800, Score: 0.88, Offset: 116, Length: 11
144146
* [Entity linking language support](../../language-support.md)
145147
* [How to call the entity linking API](../../how-to/call-api.md)
146148
* [Reference documentation](/java/api/overview/azure/ai-textanalytics-readme?preserve-view=true&view=azure-java-stable)
147-
* [Additional samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics/src/samples)
149+
*[More samples](https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/textanalytics/azure-ai-textanalytics/src/samples)

articles/ai-services/language-service/entity-linking/includes/quickstarts/nodejs-sdk.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,30 @@ ms.author: jboback
1010
ms.custom: devx-track-js
1111
---
1212

13-
[Reference documentation](/javascript/api/overview/azure/ai-language-text-readme) | [Additional samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitivelanguage/ai-language-text/samples/v1) | [Package (npm)](https://www.npmjs.com/package/@azure/ai-language-text) | [Library source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitivelanguage/ai-language-text)
13+
[Reference documentation](/javascript/api/overview/azure/ai-language-text-readme) | [More samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitivelanguage/ai-language-text/samples/v1) | [Package (npm)](https://www.npmjs.com/package/@azure/ai-language-text) | [Library source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/cognitivelanguage/ai-language-text)
1414

15-
Use this quickstart to create an entity linking application with the client library for Node.js. In the following example, you will create a JavaScript application that can identify and disambiguate entities found in text.
16-
17-
[!INCLUDE [Use Language Studio](../../../includes/use-language-studio.md)]
15+
Use this quickstart to create an entity linking application with the client library for Node.js. In the following example, you create a JavaScript application that can identify and disambiguate entities found in text.
1816

1917

2018
## Prerequisites
2119

2220
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
2321
* [Node.js](https://nodejs.org/) v14 LTS or later
24-
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics" title="Create a Language resource" target="_blank">create a Language resource </a> in the Azure portal to get your key and endpoint. After it deploys, select **Go to resource**.
25-
* You will need the key and endpoint from the resource you create to connect your application to the API. You'll paste your key and endpoint into the code below later in the quickstart.
26-
* You can use the free pricing tier (`Free F0`) to try the service, and upgrade later to a paid tier for production.
27-
* To use the Analyze feature, you will need a Language resource with the standard (S) pricing tier.
28-
2922

3023

3124
## Setting up
3225

26+
[!INCLUDE [Create an Azure resource](../../../includes/create-resource.md)]
27+
28+
29+
30+
[!INCLUDE [Get your key and endpoint](../../../includes/get-key-endpoint.md)]
31+
32+
33+
34+
[!INCLUDE [Create environment variables](../../../includes/environment-variables.md)]
35+
36+
3337
### Create a new Node.js application
3438

3539
In a console window (such as cmd, PowerShell, or Bash), create a new directory for your app, and navigate to it.
@@ -58,16 +62,17 @@ npm install @azure/ai-language-text
5862

5963
## Code example
6064

61-
Open the file and copy the below code. Remember to replace the `key` variable with the key for your resource, and replace the `endpoint` variable with the endpoint for your resource. Then run the code.
62-
63-
[!INCLUDE [find the key and endpoint for a resource](../../../includes/find-azure-resource-info.md)]
65+
Open the file and copy the below code. Then run the code.
6466

6567
```javascript
6668
"use strict";
6769

68-
const { TextAnalysisClient, AzureKeyCredential } = require("@azure/ai-language-text");
69-
const endpoint = '<paste-your-endpoint-here>';
70-
const key = '<paste-your-key-here>';
70+
const { TextAnalyticsClient, AzureKeyCredential } = require("@azure/ai-text-analytics");
71+
72+
// This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
73+
const key = process.env.LANGUAGE_KEY;
74+
const endpoint = process.env.LANGUAGE_ENDPOINT;
75+
7176
//example sentence for recognizing entities
7277
const documents = ["Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975."];
7378

articles/ai-services/language-service/entity-linking/includes/quickstarts/python-sdk.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@ ms.date: 12/19/2023
66
ms.author: jboback
77
---
88

9-
[Reference documentation](/python/api/azure-ai-textanalytics/azure.ai.textanalytics?preserve-view=true&view=azure-python) | [Additional samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics/samples) | [Package (PyPi)](https://pypi.org/project/azure-ai-textanalytics/5.2.0/) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics)
9+
[Reference documentation](/python/api/azure-ai-textanalytics/azure.ai.textanalytics?preserve-view=true&view=azure-python) | [More samples](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics/samples) | [Package (PyPi)](https://pypi.org/project/azure-ai-textanalytics/5.2.0/) | [Library source code](https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/textanalytics/azure-ai-textanalytics)
1010

11-
Use this quickstart to create an entity linking application with the client library for Python. In the following example, you will create a Python application that can identify and disambiguate entities found in text.
12-
13-
[!INCLUDE [Use Language Studio](../../../includes/use-language-studio.md)]
11+
Use this quickstart to create an entity linking application with the client library for Python. In the following example, you create a Python application that can identify and disambiguate entities found in text.
1412

1513

1614
## Prerequisites
1715

1816
* Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-services)
1917
* [Python 3.7 or later](https://www.python.org/)
20-
* Once you have your Azure subscription, <a href="https://portal.azure.com/#create/Microsoft.CognitiveServicesTextAnalytics" title="Create a Language resource" target="_blank">create a Language resource </a> in the Azure portal to get your key and endpoint. After it deploys, select **Go to resource**.
21-
* You will need the key and endpoint from the resource you create to connect your application to the API. You'll paste your key and endpoint into the code below later in the quickstart.
22-
* You can use the free pricing tier (`Free F0`) to try the service, and upgrade later to a paid tier for production.
23-
* To use the Analyze feature, you will need a Language resource with the standard (S) pricing tier.
24-
2518

2619

2720
## Setting up
2821

22+
[!INCLUDE [Create an Azure resource](../../../includes/create-resource.md)]
23+
24+
25+
26+
[!INCLUDE [Get your key and endpoint](../../../includes/get-key-endpoint.md)]
27+
28+
29+
30+
[!INCLUDE [Create environment variables](../../../includes/environment-variables.md)]
31+
32+
2933
### Install the client library
3034

3135
After installing Python, you can install the client library with:
@@ -38,22 +42,21 @@ pip install azure-ai-textanalytics==5.2.0
3842

3943
## Code example
4044

41-
Create a new Python file and copy the below code. Remember to replace the `key` variable with the key for your resource, and replace the `endpoint` variable with the endpoint for your resource. Then run the code.
42-
43-
[!INCLUDE [find the key and endpoint for a resource](../../../includes/find-azure-resource-info.md)]
45+
Create a new Python file and copy the below code. Then run the code.
4446

4547
```python
46-
endpoint = "paste-your-endpoint-here"
47-
key = "paste-your-key-here"
48+
# This example requires environment variables named "LANGUAGE_KEY" and "LANGUAGE_ENDPOINT"
49+
language_key = os.environ.get('LANGUAGE_KEY')
50+
language_endpoint = os.environ.get('LANGUAGE_ENDPOINT')
4851

4952
from azure.ai.textanalytics import TextAnalyticsClient
5053
from azure.core.credentials import AzureKeyCredential
5154

5255
# Authenticate the client using your key and endpoint.
5356
def authenticate_client():
54-
ta_credential = AzureKeyCredential(key)
57+
ta_credential = AzureKeyCredential(language_key)
5558
text_analytics_client = TextAnalyticsClient(
56-
endpoint=endpoint,
59+
endpoint=language_endpoint,
5760
credential=ta_credential)
5861
return text_analytics_client
5962

0 commit comments

Comments
 (0)