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.
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.
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 to protect structures:
will output the same.
Sections protected from filtering with
protect will not be filtered. Different rules apply to what is before the protected section, namely articles, depending on the language.
In French, articles are not contracted when placed before a protected section:
| le protect OnePlus
le OnePlus (and not
In English, a/an mechanim does apply before protected sections:
| a protect AI company
an AI company (and not
a AI company).
¤ 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.
Three dots (
…) are automatically transformed into
…. You can also put
… directly in your mixins.
Capitalization is not automatic after
… because it is not systematic:
The first word after an ellipsis is capitalized if it begins a new grammatical sentence.