What is Natural Language Generation (NLG)?

What is natural language generation (NLG)?

Natural language generation (NLG) is the use of artificial intelligence (AI) programming to create written or spoken narratives from a set of data. NLG is related to human-to-machine and machine-to-human interaction, including computational linguistics, natural language processing (NLP) and natural language understanding (NLU).

Research on NLG has often focused on creating computer programs that provide data points with context. NLG’s sophisticated software can mine large amounts of numerical data, identify patterns and share that information in a way that people can easily understand. The speed of NLG software is particularly useful for producing news and other time-sensitive stories on the internet. At its best, NLG output can be published verbatim as web content.

How does NLG work?

NLG is a multi-stage process, with each step further refining the data used to create natural-sounding language content. The six phases of NLG are as follows:

  1. Content analysis. The data is filtered to determine what should be included in the content produced at the end of the process. This stage includes identifying the main topics of the source document and the relationships between them.
  2. Understanding the data. Data is interpreted, patterns are identified and it is placed in context. Machine learning is often used at this stage.
  3. Structuring the document. A document plan is created and a narrative structure is chosen based on the type of data to be interpreted.
  4. Phrases. Related sentences or parts of sentences are combined in ways that accurately summarize the topic.
  5. Grammatical structure. Grammar rules are used to create natural sounding text. The program extracts the syntactical structure of the sentence. It then uses this information to rewrite the sentence in a grammatically correct way.
  6. Language presentation. The final output is created based on a template or format chosen by the user or programmer.
Six steps in natural language generation
Learn the six steps involved in natural language generation.

How is NLG used?

Natural language generation is used in different ways. Some of the many uses include the following:

  • creating responses to chatbots and voice assistants such as Google’s Alexa and Apple’s Siri;
  • converting financial reports and other types of business data into easily understandable content for employees and customers;
  • automating lead nurturing email, messaging and chat responses;
  • personalizing responses to customer emails and messages;
  • create and personalize scripts used by customer service representatives;
  • compiling and summarizing news;
  • reporting the status of internet of things devices; and
  • create product descriptions for e-commerce webpages and customer messaging.

NLG vs. NLU vs. NLP

NLP is an umbrella term that refers to the use of computers to understand human speech in written and verbal forms. NLP is built on a framework of rules and components, and it transforms unstructured data into a structured data format.

Diagram showing the relationship between natural language processing, natural language comprehension and natural language generation
Natural language processing consists of natural language comprehension and natural language generation, two related processes.

NLP consists of NLG and NLU, which have the following distinct, but related capabilities:

  • NLU refers to the ability of a computer to use syntactic and semantic analysis to determine the meaning of text or speech.
  • NLG allows computing devices to generate text and speech from data input.

Chatbots and “suggested text” features in email clients, such as Gmail’s Smart Compose, are examples of applications that use NLU and NLG. Natural language understanding allows the computer to understand the meaning of the user’s input, and natural language generation provides the text or speech response in a way that the user can understand.

NLG is connected to NLU and information retrieval. It is also related to text summarization, speech processing and machine translation. Much of NLG’s basic research also overlaps with computational linguistics and areas related to human-machine and human-machine interaction.

NLG models and methods

NLG relies on machine learning algorithms and other methods to generate machine-generated text in response to user inputs. Some of the methods used include the following:

Markov chain. The Markov model is a mathematical method used in statistics and machine learning to model and analyze systems that make random choices, such as language generation. Markov chains start with an initial state and then generate a series of states based on the previous one. The model learns about the current state and the previous state and then calculates the probability of moving to the next state based on the previous two. In a machine learning context, the algorithm creates phrases and sentences by selecting words that are statistically likely to appear together.

Recurrent neural network (RNN). These AI systems are used to process sequential data in different ways. RNNs can be used to transfer information from one system to another, such as translating sentences written in one language into another. RNNs are also used to identify patterns in data that help recognize images. An RNN can be trained to recognize different objects in an image or to recognize different parts of speech in a sentence.

Long short-term memory (LSTM). This type of RNN is used in deep learning where a system needs to learn from experience. LSTM networks are often used in NLP tasks because they can learn the context required for processing data sequences. To learn long-term dependencies, LSTM networks use a gating mechanism to limit the number of previous steps that affect the current step.

Transformer. This neural network architecture is able to learn the long-range dependencies of the language and create sentences from the meanings of the words. Transformer has to do with AI. It was developed by OpenAI, a nonprofit AI research company in San Francisco. Transformer includes two encoders: one for processing inputs of any length and the other for outputting generated sentences.

The three main Transformer models are as follows:

  • Generative Pre-trained Transformer (GPT) is a type of NLG technology used in business intelligence (BI) software. When GPT is implemented using a BI system, it uses NLG technology or machine learning algorithms to write reports, presentations and other content. The system creates content based on the information it is fed, which can be a combination of data, metadata and procedural rules.
  • Bidirectional Encoder Representations from Transformers (BERT) is the successor to the Transformer system originally created by Google for its speech recognition service. BERT is a language model that learns human language by learning syntactic information, which is the relationships between words, and semantic information, which is the meaning of words.
  • XLNet an artificial neural network trained on a data set. It identifies the patterns it uses to draw a logical conclusion. An NLP engine can extract information from a simple natural language query. XLNet refers to teaching oneself to read and interpret the text and use this knowledge to write a new text. XLNet has two parts: an encoder and a decoder. The encoder uses the syntactic rules of the language to convert sentences into a vector-based representation; the decoder uses these rules to convert the vector-based representation back into a meaningful sentence.

Learn more about why NLP is leading the adoption of AI and the key role played by NLP and NLG the application of AI in business.

Leave a comment