Let S(w) be a set of words. I want to generate all the possible n-combination of subsets s so that the union of those subsets are always equal to S(w).
So you have a set (a, b, c, d, e) and you wan't all the 3-combinations:
((a, b, c), (d), (e))
((a, b), (c, d), (e))
((a), (b, c, d), (e))
((a), (b, c), (d, e))
etc ...
For each combination you have 3 set and the union of those set is the original set. No empty set, no missing element.
There must be a way to do that using itertools.combination + collection.Counter but I can't even start somewhere... Can someone help ?
Luke
EDIT: I would need to capture all the possible combination, including:
((a, e), (b, d) (c))
etc ...