Client side in browser compiling and rendering

This is the documentation for 2.1.2 version, which is not the latest version. Consider upgrading to 2.1.3.

Both compilation and rendering are made in the browser: templates can be authored directly in the browser, or dynamically generated, compiled in the browser and the texts can also be rendered in the browser.

To be able to do that, you must use a js version of RosaeNLG that is larger, with _comp at the end, like rosaenlg_tiny_fr_FR_*\_comp.js:

  • it includes the templates compiler

  • but also all linguistic resources that are associated with a language

Client side compilation is for exotic usecases. You should favor server side compilation.

It can be used to create a 100% client side editor and renderer, like in this demo.

Works with Firefox and Edge, but not with older IE.

German version with compiling does not work under Firefox (probably due to the huge size of the file), but works on Chrome and Edge (recent versions).

Packaged version of RosaeNLG for client side usage

RosaeNLG provides browser ready tinyified packages per language in dist/rollup:

  • 2 packages per language: classic (rendering only) and \_comp. \_comp version can compile templates. For browser usage, you should compile the templates upstream and use the classic version, as the \_comp are very large.

  • en_US rendering only version is a little larger as it includes a/an linguistic resource.

  • the German version with compilation support is huge.

200K rosaenlg_tiny_de_DE_1.20.2.js
 43M rosaenlg_tiny_de_DE_1.20.2_comp.js
308K rosaenlg_tiny_en_US_1.20.2.js
1,4M rosaenlg_tiny_en_US_1.20.2_comp.js
204K rosaenlg_tiny_es_ES_1.20.2.js
1,3M rosaenlg_tiny_es_ES_1.20.2_comp.js
224K rosaenlg_tiny_fr_FR_1.20.2.js
8,2M rosaenlg_tiny_fr_FR_1.20.2_comp.js
216K rosaenlg_tiny_it_IT_1.20.2.js
9,7M rosaenlg_tiny_it_IT_1.20.2_comp.js
120K rosaenlg_tiny_OTHER_1.20.2.js
1,2M rosaenlg_tiny_OTHER_1.20.2_comp.js