gramener / gramex-nlg

Natural Language Generation for Gramex applications.
Other
24 stars 24 forks source link

Conditional phrases #52

Open jaidevd opened 4 years ago

jaidevd commented 4 years ago

In the variable settings modal, find a way to support simple if-else logic. Consider the following sentences:

A randomly generated number is positive.
A randomly generated number is negative.

This should be templatized as:

{% import random %}
{% set n = random.choice([-1, 1]) * random.random() %}
A randomly generated number is {% if n > 0 %}positive{% else %}negative{% end %}.