Back to Blogs

Your definitive guide to natural language generation

Conversation Design
Article
Technology, Information and Media
For the first time in a long time, NLG gives companies the power to express themselves to users. But is NLG more than just an engagement tool?

Natural Language Generation creates written or spoken narratives from a data set. It covers a range of subdisciplines around human-to-machine and machine-to-human interaction—including computational linguistics, natural language processing (NLP), and natural language understanding (NLU).

And in an era where content is king, NLG is the way forward when it comes to helping computers write stories out of data. In fact, sophisticated NLG software combs through dense numerical data and finds narrative threads to extract—which explains how news outlets manage to put out so much digital news in such short spans.

Today, NLG can explain and describe massive amounts of data in a human-like manner at the speed of thousands of pager per second. But although NLG can write, it can’t read.


The 6 steps to great NLG

Great NLG is the result of six stages or layers that are crucial to producing language that is human and contextual:

Content analysis

This is where the primary topics from the source document bubble up to the main level and relationships form between each of them.

Data understanding

Making sense of the data, identifying patterns, and building context—all of that happens here.

Document structuring

Creating a document plan and defining a narrative structure that fits the data available to the most suitable framework.

Sentence aggregation

Phrases and sentences get thrown into the mixing bag here as relevance starts to emerge in the developing output.

Grammatical structuring

The rubric of grammar descends on the output and rearranges the sentences into something grammatically correct.

Language aggregation 

Before the final output sees the light of day, it runs through any templates the programmer may have specified and adjust its presentation to match it.


Is there an algorithm to write a story from a list of words?

Yes. NLG relies on a number of algorithms that offer workarounds to the problems in creating more human-like text. Each of these algorithms is the result of years and years of research—heralding the shift from templates to dynamic life-like sentences. Here’s a closer look at a few of them.

The Markov chain

One of the first ever algos to rule the NLG roost, the Markov chain is a smart cookie: It uses the current word in the sentence to predict the next one! It does this by considering the relationship between each unique word. And if you’re thinking this looks familiar, you’re right: The Markov Chain was one of the first ever word suggestion tools on a smartphone keyboard.

Recurrent neural networks (RNN)

Think of neural networks as digital models that mimic the human brain. Just like the human brain, RNNs have the ability to remember — but for very short durations.

For every word in the dictionary, RNNs assign a probability weight. Then, as a conversation unfolds, they take the current word, scour through the list, and pick a word with the closest probability of use. This makes RNNs a great choice because they can remember the context to every conversation.

Long short-term memory (LSTM)

A variant of the RNN, LSTM is a neural network as well but one with four layers: the Unit, the Input Door, the Output Door, and the Forgotten Door.

LSTMs use these to follow a conversation closely and only respond to what is relevant. So when an LSTM encounters a period in a sentence, it uses the Forgotten Door to understand that the context of the conversation may change and that it might need to forget current information.

This allows them to remember information over a longer period of time. But, with the complex calculations LSTMs need — the required compute power might prove too expensive for wider usage.

Transformer

Attention Is All You Need—a 2017 Google paper—proposed the self-attention mechanism. The Transformer in it has encoders that accept inputs of any length and decoders that give out outputs of any length.

But where the Transformer strikes gold is the smaller number of steps it follows and the context its self-attention mechanism adds to the words in a sentence.

Perhaps the most famous example of the Transformer for language generation is OpenAI—the pathbreaking GPT-2 (Generative Pre-trained Transformer) language model. And with Google’s latest updates, the Transformer looks set to be the most popular update to NLG.

But how can businesses use NLG?

NLG has the potential to transform the way businesses speak to their customers. Let’s take a gander at few of its most relevant use cases:

Deep, automated personalization

No, we are not talking emails that recognize your user’s first name but actual deep personalization. Well-implemented NLG can help businesses do this by grabbing the context of the situation and responding with a more personal and relevant answer. This can help businesses massively boost their customer engagement rate.

Narrative reporting

Even if they spent every waking moment crouched in front of a screen typing away at a maniacal pace, sports writers would never be able to keep up with covering the high and lows of the game. For instance, the Associated Press deployed NLG to publish more than 5,000 previews of NCAA Division I men’s basketball games! But its scope for use extends beyond into tasks as commonplace as monthly reports at work and building narratives out of visualized data — something that is making big data more accessible to everyone.

Advanced monitoring for industrial IoT

When an NLG module is added to an ecosystem of industrial IoT devices and machinery, it can pass along automated status reports, maintenance updates, and other systems analytics in plainspeak. One such system went on to almost double the speed at which it processed alarms — pointing at a potential savings of millions of dollars in business costs.

Creating content at scale

NLG cannot replace a human writer just yet, but it certainly can augment the work they do. An example we bump into everyday is the brilliant Google Smart Compose — which literally finishes your sentences by plugging in the words that best suit their contexts. Content generated by NLG modules do best when it comes to translating predetermined data sets into comprehensive reports in prosaic language. Some tests have even revealed that product descriptions written by NLG software converted customers at the same rate as or slightly higher than human writers.

Conversational AI

But where NLG plays a very crucial role is with chatbots, voice user interfaces, and smart assistants. For instance, chatbots in the healthcare industry have caused a massive uptick in patient retention and satisfaction. And in 2021, a staggering 92% of marketers considered voice assistants as an “important” marketing channel. 

What does the future hold?

But it’s not just updates, reports, and generic notifications. Businesses are also trying to inject emotion into the reports and updates NLG generates to make it seem more human and friendly. 

So, if you deposit money into your account, your bank’s NLG software would send you an update that says “Congratulations! Your account balance has gone up.” instead of the template notification most users receive today. 

Conversation design is a hot topic of interest for us as well. That explains why we always strive to design and build an interface that engages with a user’s queries and doesn’t just respond to them. And we do that because operating at the cutting edge of tech is second nature to us. 

So if you’re looking for an NLG-powered solution or thinking up a more creative way to talk to your users, reach out to us! Maybe that’s the conversation you need to take that next, big step. 

Say it smarter. Say it better.

Siddharth Maganty

Content Marketer

Siddharth is a copywriter from Hyderabad, India. He loves F1, cats, long runs, eBooks, and writing articles on tech he would have loved to find online

More by this author