NLG: Named Entity References

This advanced NLG sample demonstrates how to use named entity references in Studio.

Enter your Studio email below to access this sample


Use the above button to download the example project for named entity references. Further documentation can be found below.

Named Entity Reference

This sample demonstrates how to use named entity references. These are advanced features that are only available within projects that use JSON data and lex rules.

Named entity references vary the way a narrative refers to people, places, and objects; they improve the flow and avoid repetitions. Typically, the first time something is mentioned we use a long name and the next time a shorter name or a pronoun (e.g. ‘he’, ‘she’, ‘they’, ‘it’). For example:

John Smith scored the most points. Tom Jones scored the most three-pointers. Smith got the most rebounds. The best player award was given to him.

The bold text in the above example illustrates how references to named entities can be varied according to the context while avoiding confusion with other entities. ‘Smith’ rather than ‘he’ is chosen in the third sentence to avoid confusion with ‘Tom Jones’. ‘Him’, the correct form of the pronoun, is chosen to refer to ‘John Smith’ in the final sentence.

We show you how to control named entity references through:

  1. features in your lex rules, e.g. <Subj reference="{{}}">
  2. special keys in your JSON data, e.g. "JohnSmith": [{"name": {"fullName": "John Smith","shortName": "Smith","__class": "JohnSmith"},"gender": "masculine"}]