Different combinations of groups of words in a sentence : <p>I am trying to come up with an algorithm for determining all of the combinations of word groupings in a sentence (not breaking the order of the words). </p>

<p>e.g. With this sentence: "the test case phrase"
The different combinations (splitting on any number of space(s)) would be:</p>

<pre><code>['the test case phrase']
['the' , 'test case phrase']
['the test' , 'case phrase']
['the test case' , 'phrase']
['the' , 'test' , 'case phrase']
['the test' , 'case' , 'phrase']
['the' , 'test case', 'phrase']
['the' , 'test' , 'case' , 'phrase']
</code></pre>

<p>I was initially thinking permutations but from what I can tell that would be if I was seeking any re-ordered combination of the set.</p>

<p>I feel like there is a mathematical principal at work here but I just can't put my finger on it...</p>

<p>FYI: I was writing my test cases and plan to implement the solution in Javascript</p>
