Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to generate a summarised sentence or a list of summarised sentences, when publishing content.

Abstractive summarisation is a feature provided by Azure AI Language. It creates a brief summary using clear sentences or words that are not directly taken from the original document.

One use case of using abstractive summarisation in Optimizely CMS is that it can create a summary of content published on a page for promotional use and page descriptions. It helps users understand the page’s content better.

This feature can be implemented by downloading the “Patel.AzureAILanguage.Optimizely” NuGet package. You can get this package from the Optimizely NuGet Feed or the NuGet Feed.

After obtaining the NuGet Package and completing the required setup, the user needs to add a boolean property with the [TextAnalyticsAllowed] attribute to the Start Page Content Type to activate this functionality. This is detailed in the following link: TextAnalyticsAllowed Documentation.

Once the boolean property with the [TextAnalyticsAllowed] attribute has been added , the next step is to create an IList<string> property, with an [AbstractiveSummarisationList] attribute. This property will be filled with the abstractive summarisations generated from the Azure AI Language API. This can be added to any Optimizely CMS Content type that derives from IContent. Further information can be found in the following documentation: AbstractiveSummarisationList Documentation.

The final configuration step consists of creating one or many string properties which have a [AbstractiveSummarisation] attribute. This needs to be added to the same content type, the IList<string> property with a [AbstractiveSummarisationList] attribute was added to. Additional details are available via the following link: AbstractiveSummarisation Documentation.

When these properties have been added, abstractive summarisation can be performed when publishing content in the CMS. There is a screenshot below which demonstrates the code used to retrieve the abstractive summarisation from the Azure AI Language API

Response from the API via the Console

Abstractive Summarisation operation of multiple properties has completed
Status : succeeded
Abstractive Summaries generated : 8
Abstractive Summary: The building was originally a private house that was carved up into apartments during the Depression. The Bronfmans bought it with another couple, taking two and a half floors each. When that couple wanted to move on, Sherry and her former husband bought them out. They then embarked on an ambitious two-year renovation of the entire building.
Abstractive Summary: Sherry wanted to preserve the house’s historic bones, but also add a touch of contemporary style. She wanted the house to be elegant, but not a showpiece.
Abstractive Summary: Sherry says leaving the River Mansion will be a wrench since it is full of family memories. She remembers the time her 11-year-old son formed a punk band with his friends.
Abstractive Summary: Sherry is moving to a more rural home in Long Island. She feels it’s time for her to be somewhere else.
Abstractive Summary: Sherry Bronfman’s Upper West Side home is on sale for the first time since 1971. The actor’s family home is filled with memories.
Abstractive Summary: Sherry Bronfman was an ingénue actor who starred in the 1971 movie Shaft. Her husband, Edgar, was a scion of the Seagram family, and the Upper West Side was a diverse and up-and-coming neighbourhood.
Abstractive Summary: The house was designed with meticulous care, from the playful trompe-l’oil decoration around the lift to the hand-painted wallpaper. The wall colours were chosen to be flattering for all skin tones.
Abstractive Summary: Sherry restored a 120-year-old Beaux Arts townhouse. She wanted people to say “Wow” when they walked into every room.

Based on the operation performed, 8 abstractive summarisations have been generated and are then stored in a IList<string> property, which has been published in the CMS. The resulting list is as shown below