Unveiling Text Summarization with Azure’s CLU

In an era where digital interactions are becoming increasingly conversational, the need for systems capable of understanding and engaging in human-like dialogues is paramount.

Azure’s Conversational Language Understanding (CLU) stands out as a tool designed for this purpose, aiding in the creation of conversational applications that can interpret and respond to natural language inputs accurately. The essence of CLU lies in its ability to process natural language, discern intents, and generate responses that align with the context of the conversation. This guide aims to outline the steps involved in harnessing Azure’s CLU to develop a conversational understanding model, providing a solid foundation for those looking to delve into the realm of conversational applications.

Auteur:

Jesse Pols

Wiconic – Cloud Software Engineer

Step 1: Setting Up Azure CLU

Setting up Azure CLU involves creating an Azure account and initializing a new CLU resource. This step lays the foundation for your text summarization project.

  1. Go to the Azure website and click “Start free” to create a new account.
  2. Log into the Azure portal.
  3. Click on “Create a resource” and search for “Language service”.
  4. Click “Create” and fill out the necessary details.
  5. Click “Review + create”, review your settings, and then click “Create” again.

Step 2: Training Your Model

Training your model in Azure’s Language Studio is essential for text summarization. This step involves initiating a training job for your model.

  1. Navigate to the Language Studio and sign in with your Azure account.
  2. Select “Start a training job” from the top menu.
  3. Choose to either “Train a new model” by entering a new model name, or “Overwrite an existing model” if you wish to retrain an existing model with new data.
  4. Select a training mode: “Standard training” for faster training (only available for English) or “Advanced training” for a more thorough training supporting other languages.
  5. Decide on a data splitting method: allow the system to automatically split the data or manually split it if you have specific utterances for your testing set.
  6. Click on the “Train” button to initiate the training process. Monitor the training progress by selecting the training job ID from the list.

Step 3: Creating an Azure Function

This step involves creating an Azure Function to handle text summarization requests and responses between the user and the CLU service.

  1. Log into the Azure portal.
  2. Click on “Create a resource”, then search for and select “Function App”.
  3. Click “Create” and fill out the necessary details.
  4. Click “Review + create”, review your settings, and then click “Create” again.
  5. Once the function app is created, navigate to it in the Azure portal and create a new function within the app to handle text summarization requests.
  6. Set up the function to accept a POST request with the text to be summarized using an HttpTrigger.
  7. Utilize the Azure SDK to transmit the text to your CLU model and receive the summary in return.
  8. Configure the function to send back the generated summary as an HTTP response to the requester.

This part can prove especially challenging. If you run into any problems, do feel free to check out the official article on the matter by clicking the button below.

The following code snippet demonstrates how to set up an Azure Function that listens for a POST request containing the text to be summarized.

[FunctionName("SummarizeText")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req) {
   // Put your logic here
}

When a request is received, the text is extracted from the request body, and the Azure SDK is utilized to send this text to your trained CLU model for summarization. Once the summary is received from the CLU service, it is sent back to the requester as an HTTP response. Place the following code into the SummarizeText function. Replace <your-language-resource> and <your-key> with your actual Language resource endpoint and key respectively.

string text = await req.ReadAsStringAsync();
var client = new LanguageClient(
  new Uri(
    "https://<your-language-resource>.cognitiveservices.azure.com/"), 
    new AzureKeyCredential("<your-key>"));
var result = await client.SummarizeTextAsync(
  new TextDocumentInput("1", text) { Language = "en" });
return new OkObjectResult(result.Value.Summary);

 

 

 

<CONCLUSION>

By following the outlined steps, developers can craft a proficient system for text summarization using Azure’s CLU. The Azure Function created and developed in Step 3 serves as a bridge for processing text summarization requests and delivering summaries in response. Moving forward, it’s essential to continually test and improve the system to enhance the quality of text summarization provided by your CLU model. Employing a variety of texts for evaluation and revisiting the Language Studio to retrain your model with additional data or refined training techniques will drive improvements, simplifying the approach to text summarization and advancing efficiencies in information processing.