Branches
Branches visualize the structures and sub-decisions in your statements in the Write tab of the NLG platform. Branches facilitate formulating statements in more variable ways and arranging their components according to given requirements.
When writing a statement, you can branch off at different points in the statement to provide more than one way to express its information. Use branching to create branches that span one or more words, phrases or even whole statements.
- Branches appear one below the other in the Write Tab, so you can keep track of your construction. At each branching, you can specify different modes of deciding which branch to render.
- You can copy and paste branches as well as change the order of the branches by drag and drop.
- You can create branches at any point in a statement. This means you can also create (sub)-branches within a branch and within a container (see the warning below).
WARNING
If you create branches within a container, they are not visible in the statement, but only in the container settings.
Settings for Branches
You create branches in the Write Tab by marking those parts of a statement that should have more than one variant and clicking on the branching icon. With this marking, you define the starting and ending point for a branch: a point where the statements will split into one or more branches (a branching) and the point where the branches come together again.
For each branching you can define the conditions under which this branch should appear:
- Select the corresponding trigger variable you created in the Transform Tab.
- Set the weight for a branch that defines the frequency of appearance. Depending on the specification of the weight, the probability that the branch is triggered increases or decreases. You can only set the weight for a branch if you have chosen random in the settings for branchings (see below)
- In the general settings of each container you can switch on or off the function that a **branch will be skipped if the container is empty.
TIP
Weight
The default setting for branches weight is 1. With this, the probability of being rendered is the same for all branches.
If you set n as weight, the software acts as if this branch had been duplicated n times.
Example: You have three branches: a has weight 1, b weight 2, c weight 3. Now the software randomly selects one branch out of 6: 1*a + 2*b + 3*c.
WARNING
If you set weight to 0 or a negative number, the branch will not be rendered (its branch icon turns red).
Settings for Branchings
Click on the Branching Symbol to open the settings of the branching in the right panel, where you can define the mode of processing the associated branches:
- first: The first valid branch will be chosen.
- random: The branches are chosen randomly from the pool of valid branches.
Text shortening
- Optional: Allow this branching to be removed in case the maximum text length is exceeded; this could come from the branching's own limit, a parent branching, the containing statement, or the whole text.
- Maximum length: Set length limit for this branching. Similar to the statement-level shortening described above, this causes the following steps to happen:
- Select an available branch based on mode, and render as normal.
- If text on the branch exceeds the length limit, trim nested branchings (branchings within your branch) marked as optional, starting from the end.
- If there are no optional branchings or text still exceeds the length limit, disable this branch and select a new one (return to step 1).
- If no branch can make the length limit:
- if optional is set, omit the entire branching and continue
- otherwise, abort text generation with an error.
WARNING
If you have multiple branchings in sequence with entries of different lengths, the only mechanism to correct text length is omitting optional branchings as stated above. There is no option to find the longest combination of branches that is below the maximum.
If you have multiple "optional" branchings within a branch with a text limit, the last branching is removed first, even if the branching would have a branch available that is short enough.