Value mixin

This is the documentation for 1.16.2 version, which is not the latest version. Consider upgrading to 3.4.0.

The value(obj, params) mixin is the entry point to insert a value in a text. Its behavior depends of the type of obj.

value is the entry point of many RosaeNLG powerful features. Don’t miss it!

Number

When obj is a number, you can indicate how to format it: units, ordinals, cardinals, etc. For instance, #[+value(5500, {'TEXTUAL':true })] will output five thousand five hundred.

Date

When obj is a date, the moment lib will be used to format it. You should put a parameter to indicate how to format it. See Value for Dates.

String / noun

When obj is a string, it will either just output the string, or generate a nominal group if more parameters are set. For instance, #[+value('apple', { det:'INDEFINITE', adj:'big' })] will generate a big apple.

There is an alternative Simplified Syntax available for some languages.

Structured object

When obj is a structured object, it will trigger the referring expressions mechanisms.

The first parameter is an object, and there are generally very few additional parameters: for instance, [+value(PRODUCT)] or [+value(PRODUCT, {REPRESENTANT: 'ref'})].

You have to define how to transform the structured object into text.