Filter functions

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

Filtering is used to clean the text after generation, adding caps and removing extra punctuation. It is regexp based and will have as an input a string, previously generated by Pug.

The filtering mechanism is called automatically.

Protect sections from being filtered

Filtering is nice because it will automatically manage capitalization etc. for you. But sometimes you want to disable this mechanim for some sections: Baba Inc. is a nice company instead of Baba Inc. Is a nice company.

Use the protectString(string) js function to protect your strings from begin filtered:

will output protected.string (and not protected. String).

You should favor the protect tag which better cares for spacing.

Use the protect tag to protect structures:

will output the same.

Special characters

§ and ¤ are special characters and must just not be used in your texts:

  • § is used to mark protected sections (§…​§ marks a section) before filtering.

  • ¤ is a space automatically inserted by RosaeNLG. The filtering mechanism needs to distinguish which spaces are natural from the automatic ones, especially in the protected sections.