This is the documentation for 1.15.0 version, which is not the latest version. Consider upgrading to 3.2.5.

A proper NLG system is able to make conjugations. Classic structures are subject/verb or subject/verb/adjective.

Supported persons are 3rd person singular & plural only.

Before anything we need to define what subjects can be.


A subject has to have a gender and a number. A simple way to define a subject is to use an existing js object and to affect it a gender and a number.

var PRODUCT = {something: 'somehow'};
setRefGender(PRODUCT, 'M');
setRefNumber(PRODUCT, 'P');
in French, German, Italian and Spanish, setRefGender(PRODUCT, 'bague'); will look for bague in the dictionnary and set PRODUCT gender to F. Same as setRefGender(PRODUCT, 'F'); here.

If you don’t want to bother with objects because they don’t exist or are too insignificant to be really created, you can ask the system to provide anonymous subjects:

var subjS = getAnonymous('M', 'S');

getAnonymous(gender, number) will create an anonymous object and record is with the right gender and number. There are shortcuts: getAnonMS(), getAnonMP(), getAnonFS(), getAnonFP().

At last, you can use complex structure like referring expressions to define your subjects.

Conjugate verbs subjectVerb and verb

Use subjectVerb(subject, verb) to agree a verb with a subject. +subjectVerb(PRODUCT, 'shine') will output the ring shines.

verb(subject, verb) will just output the agreed verb but not the subject. +verb(PRODUCT, 'shine') will output shines.

Instead of putting directly a verb (like shine), you can add extra parameters for the verb, typically the tense. +subjectVerb(PRODUCT, {verb:'shine', tense:'PAST'}) will output the ring shined.

subjectVerb and verb also accept a last optional param which is transmitted as is to the subject. For instance, +subjectVerb(PRODUCT, 'shine', {REPRESENTANT: 'refexpr'}) will force the referring expression representation of the product, thus outputting something like it shines.

Tenses are language specific, as well as some other parameters (e.g. the auxiliary in French). See specific parameters for:

Conjugate verbs and agree adjectives with subjectVerbAdj

Use subjectVerbAdj(subject, verbInfo, adjective) to directly generate a subject, a conjugated verb and an agreed adjective. #[+subjectVerbAdj(PRODUCT, 'ĂȘtre', 'luxueux')] will output la bague est luxueuse.

subjectVerbAdj also accepts a last optional parameter that is transmitted as is to the subject.

Also see agree adjectives.