Learn how to implement Azure AI’s Key Phrase Extraction in C# to analyze customer feedback for e-commerce platforms. Discover best practices and real-world examples to streamline your text analysis workflows.
Table of Contents
Question
Your organization, Verigon Inc., is developing a feedback analysis system for an e-commerce platform. The system uses the Azure AI Language service to extract key phrases from customer reviews, allowing the team to quickly identify common themes. You have implemented the following C# code to extract key phrases from user feedback:
using Azure;
using System;
using Azure.AI.TextAnalytics;
namespace KeyPhraseExtractionExample
{
class Program
{
// Configures environment variables named “LANGUAGE_KEY” and “LANGUAGE_ENDPOINT”
static string languageKey = Environment.GetEnvironmentVariable(“LANGUAGE_KEY”);
static string languageEndpoint = Environment.GetEnvironmentVariable(“LANGUAGE_ENDPOINT”);
private static readonly AzureKeyCredential credentials = new AzureKeyCredential(languageKey);
private static readonly Uri endpoint = new Uri(languageEndpoint);
// Method for extracting key phrases from text
static void KeyPhraseExtractionExample(TextAnalyticsClient client)
{
var response = client.ExtractKeyPhrases(@”In Atlanta, GA, students at Georgia Tech can be excited about a new donut shop that will open on campus once the kids return from break.”);
// Printing response
Console.WriteLine(“Key phrases:”);
foreach (string keyphrase in response.Value)
{
Console.WriteLine($”\t{keyphrase}”);
}
}
static void Main(string[] args)
{
var client = new TextAnalyticsClient(endpoint, credentials);
KeyPhraseExtractionExample(client);
Console.Write(“Press any key to exit.”);
Console.ReadKey();
}
}
}
After observing the output of the above code, which of the following statements are TRUE?
Drag the statements to the appropriate category.
Statement:
- Key phrases are sent to the printer
- Key phrases are sent to the console
- The output will contain ‘once the kids’
- The output will contain ‘new donut shop’
- The output will contain ‘Georgia Tech’
- The output will contain ‘will open on campus’
- The output will contain ‘students’
Answer
True:
- Key phrases are sent to the console
- The output will contain ‘new donut shop’
- The output will contain ‘Georgia Tech’
- The output will contain ‘students’
False:
- Key phrases are sent to the printer
- The output will contain ‘once the kids’
- The output will contain ‘will open on campus’
Explanation
The client.ExtractKeyPhrases method extracts key phrases from the following:
“In Atlanta, GA, students at Georgia Tech can be excited about a new donut shop that will open on campus once the kids return from break.”
It returned the following key phrases in the output:
[‘new donut shop’, ‘Atlanta’, ‘GA’. ‘students’, ‘Georgia Tech’, ‘campus’, ‘kids’]
AI Language will detect the key phrases or exact words from the given code by capturing the primary concepts and descriptive elements that enhance the meaning. When the C# code is executed, Azure AI Language will extract meaningful key phrases that represent the main concepts in the text. The key phrase output represents the most important themes in the text and thus are extracted. Key phrases are generally multi-word expressions that capture the most meaningful concepts in the text.
The words ‘once the kids’ and ‘will open on campus’ do not represent themes or concepts that are extracted by the client.ExtractKeyPhrases method.
The output is sent to the console, not the printer, even though the code comment says “Printing response”.
Microsoft Azure AI Engineer Associate AI-102 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Microsoft Azure AI Engineer Associate AI-102 exam and earn Microsoft Azure AI Engineer Associate AI-102 certification.