A shipping record says that 12 kits are packed. Can a customer notice say they are on the way? Not if the shipment is on hold. Natural language generation (NLG) turns inputs into text for a reader. In data-to-text generation, the writer can choose what to say first, but the record determines what is true.
Among real-world applications of natural language processing, generation runs in a different direction from entity extraction: extraction reads a sentence and returns fields such as a name and its position. Entity annotation marks those spans in existing text, often to make training or evaluation data. Here the fields already exist. The missing piece is the sentence.
One shipping record, two notices
This fictional record describes one shipment. The customer needs the destination, item, requested and packed quantities, and current shipment status. There is no departure date or reason for the hold.
{
"destination": "Alder Library",
"item": "Maple Kits",
"requested": 18,
"packed": 12,
"status": "on hold"
}Template output. A Python format string fills fixed slots: {destination} requested {requested} {item}; {packed} are packed. The shipment is {status}.. Running it on the record gives:
Alder Library requested 18 Maple Kits; 12 are packed. The shipment is on hold.
Free wording, illustrated. A language model could be asked to lead with the status and use only the supplied fields. This is an illustrative draft for comparison, not a recorded output from a model run:
The shipment to Alder Library is on hold. Of the 18 Maple Kits requested, 12 are packed.
The second version puts the hold first for someone waiting on delivery. It still associates 18 with the request and 12 with packing. Swapping those counts would change the meaning without changing either number printed on the page.
Check the claims, not just the digits
We ran a Python check on the two notices: it read the displayed JSON, matched the destination and item names, checked each quantity against its role, and matched the shipment status. Both notices passed all five field checks. Three deliberately altered notices failed as expected: one swapped the quantities, one changed Alder to Aspen, and one replaced “on hold” with “in transit.”
This is a check of these sentences, not a general fact checker. It could reject a correct paraphrase or accept a notice with an extra, invented explanation. Read each additional claim against the record: neither notice above says why the shipment is on hold. An accurate notice also depends on the record itself being current.
When to use a template or a language model
For a recurring shipment notice, use the template. Its wording can be approved once, and each status can be tested. Add a branch for a missing count rather than silently printing zero. Have someone review the field mapping: a template wired to the wrong quantity will repeat the same mistake reliably.
Free generation earns its extra review when readers need different levels of detail or a report must combine records whose contents vary. Give the model only authorized facts; check both required fields and unsupported additions. If the notice fails, fall back to the checked template. For a consequential status update, keep the status sentence fixed even if a model drafts the surrounding explanation.
In their study of data-to-document generation, Wiseman and colleagues found that fluent basketball reports did not reliably reflect source data; templates outperformed the tested neural systems on some metrics. That result is specific to their systems and task. Thomson and Reiter used human judgments of factual errors to evaluate accuracy in generated reports, a useful check on what an automatic score misses.
Further reading
For a practical introduction to transformer-based NLP, see the revised paperback by Lewis Tunstall, Leandro von Werra, and Thomas Wolf. As an Amazon Associate I earn from qualifying purchases. Natural Language Processing with Transformers, Revised Edition (Amazon US).



