dimanche 29 septembre 2019

Generate text from a given template

For example I have a string such as

    text = '{Hello|Good morning|Hi}{. We|, we} have a {good |best }offer for you.'

How can I generate a set of all possible strings with variants of words in braces?

Hello. We have a good offer for you.

Good morning, we have a best offer for you.

etc...




Aucun commentaire:

Enregistrer un commentaire