Sentences (beta)

This is the documentation for 4.2.0 version, which is not the latest version. Consider upgrading to 4.3.0.

Purpose

There are 2 general ways of building sentences with RosaeNLG:

  1. Using mixins like subjectVerb or verb, which care for building a part of a sentence, and mixing them with static texts, or other pug structures like if. This is the most common way - you only use dynamic texts and mixins when you need them.

  2. Building the different components of a sentence, in a very structured way (a nice tree with a subject, a verb, complements etc.) and generating the sentence using a single mixin (actually the sentence mixin). This is more complex, only works for rather simple sentence structures, but allows further dynamism and control in some cases.

One advantage of the second approach is that the pronouns for direct and indirect object complements can be managed automatically: I gave the neighbor an apple can become I gave her an apple or I gave it to the neighbor or I gave it to her.

Current support

The current support of RosaeNLG for complete sentences is limited:

  • Languages: it only works for French and English

  • Coverage is limited - which means in practice that some structures and combinations will not work

  • The behavior of the sentence mixin is not completely aligned with the existing mixins like verb or subjectVerb

Useful tricks

In the sentence mixin you can pass the usual parameters for the different group, in particular :

  • you can force the referential expression using the parameter REPRESENTANT: 'ref'

  • you can convey the grammatical function using the parameter deprel : refer to Universal dependencies for more details.

Examples

will generate:

  • Le tyran ne fournit aucune aide au jeune aventurier.

  • Il ne lui fournit aucune aide.

  • Cet homme ne lui fournit aucune aide.