omederos / pyspinner

A simple spin-syntax parser for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Iterate over all unique texts?

livibetter opened this issue · comments

First of all, I am not familiar with the concept (purpose) of spin text, as matter of fact, this package is where I first hear of it.

Anyway, I am wondering if it's possible to list all unique texts (without randomness)? For example:

>>> text = ('The {quick|fast} {brown|gray|red} fox '
...         'jumped over the lazy dog.')
>>> for spin in spinning.all_unique_texts(text):
...    print(spin)
The quick brown fox jumped over the lazy dog.
The quick gray fox jumped over the lazy dog.
The quick red fox jumped over the lazy dog.
The fast brown fox jumped over the lazy dog.
The fast gray fox jumped over the lazy dog.
The fast red fox jumped over the lazy dog.

I check the source, but I don't think I see such functionality, maybe I miss something. That function (generator) basically yields all combinations of the spin text.

As I stated in the beginning, I know nothing about spin text, so such request might be non-sense to the purpose of spin text.