Extracting Key Phrases from Text Using the .NET SDK
Azure Training Architect II in Content
In this hands-on lab, we use Visual Studio and C# to access a pre-created Azure Cognitive Service resource and have it perform key phrase extraction. All the code is already written. We simply need to configure the service endpoint and key, then run the code to perform the analysis.
Extracting Key Phrases within Text Using the .NET SDK
In this hands-on lab, we use Visual Studio and C# to access a pre-created Azure Cognitive Service resource and have it identify named entities in a piece of text. All the code is already written. We simply need to configure the service endpoint and key, then run the code to perform the analysis.
Log in to the Azure Portal using the credentials provided on the lab instructions page.
Once you're logged in, navigate to All resources. Once there, open the listed virtual machine and Cognitive Service resource in new browser tabs.
Use RDP to Connect to the Visual Studio Virtual Machine
Use the Remote Desktop client (available from Microsoft for Windows clients natively and Mac clients here).
- On the virtual machine page in the portal, click Connect.
- Click Download RDP File.
- Open the file with the RDP client.
- Edit the desktop to:
- Make sure you are not in an admin session.
- Make sure the remote session does not launch in full-screen mode.
- Set the resolution to something that will give us room to maneuver in both the remote and local desktops (e.g., 1024 x 768).
- Log in with the following credentials:
Note: If you're on a Mac, instead of downloading the RDP file, you will instead need to copy the public IP address of the virtual machine in the Azure Portal and use that to access the virtual machine via your RDP client.
Open and Configure Visual Studio
- Open Visual Studio using either the Start menu or the desktop icon.
- Click Sign in.
- Log in using the credentials you used to log in to the Azure Portal, and click Sign in.
- Select the defaults for all other Visual Studio options.
- Click Start Visual Studio. Be patient as this takes a few minutes to complete.
- Click Check for an updated license.
- Click Close.
Open the Visual Studio Solution
- Click Open a project or solution.
- Click This PC in the left-hand menu.
- Click Window (C:).
- Open the
- Open the
- Double-click the
LinuxAcademy.Azure.AI.KeyPhraseExtractionfile to open it.
Configure the Endpoint and Key, and Run the App
- On the Cognitive Service resource page in the Azure Portal, copy the key.
- Paste it into the
string keyline (line 16) of the Visual Studio code, before the semicolon, and surround it with quotation marks.
- On the Cognitive Service resource page in the Azure Portal, copy the endpoint.
- Paste it into the
string endpointline (line 15) of the Visual Studio code, before the semicolon, and surround it with quotation marks.
- Run the solution and examine the results.
Congratulations on successfully completing this hands-on lab!