Your text

{% for line in change_lines %} {% for word in line.split(' ') %} {% if len(word) > 0 and word[0] in source_map %} {{choice(source_map[word[0]])}} {% else %} {{word}} {% end %} {% end %}
{% end %}